12-13-2011 04:04 AM
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><FI XPART><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><FIX PART><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; }
12-13-2011 04:06 AM
12-13-2011 09:56 AM
for complex requests you have to create a class that implements KvmSerializable ..
Refer this link for a small example