Using a ComplexType

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Smith

    Using a ComplexType

    Hi there

    I want to connect to a web service on-the-fly programmaticall y like so:

    WS.mssoapinit(http://paul/stddemo/ws/service.asmx?wsdl)

    which is successful. I can access the web service

    RetVal = WS.LogIn("B", "B", "StdDemo", "MyApp", ID, Message)

    Now one of the methods of the web service uses a complex type

    - <s:complexTyp e name="FieldColl ection">
    - <s:sequence>
    <s:element minOccurs="0" maxOccurs="1" name="Items"
    type="tns:Array OfField" />
    </s:sequence>
    </s:complexType>
    - <s:complexTyp e name="ArrayOfFi eld">
    - <s:sequence>
    <s:element minOccurs="0" maxOccurs="unbo unded" name="Field"
    nillable="true" type="tns:Field " />
    </s:sequence>
    </s:complexType>
    - <s:complexTyp e name="Field">
    - <s:sequence>
    <s:element minOccurs="0" maxOccurs="1" name="Key" type="s:string"
    />
    <s:element minOccurs="0" maxOccurs="1" name="Value" />
    </s:sequence>
    </s:complexType>

    How can I define a variable to have a type of FieldCollection to pass to a
    method?

    I've tried this which doesn't work:

    Public Class Field

    Public Key As String

    Public Value

    End Class

    Public Class FieldCollection

    Public Items() As Field

    End Class



    dim oParams as FieldCollection .

    When trying to use a method with oParams I get the error

    An unhandled exception of type 'System.Runtime .InteropService s.COMException'
    occurred in microsoft.visua lbasic.dll

    Additional information: Client:Type conversion failure for element Params
    HRESULT=0x80020 005: Type mismatch.
    - Client:Unspecif ied client error. HRESULT=0x80020 005: Type mismatch.

    Please could someone help me?



    p


Working...