我正在努力使用KSOAP2将头字段设置为SOAP信封。我正在关注本教程http://code.tutsplus.com/tutorials/consuming-web-services-with-ksoap--mobile-21242
这就是肥皂信封的样子
<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>
这是SOAPCaller类的样子
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;
}
如何将肥皂标题添加到肥皂信封?