Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

multiRef in generated xml sending by WS

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.

like image 805
Ifozest Avatar asked Jan 14 '13 13:01

Ifozest


1 Answers

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.

like image 138
Bill Dolan Avatar answered Oct 23 '22 08:10

Bill Dolan