· Nov 21, 2017

Custom SOAP header


Hopefully someone has an answer on this, I cannot find any example or understand from the documentation how to acheive this.

I have a SOAP header subclass

Class AddressType Extends %SOAP.Header


Parameter MAXLEN;

Parameter NAMESPACE = "urn:registry:1";

Parameter XMLNAME = "urn:LogicalAddress";


In my  %SOAP.WebClient I use it like this:
set customHeader = ##class(AddressType).%New()
do ..HeadersOut.SetAt(customHeader,"AddressType")

Which results in
<urn:LogicalAddress xmlns="urn:registry:1" xmlns:hdr="urn:registry:1"></urn:LogicalAddress>

But how do I set a value within this tag? So I get the result to look like this
<urn:LogicalAddress xmlns="urn:registry:1" xmlns:hdr="urn:registry:1">Elmstreet 12</urn:LogicalAddress>

Best regards,


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

Hello Marc!

Thank you for your answer.

Yes I have tried using properties and it is working fine but it is not what I need.

Adding a property for example called Name will results in a XML like

<urn:LogicalAddress xmlns="urn:registry:1" xmlns:hdr="urn:registry:1"><Name>Elmstreet 12</Name></urn:LogicalAddress>

The SOAP.Adressing class will result in for example with you example with the MessageID, 

<SOAP-ENV:Header><wsa:MessageID>The value here</wsa:MessageID>  </SOAP-ENV:Header>

I need the tag to be  <urn:LogicalAddress xmlns="urn:registry:1" xmlns:hdr="urn:registry:1">The value here</urn:LogicalAddress>

So that is why I need a custom SOAP header.


Best regards,