1

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?

smartsanja
  • 4,413
  • 9
  • 58
  • 106
  • :- have you got answer? please see this , i face same problem http://stackoverflow.com/questions/37882338/eway-recurring-payment-in-android?noredirect=1#comment63236995_37882338 – Mayank Sugandhi Jun 20 '16 at 12:33
  • Please check the below URL [here](http://stackoverflow.com/questions/5177939/basic-http-authentication-using-ksoap-for-android) – Waleed A. Elgalil Mar 13 '17 at 13:25

0 Answers0