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

  • 0
  • 1
  • 58
  • 6
  • 1

Answers

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?

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

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?

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.