You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Peter Shillan <gp...@roe.ac.uk> on 2004/07/15 15:39:09 UTC

Wrapper Service Oddities - two parameters of the same type

Hi there,

I wanted to use a wrapper (document/literal) service to call an operation with 
two parameters of the same type so I wrote the following:

<xsd:schema
    xmlns:book="http://pshillan.dyndns.org/web/book"
    xmlns="http://pshillan.dyndns.org/web/book"
    targetNamespace="http://pshillan.dyndns.org/web/book"
  <xsd:element name="title" type="xsd:string"/>
  <xsd:element name="author" type="xsd:string"/>
  <xsd:element name="isbn" type="xsd:string"/>
  <xsd:element name="month" type="xsd:string"/>
  <xsd:element name="year" type="xsd:short"/>
  <xsd:element name="publisher" type="xsd:string"/>

  <xsd:complexType name="bookType">
    <xsd:sequence>
      <xsd:element ref="book:title"/>
      <xsd:element ref="book:author"/>
      <xsd:element ref="book:isbn"/>
      <xsd:element ref="book:month"/>
      <xsd:element ref="book:year"/>
      <xsd:element ref="book:publisher"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="twoBooksType">
    <xsd:sequence>
      <xsd:element name="bookOne" type="book:bookType"/>
      <xsd:element name="bookTwo" type="book:bookType"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="twoBooksRequest" type="book:twoBooksType"/>
</xsd:schema>

When I looked at the Axis generated WSDL though, the schema type twoBooksType 
looked like this:

  <xsd:complexType>
    <xsd:sequence>
      <xsd:element name="book" type="book:book"/>
      <xsd:element name="book" type="book:book"/>
    </xsd:sequence>
  </xsd:complexType>

I had to use the following in my own WSDL to make it work:

      <xsd:element name="bookOne" type="book:bookType"/>
      <xsd:element name="bookTwo" type="book:bookType"/>
              
      <xsd:complexType name="twoBooksType">
        <xsd:sequence>
          <xsd:element ref="book:bookOne"/>
          <xsd:element ref="book:bookTwo"/>
        </xsd:sequence>
      </xsd:complexType>

Can someone explain why this is necessary?

Cheers,

Peter Shillan.