Written by

Enterprise Application Development Consultant at The Ohio State University Wexner Medical Center
MOD
Question Scott Roth · 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

Comments

Scott Roth  Apr 10, 2019 to Eduard Lebedyuk

I read the instructions on how to create a custom header, however how do I specify the sub element of Epic-Client-ID, if we aren't allowed to use "-" Parameter, Property names?

0
Vitaliy Serdtsev  Apr 10, 2019 to Scott Roth

As of release 2012.2, member names can be delimited. To create a delimited member name, use double quotes for the first and last characters of the name. Then the name can include characters that are otherwise not permitted.

See Rules for Class and Class Member Names

0
Scott Roth  Apr 10, 2019 to Vitaliy Serdtsev

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")
}

0
Eduard Lebedyuk  Apr 10, 2019 to Scott Roth

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.

0
Scott Roth  Apr 10, 2019 to Eduard Lebedyuk

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?

0
Eduard Lebedyuk  Apr 10, 2019 to Scott Roth

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 mean you create an object from the class using %New method.

What is HeadersOut and where do I set it?

HeadersOut is a property of your WebClient object.

0