views:

403

answers:

1

I'm very new to WSDL, but what I'm trying to do is very simple. I have gotten a web service working with python's ZSI library, but am stuck defining a service which returns an array of a custom type.

In my WSDL I have the following:

<xsd:element name="ArtPiece">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="title" type="xsd:string" />
        <xsd:element name="year" type="xsd:string" />
        <xsd:element name="imageId" type="xsd:int"  minOccurs="0" />
        <xsd:element name="image" type="xsd:base64Binary"  minOccurs="0" />
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

If I try to add another element like ArtPieceArray that's defined by having an unlimited number of ArtPiece types, that seems to be invalid.

If, when I'm defining my message, I try to use ArtPiece[], that also seems to be invalid.

I'm using ZSI for the web service, and C# for the client. The client web service code is generated by wsdl.exe

Any suggestions?

A: 
<xs:schema elementFormDefault="qualified" 
           targetNamespace="http://schemas.datacontract.org/2004/07/Foo" 
           xmlns:xs="http://www.w3.org/2001/XMLSchema" 
           xmlns:tns="http://schemas.datacontract.org/2004/07/Foo"&gt;
    <xs:complexType name="ArtPiece">
        <xs:sequence>
            <xs:element minOccurs="0" name="image" nillable="true" type="xs:base64Binary"/>
            <xs:element minOccurs="0" name="imageId" type="xs:int"/>
            <xs:element minOccurs="0" name="title" nillable="true" type="xs:string"/>
            <xs:element minOccurs="0" name="year" nillable="true" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>

    <xs:element name="ArtPiece" nillable="true" type="tns:ArtPiece"/>

    <xs:complexType name="ArrayOfArtPiece">
        <xs:sequence>
            <xs:element minOccurs="0" maxOccurs="unbounded" name="ArtPiece" nillable="true" type="tns:ArtPiece"/>
        </xs:sequence>
    </xs:complexType>

    <xs:element name="ArrayOfArtPiece" nillable="true" type="tns:ArrayOfArtPiece"/>
</xs:schema>
Darin Dimitrov