You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by Ed Keen <ed...@interactiveportal.com> on 2001/03/15 17:29:11 UTC

i got the microsoft client working!

I can't believe it, but with some tweaking, I got the Microsoft test client
working.  I had to manually add some attributes to some of the xml tags to
make it work, but now I can get it working with parameters as well.  Here is
the final code, with my comments ...

    Dim Method As String
    Dim NS_URI_SOAP_ENC As String
    
    Method = "testMethod2"
    NS_URI_SOAP_ENC = "http://schemas.xmlsoap.org/soap/encoding/"
    
    
    Set Connector = New HttpConnector
    Connector.Property("EndPointURL") = "http://localhost/rpcrouter"
    Connector.Connect Nothing

    // the original code sample said to put the method name here, 
    // but I took it out and it works fine
    Connector.Property("SoapAction") = ""
    Connector.BeginMessage Nothing
    Set Serializer = New SoapSerializer
    Serializer.Init Connector.InputStream

    Serializer.startEnvelope

    // had to manually add these 2 attributes for the Apache servlet to take
it
    // I think this was one of the biggest omissions with the Microsoft
client
    Serializer.SoapAttribute "xmlns:xsi", ,
"http://www.w3.org/1999/XMLSchema-instance"
    Serializer.SoapAttribute "xmlns:xsd", ,
"http://www.w3.org/1999/XMLSchema"
    
        Serializer.startBody
            Serializer.startElement Method, "urn:TestSoap", NS_URI_SOAP_ENC,
"ns1"

                Serializer.startElement "param"

                // had to manually add this attribute to compensate for
Microsoft's 
                // lack of including type information
                Serializer.SoapAttribute "xsi:type", , "xsd:string"
                    Serializer.writeString CStr("foo foo")
                Serializer.endElement

            Serializer.endElement
        Serializer.endBody
    Serializer.endEnvelope

    Connector.EndMessage

    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


Here is the final xml document trace that was generated from this code (it
is almost identical now to the xml doc generated by the Apache client):

POST /rpcrouter HTTP/1.1 
Content-Type: text/xml 
Host: localhost 
SOAPAction: "" 
Content-Length: 453  
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">

<SOAP-ENV:Body>
<ns1:testMethod2 xmlns:ns1="urn:TestSoap"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<param xsi:type="xsd:string">foo foo</param>
</ns1:testMethod2>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>