开发者

XmlPullParser Exception

I'm not able to resolve this error:

org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://www.w3.org/2001/12/soap-envelope}Envelope (position:START_TAG @1:6 in java.io.InputStreamReader@43e524c8)

I have an Android app which accesses a .NET web service. It passes an int and receives an int as a response. I'm using ksoap2. I added the permissions to the manifest file also and moreover I included all jar files. However, I'm stuck and I am unable to view which SOAP request I am sending.

My code is:

public class FirstAppUI extends Activity{

    private static final String NAMESPACE = "http://tempuri.org/";

    private static final String URL = 
        "http://nautilussoft.biz.whbus12.onlyfordemo.com/staging/litigation/demowebservice.asmx";

private static final String SOAP_ACTION ="http://tempuri.org/GetNumber";

private static final String METHOD_NAME = "GetNumber";

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        TextView tv= (TextView)findViewById(R.id.TextView01);
        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
        request.addProperty("maxbelow", "123");
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 

        envelope.dotNet= true;
        envelope.setOutputSoapObject(request);
        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
        try {
            //Toast.makeText(getBaseContext(), "received object", Toast.LENGTH_SHORT).show();
            androidHttpTransport.call(SOAP_ACTION, envelope);

             Object resultsRequestSOAP = (SoapObject)envelope.getResponse();
            //SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
            //Toast.makeText(getBaseContext(), "received object", Toast.LENGTH_SHORT).show();
            tv.setText("Received :" + resultsRequestSOAP.toString());
        } catch (MalformedURLException e) {
            e.printStackTrace();
            Log.e("APP", "MalformedURLException while sending\n" + e.getMessage());
            tv.setText("Malformedexception"+e);
        }
        catch(Exception e1)
        {
            e1开发者_如何学编程.printStackTrace();
            tv.setText("exception"+e1);

        }

        }

}

Thanks in advance.


Give permission to your webserivce folder in IIS or through IIS manager.


please check the weburl you are using.. its case sensitive... even though its working fine in a web browser, you should use the exact name in your code...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜