android call soap webservice- getting message of Server was unable to process request

对着背影说爱祢 提交于 2020-01-07 03:52:11

问题


I am very new to soap webservice i need help... this is my code i am not able to understand the problem.. please help....

     private static String URL = "MYURL.asmx";
        private static String SOAP_ACTION = "http://tempuri.org/methodname";
        private static String NAMESPACE = "http://tempuri.org/";
        private static String METHOD_NAME = "methodname";
 //Create request
        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
        request.addProperty("parm1", "11111111");
        request.addProperty("parm2", "111");
        request.addProperty("parm3", "11");
        //Create envelope
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                SoapEnvelope.VER11);
        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
        try {
            //Invole web service
            androidHttpTransport.call(SOAP_ACTION, envelope);
            if (envelope.bodyIn instanceof SoapFault) {
                String str= ((SoapFault) envelope.bodyIn).faultstring;
                Log.i("", str);
                System.out.println("str!!!!!!!!!!!!! = " + str);
  } else {
                SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
                Log.d("WS", String.valueOf(resultsRequestSOAP));
                System.out.println("String.valueOf(resultsRequestSOAP)!!!!!!!!!! = " + String.valueOf(resultsRequestSOAP)+"");
            }
  } catch (Exception e) {
            System.out.println("e.getMessage()!!!!!!!!!! = " + e.getMessage());
        }

But i am getting System.out﹕

 str!!!!!!!!!!!!! = Server was unable to process request. ---> Object reference not set to an instance of an object.

and this is my ws

  POST URL.asmx HTTP/1.1
        Host: www.URL.in
        Content-Type: text/xml; charset=utf-8
        Content-Length: length
        SOAPAction: "http://tempuri.org/METHODNAME"

        <?xml version="1.0" encoding="utf-8"?>
        <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>
            <GetTransactionStatus xmlns="http://tempuri.org/">
              <req>
                <param1xmlns="http://URL.net/smurl">int</param1>
              </req>
              <header>
                <param2>string</param2>
                <param3>string</param3>
              </header>
            </METHODNAME>
          </soap:Body>
        </soap:Envelope>

来源:https://stackoverflow.com/questions/34670782/android-call-soap-webservice-getting-message-of-server-was-unable-to-process-re

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