Transporting binary data (such as images, artibrary files, etc), via SOAP can be inefficient, as the data has be base64 encodeded and decoded, and is contained within the SOAP message itself, which can increase the XML parsing overhead. To alleviate this, you can transport this data as attachments, so that it exists outside of the SOAP message, and is not base64 encoded & decoded.
PocketSOAP supports attachments using either SOAP with Attachments or DIME
The SOAP with Attachments suport has been sucessfully tested against
The DIME support has been sucessfully tested against
Making request's that include attachmentsThe Attachments Manager object is the key point to making requests that include attachments, you use this object, to create attachments in the request, build and send the request complete with attachments, and to parse attachments contained in the response. Here's a walk through of using the attachments manager to make a call with attachments.
You need to indicate if you want to do DIME or MIME based attachments before you add any attachments.set mgr = CreateObject("pocketSOAP.Attachments") mgr.Format = formatDimeThis creates a new attachment in the request collection, and returns it.set att = mgr.Request.Create ("c:\image.gif", tnfMediaType, "image/gif")Typically you assign the URI of the attachment to the href attribute of a parameter in the SOAP messageset n = e.parameters.create ("attachment", empty ) n.href = att.UriCreate and configure the HTTP transport object as normal, then set the transport property on the attachment objects to the transport objectset t = CreateObject("pocketSOAP.HTTPTransport") t.SetProxy "localhost", 7070 t.Soapaction = "http://xsd.prototypes.4s4c.com/dime/" set mgr.Transport = tNow we send through the attachments manager, rather than direct to the transport, the attachments manager will package everything up in the required format and send it to the underlying transport object created earlier.mgr.Send "http://soap.4s4c.com/dime/sf.soap", e.SerializeAgain, for the parsing end, the attachments manager is shimmed between the parser and the transport, so you call parse specifying the attachments manager.e.parse mgrFinally, you use the href property on the node to get the URI of the response attachment, and then look for it in the response attachments collectionhref = e.parameters.Item(0).href set theAttachment = mgr.response.find(href) if theAttachment.Location = attInMemory then theAttachment.Save "c:\att.gif" end if msgbox "attachment saved as " & theAttachment.Body
Copyright © Simon Fell, 2002-2004. All rights reserved.