我的SOAP請求看起來像這樣ksoap2:郵政根據這一要求XML
<?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:Header>
<Authenticator xmlns="http://www.namespacename.com/services/">
<UserName>string</UserName>
<Password>string</Password>
</Authenticator>
</soap:Header>
<soap:Body>
<ListItems xmlns="http://www.namespacename.com/services/">
<strCode>string</strCode>
</ListItems>
</soap:Body>
</soap:Envelope>
我至少能夠成功使用ksoap2登錄,但我還沒有想出圍繞身體部位SOAP請求,任何想法如何使用參數strCode調用ListItems,如上所示。
這是當前的代碼。
String NAMESPACE = "http://www.namespace.com/services/";
String METHOD_NAME = "ListItems";
String SOAP_ACTION = "http://www.namespace.com/services/ListItems";
String URL = "https://www.kupong.se/Services/CouponAPI18.asmx";
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
// Enable the below property if consuming .Net service
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
envelope.headerOut = new Element[1];
envelope.headerOut[0] = buildAuthHeader();
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try
{
androidHttpTransport.call(SOAP_ACTION, envelope, null);
response = (SoapObject)envelope.getResponse();
}
catch(Exception e)
{
e.printStackTrace();
}
功能準備標頭值進行驗證
你可以請檢查並幫助解決我的問題嗎? http://stackoverflow.com/questions/34670782/android-call-soap-webservice-getting-message-of-server-was-unable-to-process-re?noredirect=1#comment57087199_34670782 – Android