我有一个肥皂网络服务。我使用Ksoap2从我的android应用程序连接到此Web服务。我在SoapObject
中设置了Web服务的参数,但是Web服务的结果表明未设置该属性。我也用邮递员测试了Web服务,但是工作正常。我不知道我的错误在哪里
这是我的网络服务电话:
private void startWS() {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("id_user","1");
request.addProperty("cod_bank","1");
request.addProperty("id_ghabz","2");
request.addProperty("mablagh","3");
request.addProperty("pass","4");
request.addProperty("url","5");
//Declare the version of the SOAP request
final SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
new Thread(new Runnable() {
@Override
public void run() {
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
//this is the actual part that will call the webservice
androidHttpTransport.call(SOAP_ACTION, envelope);
} catch (Exception e) {
e.printStackTrace();
}
// Get the SoapResult from the envelope body.
SoapObject result = (SoapObject)envelope.bodyIn;
}
}).start();
//Needed to make the internet call
}
我确定NAMESPACE,METHOD_NAME,SOAP_ACTION。 在Web服务网址中,存在以下描述:
Content-Type: text/xml; charset=utf-8
Content-Length: length
我应该设置这些值吗?如何? 谢谢你的帮助