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) Peoplevox WMS AuthenticationProvides an example of a call to the Peoplevox WMS Authenticate using SOAP 1.1.
integer li_rc integer li_Success oleobject loo_SbSoapXml oleobject loo_Crypt string ls_PasswordBase64 integer li_NumReplacements oleobject loo_Req oleobject loo_Http oleobject loo_Resp oleobject loo_XmlResponse string ls_Detail // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. // Sends a POST that looks like this: // POST /PEOPLEVOX_CLIENT_ID/resources/integrationservicev4.asmx HTTP/1.1 // Content-Type: text/xml;charset=UTF-8 // SOAPAction: http://www.peoplevox.net/Authenticate // Content-Length: (automatically computed and added by Chilkat) // Host: qac.peoplevox.net // // <?xml version="1.0" encoding="utf-8"?> // <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:peop="http://www.peoplevox.net/"> // <soapenv:Header/> // <soapenv:Body> // <peop:Authenticate> // <peop:clientId>PEOPLEVOX_CLIENT_ID</peop:clientId> // <peop:username>PEOPLEVOX_USERNAME</peop:username> // <peop:password>PEOPLEVOX_BASE64_PASSWORD</peop:password> // </peop:Authenticate> // </soapenv:Body> // </soapenv:Envelope> // loo_SbSoapXml = create oleobject // Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0 li_rc = loo_SbSoapXml.ConnectToNewObject("Chilkat.StringBuilder") if li_rc < 0 then destroy loo_SbSoapXml MessageBox("Error","Connecting to COM object failed") return end if loo_SbSoapXml.Append("<?xml version=~"1.0~" encoding=~"utf-8~"?>") loo_SbSoapXml.Append("<soapenv:Envelope xmlns:soapenv=~"http://schemas.xmlsoap.org/soap/envelope/~" xmlns:peop=~"http://www.peoplevox.net/~">") loo_SbSoapXml.Append(" <soapenv:Header/>") loo_SbSoapXml.Append(" <soapenv:Body>") loo_SbSoapXml.Append(" <peop:Authenticate>") loo_SbSoapXml.Append(" <peop:clientId>PEOPLEVOX_CLIENT_ID</peop:clientId>") loo_SbSoapXml.Append(" <peop:username>PEOPLEVOX_USERNAME</peop:username>") loo_SbSoapXml.Append(" <peop:password>PEOPLEVOX_BASE64_PASSWORD</peop:password>") loo_SbSoapXml.Append(" </peop:Authenticate>") loo_SbSoapXml.Append(" </soapenv:Body>") loo_SbSoapXml.Append("</soapenv:Envelope>") // Base64 encode the password and update the SOAP XML. loo_Crypt = create oleobject // Use "Chilkat_9_5_0.Crypt2" for versions of Chilkat < 10.0.0 li_rc = loo_Crypt.ConnectToNewObject("Chilkat.Crypt2") ls_PasswordBase64 = loo_Crypt.EncodeString("PEOPLEVOX_PASSWORD","utf-8","base64") li_NumReplacements = loo_SbSoapXml.Replace("PEOPLEVOX_BASE64_PASSWORD",ls_PasswordBase64) 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.SendCharset = 1 loo_Req.Charset = "utf-8" loo_Req.AddHeader("Content-Type","text/xml") loo_Req.AddHeader("SOAPAction","http://www.peoplevox.net/Authenticate") loo_Req.Path = "/PEOPLEVOX_CLIENT_ID/resources/integrationservicev4.asmx" li_Success = loo_Req.LoadBodyFromString(loo_SbSoapXml.GetAsString(),"utf-8") loo_Http = create oleobject // Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0 li_rc = loo_Http.ConnectToNewObject("Chilkat.Http") loo_Http.FollowRedirects = 1 loo_Resp = loo_Http.SynchronousRequest("qac.peoplevox.net",443,1,loo_Req) if loo_Http.LastMethodSuccess <> 1 then Write-Debug loo_Http.LastErrorText destroy loo_SbSoapXml destroy loo_Crypt destroy loo_Req destroy loo_Http return end if // We should expect a 200 response if successful. if loo_Resp.StatusCode <> 200 then Write-Debug "Response StatusCode = " + string(loo_Resp.StatusCode) Write-Debug "Response StatusLine: " + loo_Resp.StatusLine Write-Debug "Response Header:" Write-Debug loo_Resp.Header destroy loo_SbSoapXml destroy loo_Crypt destroy loo_Req destroy loo_Http return end if // A successful response returns this XML: // <?xml version="1.0" encoding="utf-8" ?> // <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> // <soap:Body> // <AuthenticateResponse xmlns="http://www.peoplevox.net/"> // <AuthenticateResult> // <ResponseId>0</ResponseId> // <TotalCount>1</TotalCount> // <Detail>PEOPLEVOX_CLIENT_ID,7fe13431-c67f-4d52-bcfd-b60fbfa3b0ca</Detail> // <Statuses /> // <ImportingQueueId>0</ImportingQueueId> // <SalesOrdersToDespatchIds /> // </AuthenticateResult> // </AuthenticateResponse> // </soap:Body> // </soap:Envelope> // 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 // Show how to get the Detail, which must be the ClientId,SessionId ls_Detail = loo_XmlResponse.ChilkatPath("soap:Body|AuthenticateResponse|AuthenticateResult|Detail|*") Write-Debug "Detail = " + ls_Detail destroy loo_SbSoapXml destroy loo_Crypt destroy loo_Req destroy loo_Http destroy loo_XmlResponse |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.