ISoapAttachments::Find Method

HRESULT Find([in] BSTR uri, [out, retval] ISoapAttachment ** attachment);

This searches the attachments collection for a specific attachment, based on its Identifier. This is used to find attachments that are referenced from the SOAP message.

 

Parameters

uri
BSTR, [in]: The Uri (for DIME) or Content-ID (for MIME) of the attachment to find.
attachment
ISoapAttachment **, [out, retval]: The found attachment

 

Return Values

The found attachment, or the E_INVALIDARG error, if no attachment can be found with that Id.

 

Sample Code

' create and initialize the SOAP envelope
set e = CreateObject("pocketSOAP.Envelope.2")
e.setMethod "doImage", "urn:AttachmentService"

' create the attachments object, and switch to MIME formatted attachments
set a = CreateObject("pocketSOAP.Attachments")
a.format = formatMime

' create the parameter that has the attachment attached to it
set n = e.parameters.create("gif", empty)

' create the attachment, and create a reference between the attachment and the parameter
n.href = a.Request.Create ("c:\picture.gif", tnfMediaType, "image/gif").Uri

' set the required SOAPAction, then give the transport object, to the attachments object
t.Soapaction = "urn:AttachmentService/doImage"
set a.Transport = t 

' now we call send/receive/parse through the attachments object, so that it can 
' inject/extract the attachments before sending them through the transport
a.Send "http://interop.xmlbus.com:7002/xmlbus/container/AttachmentApp/AttachmentAppService/AttachmentAppPort/", e.Serialize

' parse the results
e.parse a

' find the response attachment
set theAttachment = a.response.find(e.parameters.item(0).href)
if theAttachment.Located == attInMemory then
	theAttachment.Save "c:\xmlbus.gif"
end if
msgbox "the attachment is saved to " & theAttachment.Body

 

See Also

The ISoapAttachments Interface | 

 

 

Copyright

Copyright © Simon Fell, 2000-2004. All rights reserved.