I have a ASP.NET 2.0 webservice that is being invoked from JAX-WS 2.1. If I test with SOAP UI it works. SOAP UI generates a request of the form
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sup="abc.123">
<soapenv:Header/>
<soapenv:Body>
<sup:Method>
<sup:element>GBA</sup:element>
<sup:attributes>
<sup:Attribute>
<sup:attributeName>XYZ</sup:attributeName>
<sup:attributeValue>123</sup:attributeValue>
</sup:Attribute>
</sup:attributes>
<sup:nop>abc</sup:nop>
<sup:data>1</sup:data>
</sup:Method>
</soapenv:Body>
</soapenv:Envelope>
This works correctly, and the web service receives and correctly processes the data. However the JAX-WS client creates a request of the form
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<Method xmlns="abc.123">
<element>
<name>GBA</name>
</element>
<attributes>
<Attribute>
<attributeName>XYZ</attributeName>
<attributeValue>123</attributeValue>
</Attribute>
</attributes>
<nop>abc</nop>
<data>1</data>
</Method>
</soapenv:Body>
</soapenv:Envelope>
This does not work correctly. The ASP.NET webservice interprets all the parameters except element
as null
. Obviously this causes processing to fail. A message is returned and correctly interpreted by the JAX-WS proxy.
How can I force JAX-WS (either in the client generation or in the code) to use the namespace prefix? Alternatively is there a way to tell ASP.NET how to interpret the SOAP message as is?
So far I've read up on JAX-WS and it seams to have plenty of options for customizing the java created, but I haven't found any parameters or binding rules for customizing how it creates the SOAP.
The only thing I have found that looks promising is using a SoapHandler
to manually edit the xml construct, as was suggested in this answer. However this involves writing code to walk the DOM and prepend the prefix to each node. I haven't successfully tested this option yet ...