开发者

"org.xmlpull.v1.XmlPullParserException: expected: START_TAG" Error

开发者 https://www.devze.com 2023-03-01 06:41 出处:网络
In my application i am accessing some web services that are in my local system. When i am invoking this services from my PC, these all working abs fine but when these services called from another syst

In my application i am accessing some web services that are in my local system. When i am invoking this services from my PC, these all working abs fine but when these services called from another system. on the call i am receiving the error

"org.xmlpull.v1.XmlPullParserException: expected: START_TAG".

Here is my code:

    public String getAccountsNames(int billId){

        String value = new String();
        System.out.println("Inside getAccounts开发者_如何学运维Details method...........");
        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
        request.addProperty("billId", billId);

        SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        soapEnvelope.dotNet=true;
        soapEnvelope.setOutputSoapObject(request);
        AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL);
        try
        {
            androidHttpTransport.call(SOAP_ACTION, soapEnvelope);
            SoapPrimitive  resultString = (SoapPrimitive)soapEnvelope.getResponse();
            value = resultString.toString();
            System.out.println("This getAccountsNames xmls is : "+xml);
        }   catch (Exception e) {
            e.printStackTrace ();
        }
        return value;
   }

Also i have checked by setting SoapEnvelope.VER11, VER12, VER10. But the problem is same everytime.

Please suggest. thanks.


Probably you're not getting an XML response when you're on other systems. You can see what you're getting this way:

androidHttpTransport.debug = true;
// ...
// execute the request
// ...
androidHttpTransport.responseDump; // <-- a string containing server response

Also: not that this might be the problem, but AndroidHttpTransport is deprecated, you should use HttpTransportSE.


AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL);

I had a similar issue and it was because I accidently inserted my NAMESPACE address instead of the URL, which was different. When I switched that back out, it worked.

As an added suggestion, if you are not seeing your parameter getting passed correctly, try excluding the line:

soapEnvelope.dotNet=true;

for me, I had a boolean value that was constantly being passed as false until I commented that line out.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号