Reputation: 438
I am using ksoap2 for android project. But server code (which cannot be changed) is old and needs send some properties inside a header on HTTP header.
Server use soap so I decided to use ksoap2 for android but I couldn't find any example how to set http header of ksoap2 request(not inside soap envelope but inside of httpheader).
Is it possible?
If possible can anyone show me a example?
Upvotes: 1
Views: 1343
Reputation: 6165
HTTP headers could be modified inside org.ksoap2.transport.call(String, SoapEnvelope, List, File) method.
EDIT
You can pass extra headers directly when calling HttpTransportSE.call()
example:
.
.
.
List<HeaderProperty> headers;
headers.add(new HeaderProperty("Content-Type", "utf8"));
headers.add(new HeaderProperty("Accept", "text/html"));
HttpTransportSE httpTransport = new HttpTransportSE(_soapAddress);
httpTransport.call(soapAction, envelope, headers);
.
.
.
Upvotes: 1
Reputation: 1812
You can retrieve the connection object and add the headers there.
HttpTransportSE transport = new HttpTransportSE(url,timeout);
ServiceConnection conn = transport.getConnection();
conn.setRequestProperty("Accept-Encoding", "utf-8");
//and others...
Upvotes: 0