我无法解决此错误:


  org.xmlpull.v1.XmlPullParserException:预期:START_TAG {http://www.w3.org/2001/12/soap-envelope}信封(位置:java.io.InputStreamReader@43e524c8中的START_TAG @ 1:6)


我有一个可访问.NET Web服务的Android应用。它传递一个int并接收一个int作为响应。我正在使用kso​​ap2。
我还向清单文件添加了权限,此外,我包括了所有jar文件。但是,我被卡住了,无法查看正在发送的SOAP请求。

我的代码是:

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);

        }

        }

}


提前致谢。

最佳答案

在IIS中或通过IIS管理器授予对Web服务文件夹的权限。

10-07 19:27
查看更多