Question
· Mar 23, 2017

Sending a SOAP header object with the request object?

Goal:

  • Take an HL7 message, parse some data from it
  • Call a web service to get an authorization key, comes back as a simple string
  • Create a request object with data from the HL7 message and send it to the Web Service

The main web method call requires that key I received as a Soap Header element. All I can pass to the SOAP Operation business class is the request object with the data I plucked from the HL7 payload. Nothing in that particular request message has anything in it that tells anything to send the header, too.

So what are my options to pass a message to the SOAP Operation that contains both the object that is the message body AND the SOAP header? Or do I not use the generated operation classes - I have to roll my own and use something like a pass thru operation and set some flags to get it to use the header?

Thoughts? Am I missing something totally simple?

Thanks!!

Discussion (2)0
Log in or sign up to continue

Hi Ryan,

The message that you pass to your SOAP-based business operation should (as you indicated in your 3rd bullet point), contain both the extracted HL7 data, and the authorization key you retrieved from the previous step.

I'm assuming your SOAP Business operation you are using in the last step has been automatically generated by the Studio wizards, so, you will have a Class Method for each web method of your SOAP service.

You need to edit the default generated versions of these methods the wizard gives you, in order to add your SOAP Header.

You can access   ..Adapter.%Client in this business operation to get access to the private instance of the web service client class, so, using

   Do ..Adapter.%Client.HeadersOut.SetAt(...)

You can set the headers for that particular message invocation.

Sincerely - Steve

Thank you! 

I just added another property to the request object class holding the HL7 data to contain an instance of the Header object populated with the auth value I received in the first step.

Then a quick edit to the operation class method I needed to call and adding the line:

Do ..Adapter.%Client.HeadersOut.SetAt(pRequest.AccessAuth,1)

Where the AccessAuth property is the Header object added to the initial request message worked like a champ!

I really wish there was an explanation like that in the docs! :-) My guess is - not so many custom web services require separate headers, and most of the application-level auth token strings are implemented in the body of the message (most times).