tags:

views:

69

answers:

2

Hi,

In my WSDL my reponse I have it setup to be like this:

<message name='getPartsResponse'>
  <part name='Result' type='xsd:string'/>
</message>

The problem I am having is that what I am sending in the response is XML and not an string. As a result of this I am getting the XML of the response (not the XML SOAP Response (that is ok)) with HTML entities instead of the < and > XML has.

This is what I get:

<SOAP-ENV:Body>
<ns1:getPartsResponse>
<Result xsi:type="xsd:string">
&lt ;catalog&gt ;
&lt ;result id="1"&gt ;
&lt ;part&gt ;AAAAAAAAAAA&lt ;/part&gt ;
&lt ;qty>0000000000&lt ;/qty&gt ;
&lt ;mfg&gt ;XXXXXXXXXXXXX&lt ;/mfg&gt ;
&lt ;/result&gt ;
&lt ;result id="2"&gt ;
&lt ;part&gt ;BBBBBBBBBBB&lt ;/part&gt ;
&lt ;qty>11111111111&lt ;/qty&gt ;
&lt ;mfg&gt ;ZZZZZZZZZZZZZ&lt ;/mfg&gt ;
&lt ;/result&gt ;
&lt ;/catalog&gt ;
</Result>
</ns1:getPartsResponse>
</SOAP-ENV:Body>

And this is what I want to get:

<SOAP-ENV:Body>
<ns1:getPartsResponse>
<Result xsi:type="xsd:string">
<catalog>
<result id="1">
<part>AAAAAAAAAAA</part>
<qty>0000000000</qty>
<mfg>XXXXXXXXXXXXX</mfg>
</result>
<result id="2">
<part>BBBBBBBBBBB</part>
<qty>11111111111</qty>
<mfg>ZZZZZZZZZZZZZ</mfg>
</result>
</catalog>
</Result>
</ns1:getPartsResponse>
</SOAP-ENV:Body>

What am I missing?

Thank you.

A: 

Unless the schema for the service describes exactly the XML you are trying to send, you have to use XML escapes to make your XML pass through the pipe as a string. &lt;tag&gt; instead of <tag>, etc, etc, etc.

Or, you need to change the schema to use an XML schema 'any' particle.

If this is all new to you, I recommend downloading a distribution of Apache CXF. Look at the 'wsdl-first' examples and see how the schema is integrated.

bmargulies
I have the xsd schema for the file I am returning, but I haven't been able to figure out how to connected to the wsdl to make it the repose type. Do you know of a tutorial that can help me?
redhatlab
<xs:import>
bmargulies
A: 

Why did you specify the type of the message part was xsd:string? It should have been specified as xsd:any or as a specific type defined in your schema. Then you could include it inline.

You are seeing precisely what you asked the computer to do.

John Saunders
I did try "xsd:any", but it didn't make a difference.
redhatlab
@redhatlab: did you update your client after you changed the WSDL? `xsd:any` should have made a huge difference. If nothing else, you should not still get `xsi:type=xsd:string` if the `xsd:any` has taken effect. I don't know PHP, but this is how it would work with .NET.
John Saunders