How to add a soap header

I have a flow service. I hope my partner invoke it by Web Service. I generate a WSDL according the service. but how can I add a soap header fro the web service, and How do I extract the data in the header in my flow service when my partner invoke it.

Toby,

If your requirements call for supporting soap headers you will need to use the document/literal style that webMethods IS calls SOAP-MSG.

Search the forums for several discussions on document/literal soap messages.

In a nutshell, you have to create a wrapper service that processes the the header and body elements of the incoming soap request before invoking the Flow or java service you wish to expose as a web service. The wrapper service also constructs the soap response message to be returned to the caller.

The wrapper service uses pub.soap.utils:getHeader or pub.soap.utils:getHeaderEntries to extract a node representation of one or more soap header elements respectively. You then use pub.xml:queryXMLNode or pub.xml:xmlNodeToDocument to convert the node into a document.

These services are covered in the built-in services guide found in your \Developer\docs folder. The Soap Developer’s Guide and Web Services Developer’s Guide are also helpful and found in the \Developer\docs\guildes folder.

Mark

Mark,

Thank you for your help, Your answer is very detailed and clear. But I am a rookie in webMethods. I have no idea for how to create a wrapper service. Can you give me some help?

Toby

Toby,

Let’s say your partner wants to invoke an addInts service.For that you have to create a flow service whose inputs are soapRequestdata and soapResponsedata, and output is soapResponsedata.all are objects.
In this wrapper service, first you have to get the header(if any) and the body of the soap message using pub.soap.utils:getHeader and pub.soap.utils:getBody.after that you invoke the addInts service and then construct a soapResponsedata object using pub.soap.utils:createSoapdata, pub.soap.utils:addHeader and pub.soap.utils:addBody services.and then return this soapResponseData to the caller of this service.
hope this helps.

ramesh.

Please refer to the section titled “How to Create a Target Service for the Default Processor” on page 36 of the SOAP Developer’s Guide Version 6.1. This PDF is found in the \Developer\doc\guides folder. This section explains what a wrapper or “target” service must do to extract header and body elements, invoke the service and prepare the response.

See also these two posts on my blog.

Mark