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 "Averbukh, Yuliya" <YA...@doubleclick.net> on 2001/04/04 23:12:23 UTC

WSDL 1.1

I couldn't get WSDL 1.1 toolkit to work with Apache SOAP 2.1, but only with
2.0  Is there a newer version of WSDL toolkit out there, and if not, please
recommend another tool for creating proxies on the client, so that they are
compatable with apache SOAP.

Thanks,
--Yuliya

VB client for address book sample

Posted by Scott Nichol <sn...@computer.org>.
Below are the three source files for a VB client for the address book sample.

Scott Nichol

------------ AddressBookClient.bas ------------------
'
'   This is a client for the addressbook SOAP server.
'   It is hard-wired to request a the address for John B. Good.
'   Thanks to Ed Keen (edk@interactiveportal.com) for
'   figuring out the extra SoapAttributes required.
'
'   Note: the project must have references to
'       "Microsoft Soap Type Library"
'       "Microsoft XML, v3.0"
'
Option Explicit

Sub Main()
    Dim END_POINT_URL As String
    Dim Method As String
    Dim NS_URI_SOAP_ENC As String
    Dim ADDRESSBOOK_NS As String
    Dim SOAP_ACTION As String
    Dim Connector As HttpConnector
    Dim Serializer As SoapSerializer
    Dim Reader As SoapReader

    '**************************************************************
    '*********** YOU MUST CHANGE THIS FOR YOUR ENVIRONMENT ********
    '**************************************************************
    ' In the Java client, this is the first parameter to call.invoke
    END_POINT_URL = "http://localhost/soap/servlet/rpcrouter"
    ' In the Java client, this is the parameter to call.setMethodName
    Method = "getAddressFromName"
    ' In the Java client, this is the parameter to call.setEncodingStyleURI
    NS_URI_SOAP_ENC = "http://schemas.xmlsoap.org/soap/encoding/"
    ' In the Java client, this is the parameter to call.setTargetObjectURI
    ADDRESSBOOK_NS = "urn:AddressFetcher"
    ' In the Java client, this is the second parameter to call.invoke
    'SOAP_ACTION = "uri:" & Method
    SOAP_ACTION = ""

    Set Connector = New HttpConnector
    Connector.Property("EndPointURL") = END_POINT_URL
    Connector.Connect Nothing

    Connector.Property("SoapAction") = SOAP_ACTION
    Connector.BeginMessage Nothing

    Set Serializer = New SoapSerializer
    Serializer.Init Connector.InputStream

    Serializer.startEnvelope
        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, ADDRESSBOOK_NS, NS_URI_SOAP_ENC, "ab"
                ' In the Java client, this corresponds to a new Parameter(...)
                Serializer.startElement "nameToLookup"
                    Serializer.SoapAttribute "xsi:type", , "xsd:string"
                    Serializer.writeString "John B. Good"
                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
        Dim resultElement As IXMLDOMElement
        Set resultElement = Reader.RPCResult
        'MsgBox resultElement.xml
        Dim addr As New address
        addr.LoadFromXMLElement resultElement
        MsgBox addr.Text
    End If
End Sub

------------ Address.cls ------------------
Option Explicit

Private streetNum As Long
Private streetName As String
Private city As String
Private state As String
Private zip As Long
Private phoneNumber As New phone

Public Sub LoadFromXMLElement(element As IXMLDOMElement)
    Dim children As IXMLDOMNodeList
    Dim el As IXMLDOMNode
    Dim i As Integer
    Set children = element.childNodes
    For i = 0 To children.length - 1
        Set el = children.Item(i)
        If el.nodeType = NODE_ELEMENT Then
            Select Case el.baseName
                Case "streetNum"
                    streetNum = CLng(el.Text)
                Case "streetName"
                    streetName = el.Text
                Case "city"
                    city = el.Text
                Case "state"
                    state = el.Text
                Case "zip"
                    zip = CLng(el.Text)
                Case "phoneNumber"
                    phoneNumber.LoadFromXMLElement el
            End Select
        End If
    Next
End Sub

Public Property Get Text() As String
    Text = _
        streetNum & " " & streetName & vbCrLf & _
        city & ", " & state & "  " & zip & vbCrLf & _
        phoneNumber.Text
End Property

------------ Phone.cls ------------------
Option Explicit

Private areaCode As Integer
Private exchange As String
Private number As String

Public Sub LoadFromXMLElement(element As IXMLDOMElement)
    Dim children As IXMLDOMNodeList
    Dim el As IXMLDOMNode
    Dim i As Integer
    Set children = element.childNodes
    For i = 0 To children.length - 1
        Set el = children.Item(i)
        If el.nodeType = NODE_ELEMENT Then
            Select Case el.baseName
                Case "areaCode"
                    areaCode = CInt(el.Text)
                Case "exchange"
                    exchange = el.Text
                Case "number"
                    number = el.Text
            End Select
        End If
    Next
End Sub

Public Property Get Text() As String
    Text = "(" & areaCode & ") " & exchange & "-" & number
End Property



VB client for stockquote sample

Posted by Scott Nichol <sn...@computer.org>.
Below is a VB client for the stockquote example.  I used MS SOAP Toolkit 2 beta 2 and
the nightly Apache SOAP build from April 5.

Scott Nichol

'
'   This is a client for the stockquote SOAP server.
'   It is hard-wired to request a quote for IBM.
'   Thanks to Ed Keen (edk@interactiveportal.com) for
'   figuring out the extra SoapAttributes required.
'
'   Note: the project must have a reference to "Microsoft Soap Type Library"
'
Option Explicit

Sub Main()
    Dim END_POINT_URL As String
    Dim Method As String
    Dim NS_URI_SOAP_ENC As String
    Dim STOCKQUOTE_NS As String
    Dim SOAP_ACTION As String
    Dim Connector As HttpConnector
    Dim Serializer As SoapSerializer
    Dim Reader As SoapReader

    ' ***************************************************
    ' **** YOU MUST CHANGE THIS FOR YOUR ENVIRONMENT ****
    ' ***************************************************
    ' In the Java client, this is the first parameter to call.invoke
    END_POINT_URL = "http://localhost/soap/servlet/rpcrouter"
    ' In the Java client, this is the parameter to call.setMethodName
    Method = "getQuote"
    ' In the Java client, this is the parameter to call.setEncodingStyleURI
    NS_URI_SOAP_ENC = "http://schemas.xmlsoap.org/soap/encoding/"
    ' In the Java client, this is the parameter to call.setTargetObjectURI
    STOCKQUOTE_NS = "urn:xmltoday-delayed-quotes"
    ' In the Java client, this is the second parameter to call.invoke
    'SOAP_ACTION = "uri:" & Method
    SOAP_ACTION = ""

    Set Connector = New HttpConnector
    Connector.Property("EndPointURL") = END_POINT_URL
    Connector.Connect Nothing

    Connector.Property("SoapAction") = SOAP_ACTION
    Connector.BeginMessage Nothing

    Set Serializer = New SoapSerializer
    Serializer.Init Connector.InputStream

    Serializer.startEnvelope
        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, STOCKQUOTE_NS, NS_URI_SOAP_ENC, "sq"
                ' In the Java client, this corresponds to a new Parameter(...)
                Serializer.startElement "symbol"
                    Serializer.SoapAttribute "xsi:type", , "xsd:string"
                    Serializer.writeString "IBM"
                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
End Sub