ksoap 2 object parameters

"Hong Huei Tay" <[email protected]> Thu, 27 May 2004 16:20:04 +0000
Newsgroups gmane.comp.java.enhydra.ksoap
Message-ID <[email protected]>
<html><div style='background-color:'><DIV class=RTE>Hi,</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>Has anyone tried sending complex objects as parameters using kSOAP 2 (not kSOAP 1.2) ? </DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>Here is a section of my code:</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SoapObject person = new SoapObject("urn:type-person", "person");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; person.addProperty("age", new Integer(21));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; person.addProperty("married", new Boolean(true));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; person.addProperty("name", "freakin");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; person.addProperty("salary", new Long(5000));</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // create soap object <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SoapObject method = new SoapObject("urn:soap-call", "echoPerson");&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; method.addProperty("person", person);</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // create envelope<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SoapSerializationEnvelope env = new SoapSerializationEnvelope(SoapEnvelope.VER10);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; env.bodyOut = method;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // create http transport to send the envelope<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HttpTransport http = new HttpTransport&nbsp;&nbsp;&nbsp;&nbsp; ("<A href="http://localhost:8080/axis/services/EchoWebservice">http://localhost:8080/axis/services/EchoWebservice</A>");&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http.debug = true;</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE><BR>this is the response dump:</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&lt;?xml version="1.0" encoding="UTF-8"?&gt;<BR>&lt;soapenv:Envelope xmlns:soapenv="<A href="http://schemas.xmlsoap.org/soap/envelope/">http://schemas.xmlsoap.org/soap/envelope/</A>" xmlns:xsd="<A href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>" xmlns:xsi="<A href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</A>"&gt;<BR>&nbsp;&lt;soapenv:Body&gt;<BR>&nbsp; &lt;soapenv:Fault&gt;<BR>&nbsp;&nbsp; &lt;faultcode&gt;soapenv:Server.userException&lt;/faultcode&gt;<BR>&nbsp;&nbsp; &lt;faultstring&gt;org.xml.sax.SAXException: Deserializing parameter &amp;apos;person&amp;apos;:&nbsp; could not find deserializer for type {urn:type-person}person&lt;/faultstring&gt;<BR>&nbsp;&nbsp; &lt;detail/&gt;<BR>&nbsp; &lt;/soapenv:Fault&gt;<BR>&nbsp;&lt;/soapenv:Body&gt;<BR>&lt;/soapenv:Envelope&gt;<BR>soapenv:Server.userExcepti
 on</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE><BR>Can someone help me out? </DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>Thanks in advance</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&nbsp;</DIV></div><br clear=all><hr>Tired of spam? Get <a href="http://g.msn.com/8HMAEN/2734??PS=47575">advanced junk mail protection</a> with MSN 8.</html>