Namespace prefixes

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Namespace prefixes

NicholaiX
Is there a known issue with namespace prefixes in the body, or am I missing something in the documentation that Google has not turned up for me?

I've tried setting the namespaces via "soap.env.ns.map" inside an output interceptor, and also on the endpoint itself... It works great for the header, namespaces get updated, but it doesn't seem to affect the prefixes of the items inside the body (they still get ns2, ns3, etc).

This is on CXF 3.2-SNAPSHOT.
And I've also tried setting "disable.outputstream.optimization" to  Boolean.TRUE or "true" (are those equivalent?). But still can't affect the namespaces in the body.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Namespace prefixes

Andrei Shakirin
Hi,

Try additionally to set property "disable.outputstream.optimization" to true.

You can take this as example: https://git-wip-us.apache.org/repos/asf?p=cxf.git;a=blob;f=systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java;h=900c5fe407d8606cd52634bdb31aefb57fc86113;hb=HEAD

Regards,
Andrei.

> -----Original Message-----
> From: NicholaiX [mailto:[hidden email]]
> Sent: Samstag, 5. August 2017 06:25
> To: [hidden email]
> Subject: Namespace prefixes
>
> Is there a known issue with namespace prefixes in the body, or am I missing
> something in the documentation that Google has not turned up for me?
>
> I've tried setting the namespaces via "soap.env.ns.map" inside an output
> interceptor, and also on the endpoint itself... It works great for the header,
> namespaces get updated, but it doesn't seem to affect the prefixes of the items
> inside the body (they still get ns2, ns3, etc).
>
> This is on CXF 3.2-SNAPSHOT.
> And I've also tried setting "disable.outputstream.optimization" to Boolean.TRUE
> or "true" (are those equivalent?). But still can't affect the namespaces in the
> body.
>
>
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Namespace-
> prefixes-tp5782462.html
> Sent from the cxf-user mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Namespace prefixes

NicholaiX
That is what I already tried. I end up with something like this. Some of the namespaces are superfluous.


<soap11:Envelope xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:epoll="http://schemas.microsoft.com/windows/pki/2009/01/enrollment/RSTRC" xmlns:wsauth="http://schemas.xmlsoap.org/ws/2006/12/authorization" xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512" xmlns:wst14="http://docs.oasis-open.org/ws-sx/ws-trust/200802" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" xmlns:enroll="http://schemas.microsoft.com/windows/pki/2009/01/enrollment/RSTRC" xmlns:mde="http://schemas.microsoft.com/windows/management/2012/01/enrollment">
  <soap11:Header>
    <a:Action xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" soap11:mustUnderstand="1" xsi:type="xs:string">http://schemas.microsoft.com/windows/pki/2009/01/enrollment/RSTRC/wstep</a:Action>
    <a:MessageID>...</a:MessageID>
    <a:To>http://www.w3.org/2005/08/addressing/anonymous</a:To>
    <a:RelatesTo>...</a:RelatesTo>
  </soap11:Header>
  <soap11:Body>
    <RequestSecurityTokenResponseCollection xmlns="http://docs.oasis-open.org/ws-sx/ws-trust/200512" xmlns:ns2="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:ns3="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:ns4="http://www.w3.org/2005/08/addressing" xmlns:ns5="http://docs.oasis-open.org/ws-sx/ws-trust/200802">
      <RequestSecurityTokenResponse>
        <TokenType>http://schemas.microsoft.com/5.0.0.0/ConfigurationManager/Enrollment/DeviceEnrollmentToken</TokenType>
        <RequestedSecurityToken>
          <ns3:BinarySecurityToken ValueType="..." EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#base64binary"..</ns3:BinarySecurityToken>
        </RequestedSecurityToken>
      </RequestSecurityTokenResponse>
    </RequestSecurityTokenResponseCollection>
  </soap11:Body>
</soap11:Envelope>

What I was hoping to get was that the internal namespaces are properly prefixed, and the ns3 namespace should be wsse.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Namespace prefixes

NicholaiX
Actually I was wrong (doesn't fix the problem though). I was trying to turn off optimization at different locations, and I got confused.


Setting this:

props.put("soap.env.ns.map", my_namespaces);
props.put("disable.outputstream.optimization", "true");
endpoint.setProperties(props);
endpoint.publish("/myendpoint");

doesn't seem to have any discernable effect. All tags inside the body are prefixed by ns1, ns2, etc.. If I turn it off and on, the output doesn't seem to change.

If I do a similar thing in an AbstractSoapInterceptor (like this: x.put(AbstractOutDatabindingInterceptor.DISABLE_OUTPUTSTREAM_OPTIMIZATION, "true") it seems to work somewhat. If I set it to false, I get all tags prefixed by ns1, ns2, ns3. If I set it to false, I get the tags unprefixed, except for the ns3 tag, as shown in previous post.


So, I'm confused, I guess.






Loading...