unable to get Response from HttpResponse when passing soap object (soap1.2) android?

时光毁灭记忆、已成空白 提交于 2019-11-28 11:47:14

as its wsHttpBinding WCF service Android

So I Have Solved this using Following :

String METHOD_NAME = "MyMethodName"; 
String NAMESPACE = "http://tempuri.org/"; 
String URL = "MyUr;";
String SOAP_ACTION = "http://tempuri.org/MySoapAction"; 



SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

PropertyInfo req = new PropertyInfo();
req.name = "xmlstring";
req.namespace = NAMESPACE;
req.type = String.class;
req.setValue("........ MY Data.......");// without these `tags <soapenv:`
request.addProperty(req);

Element e = new Element();
e.setName("To");
e.setNamespace("http://www.w3.org/2005/08/addressing");
e.addChild(Node.TEXT,"MyUrl");

Element e1 = new Element();
e1.setName("Action");
e1.setNamespace("http://www.w3.org/2005/08/addressing");
e1.addChild(Node.TEXT,
        "http://tempuri.org/SoapAction");

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
        SoapEnvelope.VER12);
envelope.dotNet = true;
envelope.headerOut = new Element[] { e, e1 };
envelope.setOutputSoapObject(request);

HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive result = (SoapPrimitive) envelope.getResponse();

String resultData = result.toString();
Log.i("Result", "" + resultData);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!