ksoap2 org.xmlpull.v1.xmlpullparserexception预计START_TAG错误 [英] ksoap2 org.xmlpull.v1.xmlpullparserexception expected start_tag error

查看:209
本文介绍了ksoap2 org.xmlpull.v1.xmlpullparserexception预计START_TAG错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的code,这是我写来验证用户登录凭据。用书面的Web服务.NET

Below is my code, which I have written to validate user log in credentials. The web service written using .net

private static final String SOAP_ACTION = "http://tempuri.org/getCredentials";
private static final String OPERATION_NAME = "getCredentials";
private static final String WSDL_TARGET_NAMESPACE = "http://tempuri.org/";
private static final String SOAP_ADDRESS = "http://myStaticIP:portNo/WebSiteName/CommunicationInterface.asmx"; 

SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE, OPERATION_NAME);
request.addProperty("username",Username);
request.addProperty("password", Password);

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE httptransport = new HttpTransportSE(SOAP_ADDRESS);

try
{
    httptransport.call(SOAP_ACTION, envelope);
SoapPrimitive result = (SoapPrimitive) envelope.getResponse();
String value = result.toString();
value_LoginWS = value;
val = value;
login_status = Boolean.valueOf(result.toString());

Log.v("CS return value: -", result.toString());
return value;
}
catch (Exception e) 
{
     Log.v("Exception Soap" , e.toString());
}



在行httptransport.call(SOAP_ACTION,信封) 我得到的除了



In line "httptransport.call(SOAP_ACTION, envelope)" I get the exception saying

"org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <html>
@1:7 in java.io.InputStreamReader@41afb3f0)" <br/><br/>

我不知道错误是什么。这片code是完全就职于模拟器(改变 staticIP到10.0.2.2:portNo )。

I have no idea what the error is about. This piece of code is worked perfectly for emulator( changing the staticIP to 10.0.2.2:portNo).

请帮我解决这个问题。

感谢您。

推荐答案

在回答这个问题,因为我弄明白的是,在SOAP_ADDRESS字符串,删除/ WebSiteName的一部分,它工作正常。我曾在我的Andr​​oid设备测试这一点。完美。

The answer to this question as I figure it out is, in the SOAP_ADDRESS string, remove the /WebSiteName part and it works fine. I have tested this in my android device. Works perfectly.

修正后的字符串应该是如下:

The corrected String should be as follow:

private static final String SOAP_ADDRESS = "http://myStaticIP:portNo/CommunicationInterface.asmx";

其中CommunicationInterface.asmx是web服务的名称。 其他静态变量保持不变。

where CommunicationInterface.asmx is the web service name. other static variables remain same.

请注意:这是用来当该网站托管在IIS中。

Note: This is used when the web site is hosted in IIS.

这篇关于ksoap2 org.xmlpull.v1.xmlpullparserexception预计START_TAG错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆