I have application that running on my local machine on jboss.
I downloaded wsdl file, generate java code in eclipse. Run and have exception:
caught exception while handling request: deserialization error: java.lang.NumberFormatException: For input string: ""
(Application correctly work with another simple WS).
After some Googling I found that code generate wrong xml:
expected:
<soapenv:Body>
<ns1:setLevel soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="###">
<id xsi:type="xsd:string">x2148</id>
<level xsi:type="xsd:long">5</level>
</ns1:setLevel>
</soapenv:Body>
but through TCPMon/Fiddler i found that my requests look like that:
<soapenv:Body>
<ns1:setLevel soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="###">
<id xsi:type="xsd:string">x2148</id>
<level href="#id0" />
</ns1:setLevel>
<multiRef id="id0" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="xsd:long" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">5</multiRef>
</soapenv:Body>
after googling i found that solution is change
<parameter name="sendMultiRefs" value="true"/>
on false in server-config.wsdd file on server side. But i don't have this file.
Any solutions? I see only one solution - change xml file on runtime - but it's sounds not good.
The server-config.wsdd file is a part of the remote service description. The entity that published that WSDL you downloaded (service provider) would have to change it and redeploy on their side. Lucky you if you published the service...you can change it. Unlucky you if dealing with third-party.
We dealt with a similar problem by applying a stylesheet to the response to flatten the multi refs. Got the stylesheet from StackOverflow in fact [here][1]Creating XSLT transform to flatten multiRef encoded SOAP message
It works pretty good as is to flatten the response back to the schema you were expecting. But be warned, it doesn't handle multiRefs of multiRefs. I need a solution to that myself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With