The XMLStreamReader.getNamespaceContext() context should have a context that has all the namespaces declared. Thus, if you need to map a prefix or similar, you should be able to use that. However, you cannot “grab” the namespaces and copy them or anything. :(
With 3.1.1, you can set the property “org.apache.cxf.binding.soap.addNamespaceContext" to true on the endpoint and then we’ll record the various namespaces in a map and set them on the message with the “soap.body.ns.context” property. Dan > On Jun 18, 2015, at 6:30 AM, Julien Charon <[email protected]> wrote: > > Hi, > > > I used wsdl2java to generate JAX-WS classes from a WSDL using staxsource data > binding. When I parse the received XML with the XMLStreamReader from the > StaxSource, the namespaces defined in the SOAP part of the message are not > available, but I need those because I have to pass the XML to another service. > > Examples: > This will work because the namespace is defined in the XML that will be > passed to the WebMethod: > <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > > <soapenv:Header/> > <soapenv:Body> > <ns:GetCapabilities service="WFS" > xmlns:ns="http://www.opengis.net/wfs/2.0"> > </ns:GetCapabilities> > </soapenv:Body> > </soapenv:Envelope> > > This will not work because the namespace is defined in the SOAP envelope: > <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:ns="http://www.opengis.net/wfs/2.0"> > <soapenv:Header/> > <soapenv:Body> > <ns:GetCapabilities service="WFS"> > </ns:GetCapabilities> > </soapenv:Body> > </soapenv:Envelope> > > Is there a way to access the namespaces defined in the SOAP envelope without > having to parse it myself? > > > Mit freundlichen Grüßen / With kind regards, > Julien Charon > > Avitech GmbH > Engineering AxL > Tel.: +49 (0)7541/282-177 > Fax: +49 (0)7541/282-199 > e-mail: [email protected]<mailto:[email protected]> > ________________________________________________ > Avitech GmbH > Principal Office: Bahnhofplatz 1 | 88045 Friedrichshafen | Germany > Court Registration: Amtsgericht Ulm | HRB 728293 > Geschäftsführer/Managing Director: Antonio Maria Gonzalez Gorostiza > http://avitech.aero<http://avitech.aero/> > > This message may contain confidential information and is intended only for > the individual named. If you are not the named addressee you should not > disseminate, distribute or copy this e-mail. Please notify the sender > immediately by e-mail if you have received this e-mail by mistake and delete > this e-mail from your system. > -- Daniel Kulp [email protected] - http://dankulp.com/blog Talend Community Coder - http://coders.talend.com
