When WebAddMultiPart or WebAddMultiPartFromeFile is called, the passed data is stored in lists. When WebPostMultiPart is called, these lists are then merged with a unique boundary and transferred to the server using WebUrlPostBin.
WebAPI.bdh
WebPostMultiPart ( in sUrl : string, in sContentType : string );
none
Parameter | Description |
---|---|
sUrl | Complete URL to the file on the server. |
sContentType | The multipart/related Content-Type request header, optional parameters are type, start and start-info. The boundary delimiter is created automatically. |
dcltrans transaction TMultiPartRelated var sMultiPartHeader: string; sMultiPartData: string; begin // usage: // // WebAddMultiPart(bodyheader, bodydata) // WebAddMultiPartFromFile(bodyheader, filename) // WebPostMultiPart("https://...", "multipart/related; type=\"text/xml\""); // // where bodyheader is e.g.: // // Content-Type: text/xml; charset=UTF-8 // Content-Transfer-Encoding: 8bit // Content-ID: <rootpart@soapui.org> // // and bodydata is // o) in case of WebAddMultiPart, e.g.: // // <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:kun="http://services.dst.baintern.de/wsdl/basis/dokumentenmgmt/KundenBescheideAblageServiceMessages_V_1" xmlns:bes="http://services.dst.baintern.de/types/basis/dokumentenmgmt/BescheidDokumenteEinstellen_StatusPerDateitransferDTOType_v_1" xmlns:all="http://services.dst.baintern.de/types/basis/dokumentenmgmt/AllgemeinDTOType_v_1"> // ... // </soapenv:Envelope> // // o) in case of WebAddMultiPartFromFile the filename of the document to upload, e.g. "1_Bescheid.zip" //sample 1, doing a 4 part request: sMultiPartHeader := "Content-Type: text/plain\r\n"; sMultiPartData := "This is my first text\r\n"; WebAddMultiPart(sMultiPartHeader, sMultiPartData); sMultiPartHeader := "Content-Type: application/octet-stream\r\n"; sMultiPartData := "\h0102030405060708090A0B0C0D0E0F0D0A"; WebAddMultiPart(sMultiPartHeader, sMultiPartData); sMultiPartHeader := "Content-Type: text/plain\r\n"; sMultiPartData := "This is my second text\r\n"; WebAddMultiPart(sMultiPartHeader, sMultiPartData); sMultiPartHeader := "Content-Type: text/xml\r\n"; sMultiPartData := "<xml>This is xml</xml>\r\n"; WebAddMultiPart(sMultiPartHeader, sMultiPartData); sMultiPartHeader := "Content-Type: text/plain\r\nContent-Disposition: attachment; name=\"simpletext.txt\"\r\n"; sMultiPartData := "simpletext.txt"; WebAddMultiPartFromFile(sMultiPartHeader, sMultiPartData); WebPostMultiPart("http://demo.borland.com/testsite/rawdata2html.asp", "multipart/related"); //sample 2: //throws an error as no WebAddMultiPart was specified WebPostMultiPart("https://demo.borland.com/testsite/svars.asp", "x"); //sample 3: // throws an error as the file is not existent (in Silk Performer's search scope) sMultiPartHeader:= "Content-Type: application/zip\r\n" "Content-Disposition: attachment; name=\"test.zip\"\r\n"; WebAddMultiPartFromFile(sMultiPartHeader, "test.zip"); WebPostMultiPart("http://demo.borland.com/testsite/rawdata2html.asp", "multipart/related"); end TMultiPartRelated;