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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
New Contributor
Posts: 3
Registered: ‎12-13-2011
My Device: blackberry bold 9000
My Carrier: 60132906603

ksoap2 send parameters as xml string

i'm stuck with this in the past few days... my soap requestformat should look like this

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body>< WsAbcMobileAcctInq xmlns="http://tempuri.org/"><xml_var><HCMSG xmlns=""> <ABC><ABCTRANSID>MOBL</ABCTRANSID></ABC><REF><TXNTYPE>INQ</TXNTYPE><SC_CD>000ACD</SC_CD> <REFNO>MOBL0000000060018987941MAT</REFNO></REF><FIXPART><TXNDATE>20110105</TXNDATE> <TXNTIME>11464178</TXNTIME><AGN_CD>000000006001</ AGN_CD ></FIXPART><VARPART> <AC_NO TYP="N">0000000000008946565</AC_NO> <IC_NO TYP="N">0008956466546</ IC_NO><ID_CD TYP="S">IN</ ID_CD> </VARPART></HCMSG></xml_var></ WsAbcMobileAcctInq></soap:Body></soap:Envelope> 

how do I do it using blackberry and ksoap? this is what i did so far, but without success

SoapObject rpc = new SoapObject(serviceNamespace, "HelloServer"); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.headerOut = new Element[1]; envelope.headerOut[0] = buildAuthHeader(); envelope.bodyOut = rpc; envelope.dotNet = true; envelope.encodingStyle = SoapSerializationEnvelope.XSD; rpc.addProperty("msg", (new Date()).toString()); envelope.bodyOut = rpc; envelope.dotNet = true; envelope.encodingStyle = SoapSerializationEnvelope.XSD; rpc.addProperty("msg", (new Date()).toString()); HttpTransport ht = new HttpTransport(serviceUrl); ht.debug = true; String result; try { ht.call(soapAction, envelope); result = (envelope.getResponse()).toString(); System.out.println("resultttt:" + result); } catch(Exception ex) { result = ex.toString(); // do something with this later. System.out.println("resultttterror:" + result); } 

and here's the buildAuthHeader function:

private Element buildAuthHeader() { String sMobileXml = '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">' + '<soap:Body>< WsAbcMobileAcctInq xmlns="http://tempuri.org/"><xml_var>' + '<HCMSG xmlns=""><ABC><ABCTRANSID>MOBL</ABCTRANSID></ABC><REF><TXNTYPE>INQ</TXNTYPE><SC_CD>000ACD</SC_CD>< REFNO>MOBL0000000060018987941MAT</REFNO></REF><FIXPART><TXNDATE>20110105</TXNDATE>' +'<TXNTIME>11464178</TXNTIME><AGN_CD>000000006001</ AGN_CD ></FIXPART><VARPART>' +'<AC_NO TYP="N">0000000000008946565</AC_NO>' +'<IC_NO TYP="N">0008956466546</ IC_NO><ID_CD TYP="S">IN</ ID_CD>' +'</VARPART></HCMSG></xml_var></ WsAbcMobileAcctInq></soap:Body></soap:Envelope>'; Element h = new Element().createElement(NAMESPACE, "AuthHeader"); Element username = new Element().createElement(NAMESPACE, "sMobileXml"); username.addChild(Node.TEXT, sMobileXml); h.addChild(Node.ELEMENT, username); return h; }
New Contributor
Posts: 3
Registered: ‎12-13-2011
My Device: blackberry bold 9000
My Carrier: 60132906603

Re: ksoap2 send parameters as xml string

instead of the method i'm using above, i'm thinking sending the soaprequest as xml string.. as suggested by post no#5 in this thread http://supportforums.blackberry.com/t5/Java-Development/Ksoap2-complex-data-types/m-p/1456563#M18519... .. because i faced the same prob when developing an android apps, and sending the whole parameters as xml string solves the problem.. but I donno how to do it in blackberry
Highlighted
Developer
Posts: 254
Registered: ‎03-15-2011
My Device: simulator
My Carrier: simulator

Re: ksoap2 send parameters as xml string

for complex requests you have to create a class that implements KvmSerializable ..

 

Refer this link for a small example

http://supportforums.blackberry.com/t5/Java-Development/KSOAP2-Complex-type-containing-complex-type-...

------------------------------------------------------------------------------------------------
Click "Accept as Solution" if post was what you needed. Give kudos if you feel response is helpful.