locked
Consuming object arrays in Web Services RRS feed

  • Question

  • Hello,

    I am getting to know about wonderful .NET Web Service features with VB.NET. For some reason, I can't get VB.NET to understand an array of objects defined in WSDL file.

    If you take a look on following url: http://www.nonplus.net/geek/samples/books.php?wsdl you can see that there are ChapterArray, Book and BookArray types defined. If I make a web reference to the url above in my VB.NET, ChapterArray and BookArray won't come available. Why? Should the be defined in another way in WSDL?

    Thanks,
    Ville
    Tuesday, January 10, 2006 6:41 PM

Answers

  • When I run wsdl.exe /l:vb on this particular WSDL, getBooks() correctly returns a BookArray.

    Monday, December 11, 2006 11:32 PM
    Moderator

All replies

  • I will attach the type definition WSDL code to this thread as it can be removed from the URL mentioned above. The full WSDL is available via that link above.

    <types>

        <xsd:schema targetNamespace="http://books.org/Books">
    <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
    <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/"/>

        <xsd:complexType name="Chapter">

        <xsd:all>
    <xsd:element name="title" type="xsd:string"/>
    <xsd:element name="page" type="xsd:int"/>
    </xsd:all>
    </xsd:complexType>

        <xsd:complexType name="ChapterArray">

        <xsd:complexContent>

        <xsd:restriction base="SOAP-ENC:Array">
    <xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:Chapter[]"/>
    </xsd:restriction>
    </xsd:complexContent>
    </xsd:complexType>

        <xsd:complexType name="Book">

        <xsd:all>
    <xsd:element name="author" type="xsd:string"/>
    <xsd:element name="title" type="xsd:string"/>
    <xsd:element name="numpages" type="xsd:int"/>
    <xsd:element name="toc" type="tns:ChapterArray"/>
    </xsd:all>
    </xsd:complexType>

        <xsd:complexType name="BookArray">

        <xsd:complexContent>

        <xsd:restriction base="SOAP-ENC:Array">
    <xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:Book[]"/>
    </xsd:restriction>
    </xsd:complexContent>
    </xsd:complexType>
    </xsd:schema>
    </types>

    Wednesday, January 11, 2006 3:46 PM
  • When I run wsdl.exe /l:vb on this particular WSDL, getBooks() correctly returns a BookArray.

    Monday, December 11, 2006 11:32 PM
    Moderator