Android:ksoap2 org.xmlpull.v1.XmlPullParserException:意外类型(位置:END_DOCUMENT null @ 1:1 in java.io.InputStreamReader@41575240)

时间:2013-11-01 20:25:24

标签: android

我发现了很多这种例外情况,但没有一个可以帮助我。

我在.NET中有一个简单的Web服务,它返回一个没有任何参数的字符串。 我已经尝试过另一个.NET应用程序,它运行正常。

我尝试使用kso​​ap2拨打电话但没有成功。 这是我的类,它调用Web服务:

private final String NAMESPACE = "http://tempuri.org/";
private final String URL = "http://192.168.0.106:80/WebService1.asmx?wsdl";
private final String SOAP_ACTION = "http://tempuri.org/HelloWorld";
private final String METHOD_NAME = "HelloWorld";

public String Call()
{
    SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME);

          MarshalBase64 mbase = new MarshalBase64();
  SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER10);
  envelope.bodyOut = request;
  envelope.encodingStyle = SoapSerializationEnvelope.ENC;
  envelope.dotNet = true;
  envelope.implicitTypes = false;
  envelope.setOutputSoapObject(request);
  HttpTransportSE httpTransport = new HttpTransportSE(URL);
  mbase.register(envelope);
  Object response=null;

  try
  {
  httpTransport.debug=true;
  httpTransport.call(SOAP_ACTION, envelope);


  response = envelope.getResponse();
  }

httpTransport.call(SOAP_ACTION, envelope);

引发异常

任何建议我做错了什么?

1 个答案:

答案 0 :(得分:-1)

尝试:

private final String NAMESPACE = "http://www.tempuri.org/";
private final String SOAP_ACTION = "http://www.tempuri.org/HelloWorld";

而不是:

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