问题
I am struggling to set header fields to SOAP envelop with KSOAP2. I am following this tutorial http://code.tutsplus.com/tutorials/consuming-web-services-with-ksoap--mobile-21242
This is how the soap envelop looks like
<soap:Header>
<Authentication xmlns="http://tempuri.org/">
<User>string</User>
<Password>string</Password>
</Authentication>
</soap:Header>
<soap:Body>
< NewRegistration xmlns="http://tempuri.org/">
<Title>string</Title>
<FirstName>string</FirstName>
<LastName>string</LastName>
</NewRegistration>
</soap:Body>
</soap:Envelope>
This is how the SOAPCaller class looks like
public String getCelsiusConversion(String fValue) {
String data = null;
String methodname = "NewRegistration";
SoapObject request = new SoapObject(NAMESPACE, methodname);
request.addProperty("Title", "");
request.addProperty("FirstName", "");
request.addProperty("LastName", "");
SoapSerializationEnvelope envelope = getSoapSerializationEnvelope(request);
HttpTransportSE ht = getHttpTransportSE();
try {
ht.call(SOAP_ACTION + methodname, envelope);
testHttpResponse(ht);
SoapPrimitive resultsString = (SoapPrimitive)envelope.getResponse();
data = resultsString.toString();
} catch (SocketTimeoutException t) {
t.printStackTrace();
} catch (IOException i) {
i.printStackTrace();
} catch (Exception q) {
q.printStackTrace();
}
return data;
}
How do I add the soap Header to soap envelop?
来源:https://stackoverflow.com/questions/29231074/how-to-set-soap-header-using-ksoap-on-android