How to Integrate PocketSOAP in Visual Basic and ASP

Written by

in

PocketSOAP is an open-source, lightweight COM library used in legacy systems like Visual Basic 6 (VB6) and Classic ASP to compose, transmit, and parse SOAP-based Web Services. Because both VB6 and Classic ASP rely on COM Automation, integrating PocketSOAP involves instantiating its core components (Envelope and HTTPTransport) via ProgIDs. Prerequisites & Setup

Before writing code, the PocketSOAP engine must be installed and registered on your host or web server.

Download and Install: Download the installer from the official PocketSOAP Website.

Visual Basic 6: Open your project, go to Project -> References, and check the box for PocketSOAP Library. This enables early binding and IntelliSense.

Classic ASP: No reference setup is needed. You will invoke the library dynamically using Server.CreateObject in your .asp scripts. 1. Integration Code for Classic ASP (VBScript)

Classic ASP utilizes dynamic binding. The following script builds a standard SOAP payload, transmits it via HTTP POST, and extracts a value from the XML response.

Stock Quote Results

” Response.Write “Ticker Symbol: MSFT
” Response.Write “Current Value: ” & resultNode.Value ‘ 7. Clean up COM Objects Set resultNode = Nothing Set httpTrans = Nothing Set xmlEnv = Nothing %> Use code with caution. 2. Integration Code for Visual Basic 6

Using Early Binding in VB6 improves execution speed and provides syntax autocompletion.

Private Sub CallWebService() Dim xmlEnv As PocketSOAP.CoEnvelope Dim httpTrans As PocketSOAP.HTTPTransport ’ 1. Initialize objects natively Set xmlEnv = New PocketSOAP.CoEnvelope Set httpTrans = New PocketSOAP.HTTPTransport ‘ 2. Setup Remote Procedure Call (RPC) details xmlEnv.SetMethod “Add”, “http://simon.fell.com/calc” ’ 3. Populate arguments xmlEnv.Parameters.Create “a”, 150 xmlEnv.Parameters.Create “b”, 25 ‘ 4. Define actions and target endpoint httpTrans.SOAPAction = “http://fell.com” Me.MousePointer = vbHourglass On Error GoTo ErrorHandler ’ 5. Transport payload and parse downstream response stream httpTrans.Send “http://soap.4s4c.com/ssss4c/soap.asp”, xmlEnv.Serialize xmlEnv.Parse httpTrans ‘ 6. Capture the specific return value node name MsgBox “Result from Web Service: ” & xmlEnv.Parameters.ItemByName(“added”).Value, vbInformation, “Success” CleanExit: Me.MousePointer = vbDefault Set xmlEnv = Nothing Set httpTrans = Nothing Exit Sub ErrorHandler: MsgBox “SOAP Communication Failed: ” & Err.Description, vbCritical, “Error” Resume CleanExit End Sub Use code with caution. Comparing Integration Methods Classic ASP (.asp) Visual Basic 6 (.vbp) Object Instantiation Server.CreateObject(“ProgID”) New PocketSOAP.CoEnvelope (Early Binding) Error Handling On Error Resume Next / Checked blocks On Error GoTo LabelName (Structured blocks) Deployment Requirement Registered psoap32.dll on IIS Web Server Registered psoap32.dll on Client Workstation Core Troubleshooting Guidelines

Version Independence Mismatches: If you encounter instantiation errors, ensure you target the explicit version ProgID. Avoid generic naming. Use PocketSOAP.Envelope.11 instead of PocketSOAP.Envelope to freeze the internal calculation behavior.

Debugging Raw XML Transmissions: To diagnose serialization or endpoint compatibility errors, leverage native HTTP tracing. You can pipe transactions using standard diagnostic utilities or configure the companion utility pcapTrace to read raw inbound/outbound XML envelopes seamlessly.

Automated Proxy Generation: For vast service footprints with complex parameters, do not construct parameters manually. Use the standalone companion utility PocketSOAP WSDL Wizard. It interprets remote descriptive metadata (.wsdl) and generates concrete .cls proxy structures directly into your application directory.

Are you looking to parse complex nested arrays with PocketSOAP, or are you connecting to a modern document/literal type service (like .NET ASMX) that needs custom XML formatting? PocketSOAP 1.5.3

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *