dim e, h set e = CreateObject("pocketSOAP.Envelope.2") e.SetMethod "DoStuff", "http://soap.example.org/" set h = e.Headers.Create ("Authentication", empty, "http://soap.example.org/authentication/2001/01/") h.Nodes.Create "Username", "user@example.org" h.Nodes.Create "MD5", "9b3e64e326537b4e8c0ff19e953f9673" wscript.echo e.serializeThis generates the following SOAP message
<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:E='http://schemas.xmlsoap.org/soap/encoding/' xmlns:a='http://soap.example.org/authentication/2001/01/' xmlns:b='http://www.w3.org/2001/XMLSchema-instance' xmlns:c='http://www.w3.org/2001/XMLSchema' xmlns:d='http://soap.example.org/'> <S:Header> <a:Authentication> <Username b:type='c:string'>user@example.org</Username> <MD5 b:type='c:string'>9b3e64e326537b4e8c0ff19e953f9673</MD5> </a:Authentication> </S:Header> <S:Body><d:DoStuff></d:DoStuff> </S:Body></S:Envelope>You can set the actor and mustUnderstand attributes through the actor and mustUnderstand properties on the node, e.g.
dim e, h set e = CreateObject("pocketSOAP.Envelope.2") e.SetMethod "DoStuff", "http://soap.example.org/" set h = e.Headers.Create ("Authentication", empty, "http://soap.example.org/authentication/2001/01/") h.mustUnderstand = true h.actor = "http://soap.example/org/authentication/" h.Nodes.Create "Username", "user@example.org" h.Nodes.Create "MD5", "9b3e64e326537b4e8c0ff19e953f9673" wscript.echo e.serializeThis generates the following SOAP message
<S:Envelope S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' xmlns:E='http://schemas.xmlsoap.org/soap/encoding/' xmlns:a='http://soap.example.org/authentication/2001/01/' xmlns:b='http://www.w3.org/2001/XMLSchema-instance' xmlns:c='http://www.w3.org/2001/XMLSchema' xmlns:d='http://soap.example.org/'> <S:Header> <a:Authentication S:mustUnderstand='1' S:actor='http://soap.example/org/authentication/'> <Username b:type='c:string'>user@example.org</Username> <MD5 b:type='c:string'>9b3e64e326537b4e8c0ff19e953f9673</MD5> </a:Authentication> </S:Header> <S:Body><d:DoStuff></d:DoStuff> </S:Body></S:Envelope>All the standard serialization process applies to headers, so you can write custom serializer for handling header parts.
Copyright © Simon Fell, 2000-2004. All rights reserved.