Home > Lotus/Domino > Lotus/Domino 8.5 WebService Consumer manipulating SOAP Header

Lotus/Domino 8.5 WebService Consumer manipulating SOAP Header

There is pretty often a need to incorporate SOAP Header in the message sent by Web Service consumer. While Domino 8.5 is using Axis Java library under the hood of it’s generated Java Web Service Consumers,it blocks standard setHeader API in the client proxy. We had to look through all generated java files to find the solution. Below is example of sending SOAP Header from Lotus Web Consumer agent.

In the generated by Domino class for endpoint – XXXEndpointStub.java locate the code responsible for making the call, similar to the following:

lotus.domino.websvc.client.Call _call = createCall("submitRequest");
java.lang.Object _resp = _call.invoke(new java.lang.Object[] {parameters});

Modify it to create and addHeader before call invocation.For example to create following SoapHeader:

<soap:Envelope …>

<soap:Header>
<au:auth xmlns:au=”http://www.example.com“>
  <au:username>john</au:username>
</au.auth>
</soap:Header>

<soap:Body>
….
</soap:Body>
</soap:Envelope>

Code will be:

lotus.domino.websvc.client.Call _call = createCall("submitRequest");

try {
// Create soap header elements
SOAPHeaderElement header = new SOAPHeaderElement(“http://www.example.com&#8221;, “auth”);
SOAPElement elemSystem = header.addChildElement(“username”, “au”, “http://www.example.com&#8221;);
elemSystem.addTextNode(“john”);

// add header to payload
_call.addHeader(header);
} catch (Exception e) {
throw new ….
}

java.lang.Object _resp = _call.invoke(new java.lang.Object[] {parameters});

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: