我必须做出以下肥皂请求,但我们不能成功,我尝试了几种方式并失败,我总是得到一个空白字段作为回应。如何在Android中创建一个具有多个属性的ksoap2请求?
请求应该是这样的:
POST /service.asmx HTTP/1.1
Host: host
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "SOAPAction"
<?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>
<GetQuickParkEvents xmlns="NAMESPACE">
<User>
<ID>int</ID>
<Name>string</Name>
<UserName>string</UserName>
<Password>string</Password>
</User>
<Filter>
<TimeSpan>
<Since>dateTime</Since>
<To>dateTime</To>
</TimeSpan>
<Reg>string</Reg>
<Nalog>string</Nalog>
<Status>string</Status>
<Value>string</Value>
</Filter>
</GetQuickParkEvents>
</soap:Body>
</soap:Envelope>
我有这样的代码现在:
public static Object vrati_ds(String id, String name, String username, String password, String since, String to, String reg, String korisnik, String nalog, String nameString status, String value){
try{
SoapObject _client = new SoapObject(Konstante.NAMESPACE1, Konstante.METHOD_NAME);
_client.addProperty("ID", id);
_client.addProperty("Name", name);
_client.addProperty("UserName", username);
_client.addProperty("Password", password);
_client.addProperty("Since", since);
_client.addProperty("To", to);
_client.addProperty("Reg", reg);
_client.addProperty("Korisnik_app", korisnik);
_client.addProperty("Nalog", nalog);
_client.addProperty("Status", status);
_client.addProperty("Value", value);
SoapSerializationEnvelope _envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
_envelope.dotNet = true;
_envelope.setOutputSoapObject(_client);
HttpTransportSE _ht = new HttpTransportSE(Konstante.URL1);
_ht.call(Konstante.SOAP_ACTION, _envelope);
return _envelope.getResponse();
} catch(Exception e) {
return null;
}
}
我感谢你在前进,如果有人能帮助我!
我补充说,我还没有发现至今 – nexusone
链接代码...请提供新的有效链接 感谢 – slyzer