Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PowerBuilder) Another SOAP with MTOM XOP Attachment ExampleSee more HTTP ExamplesDemonstrates another multipart/related MTOM SOAP request that adds additional headers in each MIME sub-part, and also specifies Content-Transfer-Encoding in the sub-parts. Note: This example requires Chilkat v9.5.0.92 or greater.
integer li_rc oleobject loo_Http oleobject loo_Req string ls_XmlBody integer li_Success string ls_XmlBody2 integer li_UseTls oleobject loo_Resp oleobject loo_XmlResponse // Note: This example requires Chilkat v9.5.0.92 or greater. // This example sends a request such as the following: // POST /FseInsServicesWeb/services/fseComunicazioneMetadati HTTP/1.1 // Connection: Keep-Alive // Content-Length: 50649 // Content-Type: multipart/related; type="application/xop+xml"; start="<rootpart@soapui.org>"; start-info="text/xml"; boundary="----=_Part_0_355796458.1662133302632" // Accept-Encoding: gzip,deflate // Authorization: Basic xxxxx // Host: ... // SOAPAction: "http://comunicazionemetadati.wsdl.fse.ini.finanze.it/ComunicazioneMetadati" // MIME-Version: 1.0 // // ------=_Part_0_355796458.1662133302632 // Content-Type: application/xop+xml; charset=UTF-8; type="text/xml" // Content-Transfer-Encoding: 8bit // Content-ID: <rootpart@soapui.org> // // <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:com="http://comunicazionemetadatirichiesta.xsd.fse.ini.finanze.it" xmlns:tip="http://tipodaticomunicazionemetadati.xsd.fse.ini.finanze.it"> // <soapenv:Header/> // ... // // ------=_Part_0_355796458.1662133302632 // Content-Type: text/xml; charset=Cp1252 // Content-Transfer-Encoding: quoted-printable // Content-ID: <CDA2LAB_190_signed.xml> // Content-Disposition: attachment; name="CDA2LAB_190_signed.xml" // // <!-- INSERIRE IL RIFERIMENTO AL FOGLIO DI STILE DI AGID OPPURE INSERIRNE UN= // ... // // ------=_Part_0_355796458.1662133302632-- loo_Http = create oleobject // Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0 li_rc = loo_Http.ConnectToNewObject("Chilkat.Http") if li_rc < 0 then destroy loo_Http MessageBox("Error","Connecting to COM object failed") return end if loo_Req = create oleobject // Use "Chilkat_9_5_0.HttpRequest" for versions of Chilkat < 10.0.0 li_rc = loo_Req.ConnectToNewObject("Chilkat.HttpRequest") loo_Req.HttpVerb = "POST" loo_Req.Path = "/FseInsServicesWeb/services/fseComunicazioneMetadati" // Chilkat will automatically generate and add a boundary string. loo_Req.ContentType = "multipart/related; type=~"application/xop+xml~"; start=~"<rootpart@soapui.org>~"; start-info=~"text/xml~"" loo_Req.AddHeader("SOAPAction","some-SOAP-action") loo_Req.AddHeader("Connection","Keep-Alive") loo_Req.AddHeader("Accept-Encoding","gzip,deflate") loo_Req.AddHeader("MIME-Version","1.0") // Chilkat will automatically add the Content-Length and Host headers. // The "Authorization: Basic ..." header is added by setting the Login and Password and specifying Basic authentication: loo_Http.Login = "..." loo_Http.Password = "..." loo_Http.BasicAuth = 1 // Add the 1st multipart/related sub-part, which is the SOAP envelope. ls_XmlBody = "<soapenv:Envelope ...." li_Success = loo_Req.AddStringForUpload2("","",ls_XmlBody,"utf-8","application/xop+xml; type=~"text/xml~"; charset=utf-8") // Additional headers for the 1st sub-part li_Success = loo_Req.AddSubHeader(0,"Content-ID","<rootpart@soapui.org>") li_Success = loo_Req.AddSubHeader(0,"Content-Transfer-Encoding","8bit") li_Success = loo_Req.AddSubHeader(0,"Content-Disposition","") // Add the 2nd multipart/related sub-part, which is the signed XML ls_XmlBody2 = "<!-- INSERIRE IL RIFERIMENT ...." li_Success = loo_Req.AddStringForUpload2("CDA2LAB_190_signed.xml","",ls_XmlBody2,"Cp1252","text/xml; charset=Cp1252") // Additional headers for the 2nd sub-part. li_Success = loo_Req.AddSubHeader(1,"Content-ID","<CDA2LAB_190_signed.xml>") li_Success = loo_Req.AddSubHeader(1,"Content-Transfer-Encoding","quoted-printable") li_Success = loo_Req.AddSubHeader(1,"Content-Disposition","attachment; name=~"CDA2LAB_190_signed.xml~"") loo_Http.FollowRedirects = 1 li_UseTls = 1 loo_Resp = loo_Http.SynchronousRequest("fseservicetest.sanita.finanze.it",443,li_UseTls,loo_Req) if loo_Http.LastMethodSuccess <> 1 then Write-Debug loo_Http.LastErrorText destroy loo_Http destroy loo_Req return end if loo_XmlResponse = create oleobject // Use "Chilkat_9_5_0.Xml" for versions of Chilkat < 10.0.0 li_rc = loo_XmlResponse.ConnectToNewObject("Chilkat.Xml") li_Success = loo_XmlResponse.LoadXml(loo_Resp.BodyStr) Write-Debug loo_XmlResponse.GetXml() destroy loo_Resp destroy loo_Http destroy loo_Req destroy loo_XmlResponse |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.