Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
mabs
Posts: 129
Registered: ‎09-21-2009
My Device: Not Specified
Accepted Solution

Ksoap2 complex data types

I am trying to pass xml as a parameter into a webservice, however it does not appear to work. 

 

The webservice is a .net service, one of the paramters required is a dataset.  This is built in xml which I am putting into a string then adding it as a paramter using,

 

 

SoapObject rpc = new SoapObject(serviceNamespace, _soapAction);
rpc.addProperty("paramname", xml);

 I have no problems sending basic parameter types, just the complex type seems to be incorrect.  Has any one else managed to use complex data types when communicating to a web service using Ksoap2?

 

Please use plain text.
Developer
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Ksoap2 complex data types

you have to add a mapping for each type to ksoap to enable complex data types. you can find some basic example here: http://www.codeproject.com/KB/mobile/CallWebServiceFromkSOAP.aspx?msg=2784881
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
mabs
Posts: 129
Registered: ‎09-21-2009
My Device: Not Specified

Re: Ksoap2 complex data types

Thanks for the reply,

 

Looking at the article it seems that you assign the mapping to the envelope, some of the parameters are ints, only one is complex and that is xsd:schema.  How would this be added to one property as there seems to be no option for that?

Please use plain text.
Developer
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Ksoap2 complex data types

use SoapSerializationEnvelope addMapping with the namespace, the name of the class (as in the wsdl) and the class (getClass() or .class) itself.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
nirmalsat
Posts: 207
Registered: ‎07-31-2009
My Device: Not Specified

Re: Ksoap2 complex data types

Or if ur having trouble mapping stuff and if its jus Xml that u want to send across , u could simply convert the Xml to string and then send it. Its a crude way of doing it , i know but it will serve the purpose. ..

------------------------------------------------------------------------------------------------------------------------
Click the Kudos! badge on left side of the message , if you are happy with a solution given by a user. When you do so, you are saying thanks to its author.
Mark a reply as a solution , if you think your question has been answered.
To mark a message as a solution: Click "Accept as solution" icon on the reply.
Please use plain text.
New Contributor
imin
Posts: 3
Registered: ‎12-13-2011
My Device: blackberry bold 9000
My Carrier: 60132906603

Re: Ksoap2 complex data types

"u could simply convert the Xml to string and then send it.. .."

may I know how to do that? thanks
Please use plain text.