AW: URGENT:!!! Please help insert XML data in kSOAP envel ope
"Hepp A., DP ITS,SMR,TR" <[email protected]> Wed, 29 Oct 2003 14:36:27 +0100
| Newsgroups | gmane.comp.java.enhydra.ksoap |
|---|---|
| Message-ID | <A1BD40E92A77D411BC820001FA3264CA0275DE84@NWTAH022.DeutschePost.de> |
Hi! Your Problem is, that your result contains XML-Data as a string. That means that there are characters, that can not be included in XML-Marshalling, such as '<' or '>'. So, when adding the property to your response, these characters are being encoded to these entities. You need to find a way to put the data you have inside your result into an own SoapObject and then add this to your response-Object. HF&GL regds Alex -----Ursprüngliche Nachricht----- ' Von: KHOURY Shérine (Dr&T) [mailto:[email protected]] Gesendet: Mittwoch, 29. Oktober 2003 15:16 An: [email protected] Betreff: Ksoap: URGENT:!!! Please help insert XML data in kSOAP envelope Hi guys, I have to send an XML result looking like this <Person> <FirstName>Smith</FirstName> <LastName>John</LastName> </Person> inside a SOAP message using kSOAP. I'm proceding as follows: //result being a String containing the XML result response = new SoapObject( soapReq.getNamespace( ) , name + "Response" ); if ( result != null ) response.addProperty( "return", result ); } SoapEnvelope ResEnv = new SoapEnvelope(); // Puts the Soap response in the envelope's body ResEnv.setBody(response); The problem is that upon receipt of this Soap message, the contents of the SOAP envelope looks something like this: <SOAP-ENV:Envelope xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" <http://www.w3.org/2001/XMLSchema-instance> xmlns:xsd= "http://www.w3.org/2001/XMLSchema" <http://www.w3.org/2001/XMLSchema> xmlns:SOAP-ENC= "http://schemas.xmlsoap.org/soap/encoding/" <http://schemas.xmlsoap.org/soap/encoding/> xmlns:SOAP-ENV= "http://schemas.xmlsoap.org/soap/envelope/" <http://schemas.xmlsoap.org/soap/envelope/> > <SOAP-ENV:Body SOAP-ENV:encodingStyle= "http://schemas.xmlsoap.org/soap/encoding/" <http://schemas.xmlsoap.org/soap/encoding/> > <findResponse xmlns="urn:sncf:profilekeeper:profilekeeper.ProfileKeeper" id="o0" SOAP-ENC:root="1"> <return xmlns="" xsi:type="xsd:string"><Person> <FirstName>Smith</FirstName> <LastName>John</LastName> <Person> </return> </findResponse> </SOAP-ENV:Body> Can anyone tell me how to avoid letting SoapObject assume all properties to be Strings? I'm in urgent need of help!! So I will appreciate any suggestions