ksoap2 object parameter
"Hong Huei Tay" <[email protected]> Thu, 27 May 2004 16:56:37 +0000
| Newsgroups | gmane.comp.java.enhydra.ksoap |
|---|---|
| Message-ID | <[email protected]> |
<html><div style='background-color:'><DIV class=RTE> </DIV>
<DIV class=RTE>Thanks Michael for your example, but can your provide a simpler one?</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>Questions:</DIV>
<DIV class=RTE>1. From my code example, how can it be fixed to work ?<BR>2. Can a SoapObject contain another SoapObject as a property (request parameter)?</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>The codes:</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE> SoapObject person = new SoapObject("urn:type-person", "person");<BR> person.addProperty("age", new Integer(21));<BR> person.addProperty("married", new Boolean(true));<BR> person.addProperty("name", "freakin");<BR> person.addProperty("salary", new Long(5000));
<DIV class=RTE> </DIV>
<DIV class=RTE> // create soap object <BR> SoapObject method = new SoapObject("urn:soap-call", "echoPerson"); <BR> method.addProperty("person", person);</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE> // create envelope<BR> SoapSerializationEnvelope env = new SoapSerializationEnvelope(SoapEnvelope.VER10);<BR> env.bodyOut = method; </DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE> // create http transport to send the envelope<BR> HttpTransport http = new HttpTransport ("<A href="http://localhost:8080/axis/services/EchoWebservice"><STRONG><FONT color=#002390>http://localhost:8080/axis/services/EchoWebservice</FONT></STRONG></A>"); <BR> http.debug = true;</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE><BR>this is the response dump:</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE><?xml version="1.0" encoding="UTF-8"?><BR><soapenv:Envelope xmlns:soapenv="<A href="http://schemas.xmlsoap.org/soap/envelope/"><STRONG><FONT color=#002390>http://schemas.xmlsoap.org/soap/envelope/</FONT></STRONG></A>" xmlns:xsd="<A href="http://www.w3.org/2001/XMLSchema"><STRONG><FONT color=#002390>http://www.w3.org/2001/XMLSchema</FONT></STRONG></A>" xmlns:xsi="<A href="http://www.w3.org/2001/XMLSchema-instance"><STRONG><FONT color=#002390>http://www.w3.org/2001/XMLSchema-instance</FONT></STRONG></A>"><BR> <soapenv:Body><BR> <soapenv:Fault><BR> <faultcode>soapenv:Server.userException</faultcode><BR> <faultstring>org.xml.sax.SAXException: Deserializing parameter &apos;person&apos;: could not find deserializer for type {urn:type-person}person</faultstring><BR> <de
tail/><BR> </soapenv:Fault><BR> </soapenv:Body><BR></soapenv!
:Envelope><BR>soapenv:Server.userException</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>I hope there's a simpler way to achieve this</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>Thanks again in advance</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE> </DIV></DIV></div><br clear=all><hr>The new <a href="http://g.msn.com/8HMAEN/2737??PS=47575">MSN 8:</a> smart spam protection and 2 months FREE* </html>