Question
· Apr 9, 2019

SOAP Request Header

I have a wdsl soap request that now requires a header. Where do I modify the header to allow this new value to be sent?

   <soapenv:Header>
    <Headers xmlns="urn:epic-com.2013.Interconnect.Headers"> 
      <Epic-Client-ID>12349fe5-2ff8-4b79-b723-e69efbabcdef</Epic-Client-ID>
    </Headers>
   </soapenv:Header>

Thanks

Scott

Discussion (7)1
Log in or sign up to continue

When I add my method to my operation I am getting an error on ..HeadersOut . I am running 2015.2.2

Method AddCustomHeaderElement(mustUnderstand = 0)
{
set h=##class(osuwmc.Epic.CustomHeader).%New()
set h."Epic-Client-ID" = "Test"
if mustUnderstand{set h.mustUnderstand = 1}
Do ..HeadersOut.SetAt(h,"osuwmc.Epic.CustomHeader")
}

Your error looks like it's cause because there's no HeaderOut property defined in current class.

Anyway, you need to create a custom class which would be your header:

Class custom.Header Extends %SOAP.Header
{

Parameter XMLFORMAT = "literal";

Parameter XMLIGNORENULL = "RUNTIME";

Parameter NAMESPACE = "urn:epic-com.2013.Interconnect.Headers";

/// The XMLPREFIX parameter controls the prefix to be used for the XML namespace that
/// is given by the NAMESPACE parameter.
///Parameter XMLPREFIX As STRING = "";

Parameter XMLTYPE = "Epic-Client-ID";

Property Value As %String(XMLPROJECTION = "CONTENT", MAXLEN = 36) [ InitialExpression = "12349fe5-2ff8-4b79-b723-e69efbabcdef" ];

}

After that you need to create an instance of this class and add it to HeaderOut property of your WS client.

What do you mean by "After that you need to create an instance of this class and add it to HeaderOut property of your WS client."

I created the custom header as suggested above

Class osuwmc.Epic.CustomHeader Extends %SOAP.Header
{

Parameter XMLFORMAT = "literal";

Parameter XMLIGNORENULL = "RUNTIME";

Parameter NAMESPACE = "urn:epic-com.2013.Interconnect.Headers";

Parameter XMLTYPE = "Epic-Client-ID";

Property Value As %String(MAXLEN = 36, XMLPROJECTION = "CONTENT") [ InitialExpression = "12349fe5-2ff8-4b79-b723-e69efbabcdef" ];

}
 

then in my operation I did the following...

Method AddCustomHeaderElement(mustUnderstand = 0)
{
set h=##class(osuwmc.Epic.CustomHeader).%New()
if mustUnderstand{set h.mustUnderstand = 1}
Do ..HeadersOut.SetAt(h,"osuwmc.Epic.CustomHeader")
}
 

but still got an error on HeadersOut.

What is HeadersOut and where do I set it?