0
votes

I am trying to access a 3rd party web service using Apache CXF 3.1. When I call the service with the wsdl2java generated code or curl the service returns an exception indicating the message is not a valid SOAP message. See the message below.

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <connectivityTest xmlns="urn:cdc:iisb:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="connectivityTest">
      <echoBack>Hello IIS!</echoBack>
    </connectivityTest>
  </soap:Body>
</soap:Envelope>

When I remove the namespace (soap:) and call the service using curl the service works. See working message below.

<?xml version="1.0" encoding="utf-8"?>
<Envelope xmlns="http://www.w3.org/2003/05/soap-envelope">
  <Body>
    <connectivityTest xmlns="urn:cdc:iisb:2011" xmlns:ns2="http://www.w3.org/2003/05/soap-envelope">
      <echoBack>Hello IIS V2!</echoBack>
    </connectivityTest>
</Body>

How do I remove the namespace from the Envelope and Body elements of my SOAP message before it sent? Based on searching the web it looks like I may need to create an interceptor. If some one can provide an example of an interceptor to remove the namespace from the Envelope and Body elements it would be much appreciated.

Thanks in advance! JR

1

1 Answers

1
votes

No Interceptor is required for this. You can configure the namespace in your jaxws properties.

<jaxws:properties> 
  <entry key="soap.env.ns.map"> 
       <map> 
           <entry key="" value="http://schemas.xmlsoap.org/soap/envelope/"/> 
       </map> 
  </entry> 
  <entry key="disable.outputstream.optimization" value="true"/> 
</jaxws:properties>