soap-sample icon indicating copy to clipboard operation
soap-sample copied to clipboard

How to set header?

Open VinitYadav opened this issue 6 years ago • 1 comments

Hello,

I want to set WS-Addressing in header how I set it?

VinitYadav avatar Mar 27 '18 07:03 VinitYadav

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;

}

ankushpatel18 avatar Jun 19 '18 07:06 ankushpatel18