Search the Community
Showing results for tags 'webservices'.
-
Hello First i want to say that most of my problems i can solve while scripting by looking at the forum or in the help file but im stuck on this specific problem. I have been writing scripts to consume Web services and this works fine when its just plain XML responses. I work on a project now where i need to consume a SOAP response with an Attachment. I can make the plain SOAP call and get a response as well but i dont know how to handle the multipart and binary data. I have tried ADODB.Stream to write the data to a file but this just writes everything. I would be very grateful if someone could point me into the right direction. Please find below the Request and the Response i get at the momen $objHTTP = ObjCreate("Microsoft.XMLHTTP") $objReturn = ObjCreate("Msxml2.DOMDocument.3.0") $oDATA=ObjCreate("ADODB.Stream") $strEnvelope = '<?xml version="1.0" encoding="UTF-8"?>' _ '<soapenv:Envelope' _ 'xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"' _ 'xmlns:xsd="http://www.w3.org/2001/XMLSchema"' _ 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' _ '<soapenv:Body>' _ '<ns1:getStorageAccessTicket' _ 'soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"' _ 'xmlns:ns1="NBRStorageService">' _ '<siteId xsi:type="xsd:long">123456</siteId>' _ '<username xsi:type="xsd:string">USERNAME</username>' _ '<password xsi:type="xsd:string">PASSWORD</password>' _ '</ns1:getStorageAccessTicket>' _ '</soapenv:Body>' '</soapenv:Envelope>' _ ; Set up to post to the server $objHTTP.open ("post", "API end point" , False) ; Set a standard SOAP/ XML header for the content-type $objHTTP.setRequestHeader ("Content-Type", "application/xml") ; Set a header for the method to be called $objHTTP.setRequestHeader ("SOAPAction", 'getStorageAccessTicket') ConsoleWrite("Content of the Soap envelope :" & @CR & $strEnvelope & @CR & @CR ) ; Make the SOAP call $objHTTP.send ($strEnvelope) ; Get the return envelope $strReturn = $objHTTP.responsetext With $oDATA .Type=1 .Open .Write($objHTTP.ResponseBody) .SaveToFile(@ScriptDir&'\captcha.arf', 2) .Close EndWith EndFunc RESPONSE: '------=_Part_5_987625235.1444159091234' 'Content-Type: text/xml; charset=UTF-8' 'Content-Transfer-Encoding: binary' 'Content-Id: <DF72463F6FAFE80B930059E761DF7225>' '<?xml version="1.0" encoding="UTF-8"?>' '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' '<soapenv:Body>' '<ns1:downloadNBRStorageFileResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="NBRStorageService">' '<ns1:downloadNBRStorageFileReturn xsi:type="soapenc:Array" soapenc:arrayType="ns1:DataHandler[2]" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">' '<item href="cid:FE782065C11E6558C9C8925EBE3D687F"/>' '<item href="cid:3CF0B37E4C5932A3E60EBA5226CFC30A"/>' '</ns1:downloadNBRStorageFileReturn>' '</ns1:downloadNBRStorageFileResponse>' '</soapenv:Body>' '</soapenv:Envelope>' ------=_Part_5_987625235.1444159091234 Content-Type: application/octet-stream Content-Transfer-Encoding: binary Content-Id: <FE782065C11E6558C9C8925EBE3D687F> Attachment.arf 2342371 false ------=_Part_5_987625235.1444159091234 Content-Type: application/octet-stream Content-Transfer-Encoding: binary Content-Id: <3CF0B37E4C5932A3E60EBA5226CFC30A>
- 14 replies
-
- soap
- webservices
-
(and 1 more)
Tagged with: