(c) 2002 Visual Studio Magazine 
Fawcette Technical Publications

Listing A [online listing]. 
Apache SOAP, are you there? 
This HTTP Request shows a SOAP message from my sample app being sent from a VBclient to an Apache SOAP server. I included type information for parameters since Apache SOAP requires it.

POST /soap/servlet/rpcrouter HTTP/1.1
Content-Type: text/xml
Host: localhost
SOAPAction: "someuri"
Content-Length: 531
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SOAP-ENV:Envelope 
SOAP-ENV:encodingStyle= "http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:SOAP-ENV= "http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <SOAP-ENV:Body>
      <SOAPSDK1:chatMessageReceived 
      xmlns:SOAPSDK1="urn:ChatEventServer">
         <arg xsi:type="xsd:string">
         VB Chatter: Hello from a VB client to a Java Client
         </arg>
      </SOAPSDK1:chatMessageReceived>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>



Listing 1. 
Get the Low Down on the MS SOAP API. 
Here's how to call a Java Apache SOAP Server. Apache SOAP Servers always have the same end point, and the desired server instance and method are determined by the elements of the resulting SOAP Envelope.

Private Sub SendMessageToSOAPListeners(msg As String)
    On Error Resume Next
    Dim Connector As SoapConnector
    Dim Serializer As SoapSerializer
    Dim reader As SoapReader
    Set Connector = New HttpConnector
    Connector.Property("EndPointURL") = _
      "http://localhost:8080/" & _
      "soap/servlet/rpcrouter"
    Connector.Connect
    Connector.Property("SoapAction") = "someuri"
    Connector.BeginMessage
    Set Serializer = New SoapSerializer
    Serializer.Init Connector.InputStream
    Serializer.startEnvelope "", "STANDARD"
    Serializer.SoapNamespace "xsi", "http://www.w3.org/2001/XMLSchema-instance"
    Serializer.SoapNamespace "xsd", "http://www.w3.org/2001/XMLSchema"
    Serializer.startBody
    Serializer.startElement "chatMessageReceived", "urn:ChatEventServer"
    Serializer.startElement "arg"
    Serializer.SoapAttribute "type", "", "xsd:string", "xsi"
    Serializer.writeString msg
    Serializer.endElement
    Serializer.endElement
    Serializer.endBody
    Serializer.endEnvelope
    Connector.EndMessage
      retrieve a result if the method returned one
    'Set reader = New SoapReader
    'reader.Load Connector.OutputStream
    'If Not reader.Fault Is Nothing Then
    '    MsgBox reader.faultstring.Text, vbExclamation
    'Else
    '    MsgBox reader.RPCResult.Text
    'End If
End Sub

