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

后端 未结 1 1065
猫巷女王i
猫巷女王i 2020-12-10 21:56

Code :

            String response ;
            try {
                final String SOAP_ACTION = \"http://tempuri.org/myAction\";
                 


        
相关标签:
1条回答
  • 2020-12-10 22:40

    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);
    
    0 讨论(0)
提交回复
热议问题