* note the parameter order - the ReceivedAttachments30 parameter must * appear before the SentAttachments30 parameter * and the collection parameters must be the last set of parameters. DEFINE CLASS Attachment AS SESSION OLEPUBLIC PROCEDURE ProcessCollection (; toReceivedCollection AS MSSOAP.ReceivedAttachments30 @,; toCollectionReturned AS MSSOAP.SentAttachments30 @) AS BOOLEAN LOCAL; lnLoop AS INTEGER,; lcFileName AS STRING,; loSentAttachmentsTemp AS MSSOAP.SentAttachments30,; loReceivedAttach AS MSSOAP.IReceivedAttachment,; loAttachTemp AS MSSOAP.FileAttachment30 loSentAttachmentsTemp = CREATEOBJECT('MSSOAP.SentAttachments30') * ' save attachment(s) received' lnLoop = 1 FOR EACH loReceivedAttach IN toReceivedCollection lcFileName = "C:\Inetpub\webpub\AttachSample\AttachmentSample2\Server\RcvdFromClient"+TRANSFORM(lnLoop,'@RL 9999')+".txt" * FileName = "RcvdFromClient" & CStr(i) & ".txt" * FileName = fso.BuildPath(APP.PATH, FileName) loReceivedAttach.SaveToFile(lcFileName,.T.) lnLoop = lnLoop + 1 NEXT * ' now return attachment(s), as unreferenced collection to the client' * ' 2 attachments are returned in this example' * ' Adding attachment 1 to the collection' loAttachTemp = CREATEOBJECT("MSSOAP.FileAttachment30") lcFileName = "C:\Inetpub\webpub\AttachSample\AttachmentSample2\Client\Attachment1FromSvr.txt" loAttachTemp.FileName = lcFileName loSentAttachmentsTemp.ADD(loAttachTemp) * ' Adding attachment 2 to the collection' loAttachTemp = CREATEOBJECT("MSSOAP.FileAttachment30") lcFileName = "C:\Inetpub\webpub\AttachSample\AttachmentSample2\Client\Attachment2FromSvr.txt" loAttachTemp.FileName = lcFileName loSentAttachmentsTemp.ADD(loAttachTemp) * ' now return the collection' toCollectionReturned = loSentAttachmentsTemp ENDPROC ENDDEFINE &&Attachmentand as client
* SOAP Toolkit 3.0 - Advanced Topics LOCAL; lcwsdl AS CHARACTER,; lcwsml AS CHARACTER,; lcFileName AS CHARACTER,; lnLoop AS INTEGER,; llres AS BOOLEAN LOCAL; loSoapClient AS MSSOAP.SoapClient30,; loFileAttach AS MSSOAP.FileAttachment30,; loSentCollection AS MSSOAP.SentAttachments30,; loStringAttach AS MSSOAP.StringAttachment30,; loReceivedCollection AS MSSOAP.ReceivedAttachments30,; loReceivedAttach AS MSSOAP.IReceivedAttachment lcwsdl = "AttachmentSample2.WSDL" lcwsml = "AttachmentSample2Client.WSML" loSentCollection = CREATEOBJECT("MSSOAP.SentAttachments30") loSoapClient = CREATEOBJECT("MSSOAP.SoapClient30") loSoapClient.MSSoapInit('http://MyServer/WebPub/Soap3DocSamples/AttachmentSample2/Server/AttachmentSample2.WSDL', "AttachmentSample2", "AttachmentSoapPort", "") *' client sending two attachment in the collection *' Adding attachment 1 (a file attachment)to the collection loFileAttach = CREATEOBJECT("MSSOAP.FileAttachment30") lcFileName = "e:\se\foxpro\web\Attachment1FromClient.txt" *lcFileName = fso.BuildPath(APP.PATH, FileName) loFileAttach.FileName = lcFileName loSentCollection.ADD(loFileAttach) *' Adding attachment 2 (a string attachment) to the collection' loStringAttach = CREATEOBJECT("MSSOAP.StringAttachment30") loStringAttach.STRING = "<Attachment2FromClient>Test</Attachment2FromClient>" *' let us set some properties' loStringAttach.Property("DimeTNF") = "media-type" loStringAttach.Property("DimeType") = "text/xml, charset=utf-8" loSentCollection.ADD(loStringAttach) loReceivedCollection = CREATEOBJECT("MSSOAP.ReceivedAttachments30") *'now call the operation and passed in the collection as *' SentCollection parameter. All attachments are send unreferenced llres = loSoapClient.ProcessCollection(loSentCollection,loReceivedCollection) *' now save the attachment received from the server to files FOR lnLoop = 0 TO loReceivedCollection.COUNT - 1 lcFileName = "e:\se\foxpro\web\RcvdFromSvr"+TRANSFORM(lnLoop,'@RL 9999')+".txt" loFileAttach.FileName = loFileName loReceivedAttachment = loReceivedCollection.ITEM(lnLoop) loReceivedAttachment.SaveToFile(lcFileName, True) NEXTMy Problem is that clients
loReceivedCollection = CREATEOBJECT("MSSOAP.ReceivedAttachments30")comes up with OLE Error 0x80040111 "Class factory can't find class" (or the like, it's german text).