Reputation: 11317
I created a simple header class:
Class Sample.Headers Extends %SOAP.Header
{
Parameter NAMESPACE = "http://tempuri.org";
Property UserName As %String;
}
In the web service I made sure to set the correct namespace in the SOAPHEADERS
parameter:
Parameter SOAPHEADERS = "UserName:Sample.Headers";
I send the following XML using SoapUI:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org">
<soapenv:Header>
<tem:UserName>This is the header</tem:UserName>
</soapenv:Header>
<soapenv:Body>
<tem:Test>
<!--Optional:-->
<tem:argAge>10</tem:argAge>
</tem:Test>
</soapenv:Body>
</soapenv:Envelope>
I get the following error:
ERROR #6254: Tag expected, XML input, This is the header, is not in proper format as child of UserName (ending at line 3 character 18).
What is the correct format for the XML so that UserName is set correctly?
Upvotes: 1
Views: 639
Reputation: 11317
Just needed to change:
Property UserName As %String;
to
Property UserName As %String(XMLPROJECTION = "CONTENT", MAXLEN = 50);
Upvotes: 1
Reputation: 147
Take a peek at the example here: http://www.w3schools.com/soap/soap_header.asp
Note: All immediate child elements of the Header element must be namespace-qualified.
It seems like the format of the XML is a bit different in this example, nesting a namespace as an attribute of the Header property "Trans" (in their example). It might be a stretch, but I do see that your request doesn't have the namespace explicitly set like this.
Upvotes: 0