SOAP请求似乎不起作用

时间:2015-04-28 13:48:57

标签: android soap

我试图通过Android在.NET网络服务上进行调用。 这些是我的变量:

private final String NAMESPACE = "http://www.greenparkvieste.it/";
private final String URL = "http://nursexpress.hellonetlab.it/service.asmx?op=UserLogin";
private final String SOAP_ACTION = "http://www.greenparkvieste.it/UserLogin";
private final String METHOD_NAME = "UserLogin";
private String risposta = "";

这是我在AsyncTask中的doInBackground中执行的方法:

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

request.addProperty("userName", "Ale");
request.addProperty("password", "ciaociao");

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.encodingStyle = "utf-8";
envelope.setOutputSoapObject(request);

//Create HTTP call object
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

try {
    //Invole web service
    androidHttpTransport.call(SOAP_ACTION, envelope);
    //Get the response
    SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
    //Assign it to fahren static variable
    risposta = response.toString();

} catch (Exception e) {
    e.printStackTrace();
}

当我启动应用程序时,它给了我这个错误: enter image description here

有什么问题?

1 个答案:

答案 0 :(得分:0)

我已在SoupUI工具(Web服务测试工具)中测试您的Web服务

SoupUI download from here

网络服务存在问题

在SoupUI工具中创建

时出现异常

加载[http://nursexpress.hellonetlab.it/service.asmx?op=UserLogin]时出错:org.apache.xmlbeans.XmlException:org.apache.xmlbeans.XmlException:错误:遇到意外字符:'v