【发布时间】:2015-07-02 06:36:25
【问题描述】:
我正在尝试在我的应用程序中使用soap api进行登录,但出现上述错误,谁能告诉我哪里出错了,这是我第一次使用soap api。 这是我打肥皂的代码:-
Vector<Object> args = new Vector<Object>();
Hashtable<String, Object> hashtable = new Hashtable<String, Object>();
hashtable.put("Email", "mss.siddhart28@gmail.com");
hashtable.put("Password", "siddharth");
args.add(hashtable);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.xsd = SoapSerializationEnvelope.XSD;
envelope.enc = SoapSerializationEnvelope.ENC;
(new MarshalHashtable()).register(envelope);
HttpTransportSE androidHttpTransport = new HttpTransportSE(
"http://tempuri.org/", 15000);
androidHttpTransport.debug = true;
String result = "";
try {
SoapObject request = new SoapObject("http://tempuri.org", "call");
request.addProperty("resourcePath", "User_Login");
request.addProperty("args", args);
envelope.setOutputSoapObject(request);
androidHttpTransport.call("call", envelope);
envelope.setOutputSoapObject(request);
result = envelope.getResponse().toString();
Toast.makeText(MainActivity.this, "envelope is" + envelope, Toast.LENGTH_LONG).show();
System.out.println("result signup: " + result);
} catch (EOFException e) {
e.printStackTrace();
return "restart";
}
这是我的 wsdl :-
POST /w4w/w4wservice.asmx HTTP/1.1
Host: 64.31.2.58
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/User_Login"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<User_Login xmlns="http://tempuri.org/">
<Email>string</Email>
<Password>string</Password>
</User_Login>
</soap:Body>
</soap:Envelope>
任何帮助将不胜感激。
谢谢
【问题讨论】:
标签: android web-services soap wsdl