Title: Message

 

Bruce:

 

            All of the xml parsers that I’ve played around with crash when they see a < or a > character and unfortunately the xml writers that I’ve seen will convert escape characters into the character they represent when they are written out.  So unless you are in the serializer and ensuring that the escape sequence is being written out you will probably have problems.  The fastest way to check this is catch your outgoing message in the TCP monitor and view what is actually coming back.  If you see the angle brackets instead of the escape sequence that is your problem most likely.

 


    <getEnvelopeRecipientReturn xsi:type="xsd:string">&lt; Any string at all &gt;</getEnvelopeRecipientReturn>   good
    <getEnvelopeRecipientReturn xsi:type="xsd:string"><Any string at all></getEnvelopeRecipientReturn>   bad

 

 

 I haven’t played around with the serializer to tell you what the best way is to make this conversion as the xml is being written out.

 

Theron


From: Bruce McHaffie [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 08, 2005 3:36 PM
To: '[email protected]'
Subject: returning XML as xsd:string

 

Hi, I have a Java web service that returns xsd:string data to the Axis C++ client. I have noticed that if the returned string contains angle brackets (<>) then the client fails (with a heap corruption message -- I'm running in debug). The SOAP message is returned correctly, and the start element is found. The error seems to happen when the client tries to parse the message for the content of the string.

 

Client fails at:  getElementAsString( AxisChar* pName, AxisChar* pNamespace)

File is: SoapDeSerializer.cpp

Line number is: 3049 in Axis C++ 1.4,

Call is: m_pNode = m_pParser->next (true);

 

Sample SOAP message that fails:

 

<soapenv:Envelope>
 <soapenv:Body>
  <getEnvelopeRecipientResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <getEnvelopeRecipientReturn xsi:type="xsd:string"><Any string at all></getEnvelopeRecipientReturn>
  </getEnvelopeRecipientResponse>
 </soapenv:Body>
</soapenv:Envelope>

 

Sample SOAP message that works:

 

<soapenv:Envelope>
 <soapenv:Body>
  <getEnvelopeRecipientResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <getEnvelopeRecipientReturn xsi:type="xsd:string">Any string at all</getEnvelopeRecipientReturn>
  </getEnvelopeRecipientResponse>
 </soapenv:Body>
</soapenv:Envelope>

 

I tried escaping the angle brackets with &lt; and &gt; but that didn't solve the problem. Any ideas?

 

Thanks,

 

Bruce.

 

Reply via email to