soap-sample
soap-sample copied to clipboard
How to set header?
Hello,
I want to set WS-Addressing in header how I set it?
Add the following code in your ksoap envelope:-
soapEnvelope.headerOut = new Element[1]; soapEnvelope.headerOut[0] = buildAuthHeader();
Add this function that will create header elements private Element buildAuthHeader() { Element h = new Element().createElement(NAMESPACE, "AuthHeader"); Element username = new Element().createElement(NAMESPACE, "user"); username.addChild(Node.TEXT, USERNAME); h.addChild(Node.ELEMENT, username); Element pass = new Element().createElement(NAMESPACE, "pass"); pass.addChild(Node.TEXT, PASSWORD); h.addChild(Node.ELEMENT, pass);
return h;
}