Fun, this XML stuff, isn't it. I bet we could play all day with elements and
things  :-)

If you think XML has a serious purpose, then be more thoughtful. Anne's
suggestion is right on the money. Perhaps James is teasing us with his!

The flightList element serves no purpose. All data structures should be as
concise as possible otherwise we wind up with useless baggage. As an aid to
understanding the implications of schemas, you might want to write down
sample instances.

James' solution:

<bookFlightsResponse xmlns="http://ie.tcd/taylorjw/flightbooking";>
    <flightList>
        <flight>
            <flightNum>123</flightNum>
            <sourceAirport>LAX</sourceAirport>
            <destAirport>YYK</destAirport>
            <flightDate>1005-08-12</flightDate>
            <seatsAvailible>31</seatsAvailible>
            <seatPrice>$175.95</seatPrice>
            <numberOfSeatsToBook>3</numberOfSeatsToBook>
            <bookingNumber>456</bookingNumber>
            <information>Charter</information>
        </flight>
        <flight>
            <flightNum>321</flightNum>
            <sourceAirport>LON</sourceAirport>
            <destAirport>ADH</destAirport>
            <flightDate>1005-07-25</flightDate>
            <seatsAvailible>17</seatsAvailible>
            <seatPrice>$365.95</seatPrice>
            <numberOfSeatsToBook>1</numberOfSeatsToBook>
            <bookingNumber>789</bookingNumber>
            <information></information>
        </flight>
    </flightList>
</bookFlightsResponse>


Anne's solution:

<bookFlightsResponse xmlns="http://ie.tcd/taylorjw/flightbooking";>
      <bookedFlights>
          <flightNum>123</flightNum>
          <sourceAirport>LAX</sourceAirport>
          <destAirport>YYK</destAirport>
          <flightDate>1005-08-12</flightDate>
          <seatsAvailible>31</seatsAvailible>
          <seatPrice>$175.95</seatPrice>
          <numberOfSeatsToBook>3</numberOfSeatsToBook>
          <bookingNumber>456</bookingNumber>
          <information>Charter</information>
      </bookedFlights>
      <bookedFlights>
          <flightNum>321</flightNum>
          <sourceAirport>LON</sourceAirport>
          <destAirport>ADH</destAirport>
          <flightDate>1005-07-25</flightDate>
          <seatsAvailible>17</seatsAvailible>
          <seatPrice>$365.95</seatPrice>
          <numberOfSeatsToBook>1</numberOfSeatsToBook>
          <bookingNumber>789</bookingNumber>
          <information></information>
      </bookedFlights>
</bookFlightsResponse>


Slight variations on your schema, James, could well justify the use of
flightList but not as it stands.


What was your question, BTW?  :-)


Jeff



----- Original Message ----- 
From: "James Taylor" <[EMAIL PROTECTED]>
To: <axis-user@ws.apache.org>; "Jeff" <[EMAIL PROTECTED]>
Cc: <axis-user@ws.apache.org>; "Anne Thomas Manes" <[EMAIL PROTECTED]>
Sent: Wednesday, June 08, 2005 8:41 PM
Subject: Re: import schema to wsdl


Ok well what I've done is add a flightList complexType to my external xsd
that
is like so

<xsd:complexType name="flightList">
<xsd:sequence>
<xsd:element name="flight" type="fb:Flight" minOccurs="0"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>

and referenced this as a return type for the message and wsdl2java has
generated
a class for this.

<xsd:element name="bookFlightsResponse">
<xsd:sequence>
<xsd:element name="flight" type="fb:flightList"/>
</xsd:sequence>
</xsd:element>

Quoting Jeff <[EMAIL PROTECTED]>:

> That reminds me, I found that WSDL2Java doesn't support maxOccurs in
> sequence, e.g.
>
> <xsd:element name="bookFlightsResponse">
>        <xsd:sequence maxOccurs="unbounded">
>                <xsd:element name = "bookedFlights" type="fb:Flight"/>
>        </xsd:sequence>
> </xsd:element>
>
>
>
>
> ----- Original Message -----
> From: "Anne Thomas Manes" <[EMAIL PROTECTED]>
> To: <axis-user@ws.apache.org>
> Sent: Wednesday, June 08, 2005 4:41 PM
> Subject: Re: import schema to wsdl
>
>
> James,
>
> This definition:
> <xsd:element name="bookFlightsResponse">
>        <xsd:sequence>
>                <xsd:element name = "bookedFlights" type="fb:Flight"/>
>        </xsd:sequence>
> </xsd:element>
>
> will return on Flight object. If you want to return an array of flight
> objects you should define it thus:
>
> <xsd:element name="bookFlightsResponse">
>        <xsd:sequence>
>                <xsd:element name = "bookedFlights" type="fb:Flight"
>                       maxOccurs="unbounded"/>
>        </xsd:sequence>
> </xsd:element>
>
> Anne
>
> On 6/8/05, James Taylor <[EMAIL PROTECTED]> wrote:
> > Hey anne,
> >          I've followed your advice by changing the method name in the
> portType
> > to the same as in the message in the wsdl. But when I ran it through
> wsdl2java
> > it produced the following dtd that says its doc-literal and the message
> > signature in SoabBindingImp still says Object and return type Object. To
> get
> > wrapped style do I have to change these manually? The exposed web
service
> > message should take a BookFlight object and return a list of booked
> flights.
> >          Just a question on the return type. In the xsd I have declare
it
> as
> >
> > <xsd:element name="bookFlightsResponse">
> >         <xsd:sequence>
> >                 <xsd:element name = "bookedFlights" type="fb:Flight"/>
> >         </xsd:sequence>
> > </xsd:element>
> >
> > does this not mean it should return a list of Flight objects?
> >     Regards,
> >             James.
> >
> > PS - Here's generated deploy.wsdd.
> >
> > <!-- Use this file to deploy some handlers/chains and services      -->
> > <!-- Two ways to do this:                                           -->
> > <!--   java org.apache.axis.client.AdminClient deploy.wsdd          -->
> > <!--      after the axis server is running                          -->
> > <!-- or                                                             -->
> > <!--   java org.apache.axis.utils.Admin client|server deploy.wsdd   -->
> > <!--      from the same directory that the Axis engine runs         -->
> >
> > <deployment
> >     xmlns="http://xml.apache.org/axis/wsdd/";
> >     xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";>
> >
> >   <!-- Services from BookFlightsService WSDL service -->
> >
> >   <service name="BookFlightsSOAPPort" provider="java:RPC"
style="document"
> > use="literal">
> >       <parameter name="wsdlTargetNamespace"
> > value="http://ie/tcd/taylorjw/flightbooking/wsdl"/>
> >       <parameter name="wsdlServiceElement" value="BookFlightsService"/>
> >       <parameter name="wsdlServicePort" value="BookFlightsSOAPPort"/>
> >       <parameter name="className"
> >
value="flightCompany.bookFlights.rpcservice.BookFlightsSOAPBindingImpl"/>
> >       <parameter name="wsdlPortType" value="IBookFlightsPort"/>
> >       <operation name="bookFlights" qname="bookFlights"
> > returnQName="retNS:bookFlightsResponse"
> > xmlns:retNS="http://ie.tcd/taylorjw/flightbooking";
> returnType="rtns:anyType"
> > xmlns:rtns="http://www.w3.org/2001/XMLSchema"; soapAction="bookFlights" >
> >         <parameter qname="pns:bookFlightsRequest"
> > xmlns:pns="http://ie.tcd/taylorjw/flightbooking"; type="tns:anyType"
> > xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
> >       </operation>
> >       <parameter name="allowedMethods" value="bookFlights"/>
> >       <parameter name="scope" value="Session"/>
> >
> >       <typeMapping
> >         xmlns:ns="http://ie.tcd/taylorjw/flightbooking";
> >         qname="ns:Flight"
> >         type="java: flightCompany.bookFlights.rpcservice.Flight"
> >         serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
> >
> deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
> >         encodingStyle=""
> >       />
> >       <typeMapping
> >         xmlns:ns="http://ie.tcd/taylorjw/flightbooking";
> >         qname="ns:Passenger"
> >         type="java: flightCompany.bookFlights.rpcservice.Passenger"
> >         serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
> >
> deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
> >         encodingStyle=""
> >       />
> >       <typeMapping
> >         xmlns:ns="http://ie.tcd/taylorjw/flightbooking";
> >         qname="ns:Booking"
> >         type="java: flightCompany.bookFlights.rpcservice.Booking"
> >         serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
> >
> deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
> >         encodingStyle=""
> >       />
> >
> >   </service>
> > </deployment>
> >
> >
> >
> > Quoting Anne Thomas Manes <[EMAIL PROTECTED]>:
> >
> > > Sorry for the delay -- I've been away from this list for a couple of
> days...
> > >
> > > You need to change the message definition in the WSDL like so:
> > >
> > >        <message name="bookFlightsReq">
> > >           <part name="parameters" element="types:bookFlights" />
> > >        </message>
> > >
> > > and in your schema you need to rename the "bookFlightsRequest" element
> > > to "bookFlights".
> > >
> > > No other changes are required.
> > >
> > > Anne
> > >
> > > On 6/6/05, James Taylor <[EMAIL PROTECTED]> wrote:
> > > > So I should just chang change types:bookFlightsRequest to
> types:bookFlights
> > > and
> > > > reflect this in the external schema, will I have to change <input
> > > > message="tns:bookFlightsReq" /> <input message="tns:bookFlights" />
> also?
> > > >
> > > > ...heres the bit of the wsdl that would have to be changed...
> > > >
> > > > <portType name="IBookFlightsPort">
> > > >                 <operation name="bookFlights">
> > > >                         <input message="tns:bookFlightsReq" />
> > > >                         <output message="tns:bookFlightsResp" />
> > > >                 </operation>
> > > >         </portType>
> > > >
> > > >
> > > >         <types>
> > > >                 <xsd:schema
> > > >                         xmlns:xsd =
"http://www.w3.org/2001/XMLSchema";
> > > >                         elementFormDefault = "qualified"
> > > >                         targetNamespace =
> > > "http://ie.tcd/taylorjw/flightbooking";>
> > > >                         <xsd:import namespace =
> > > "http://ie.tcd/taylorjw/flightbooking";
> > > > schemaLocation="BookFlights.xsd"/>
> > > >                         <xsd:import namespace =
> > > "http://www.w3.org/2001/XMLSchema"; />
> > > >
> > > >                 </xsd:schema>
> > > >         </types>
> > > >
> > > >         <message name="bookFlightsReq">
> > > >         <part name="parameters" element="types:bookFlightsRequest"
/>
> > > >         </message>
> > > >
> > > >         <message name="bookFlightsResp">
> > > >             <part name="parameters"
> element="types:bookFlightsResponse" />
> > > >         </message>
> > > >
> > > >         <portType name="IBookFlightsPort">
> > > >                 <operation name="bookFlights">
> > > >                         <input message="tns:bookFlightsReq" />
> > > >                         <output message="tns:bookFlightsResp" />
> > > >                 </operation>
> > > >         </portType>
> > > >
> > > >
> > > > Quoting Anne Thomas Manes <[EMAIL PROTECTED]>:
> > > >
> > > > > James,
> > > > >
> > > > > If you want an interface that accepts parameters rather than an
> > > > > object, then you must define your WSDL so that it matches the
> > > > > "wrapped" convention. What that means is that your input message
> > > > > element name must be identical to your operation name. Currently
> your
> > > > > input message element name is bookFlightsRequest and your
operation
> > > > > name is bookFlights. If you fix it so that they are the same, it
> > > > > should give you what you want.
> > > > >
> > > > > Anne
> > > > >
> > > > > On 6/6/05, Jeff <[EMAIL PROTECTED]> wrote:
> > > > > > In general, I wouldn't let Axis provide a WSDL file. Tell it to
> use
> > > your
> > > > > > WSDL file by adding a <wsdlFile> element to the WSDD file before
> you
> > > deploy
> > > > > > so you wind up with something like:
> > > > > >
> > > > > > <deployment
> > > > > >     xmlns="http://xml.apache.org/axis/wsdd/";
> > > > > >     xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";>
> > > > > >
> > > > > >   <wsdlFile>/MyService.wsdl</wsdlFile>
> > > > > >
> > > > > >   <service name="...
> > > > > >
> > > > > >
> > > > > > Put MyService.wsdl in <Tomcat>\webapps\axis\WEB-INF\classes
> > > > > >
> > > > > > You will want to edit MyService.wsdl so that the endpoint near
the
> end
> > > of
> > > > > > the file is something that clients can connect instead of:
> > > > > >     http://localhost:9081/AxisWeb/services/BookFlightsSOAPPort
> > > > > >
> > > > > >
> > > > > > Jeff
> > > > > >
> > > > > >
> > > > > >
> > > > > > ----- Original Message -----
> > > > > > From: "James Taylor" <[EMAIL PROTECTED]>
> > > > > > To: <axis-user@ws.apache.org>
> > > > > > Sent: Monday, June 06, 2005 5:02 AM
> > > > > > Subject: Re: import schema to wsdl
> > > > > >
> > > > > >
> > > > > > Thanks for your help jeff. The main problem was the conflicting
> target
> > > > > > namespaces I was trying to import into my wsdl. I've gotten the
> > > wsdl2java
> > > > > > tool
> > > > > > to work fine now. Just a question on what will when the service
> gets
> > > > > > deployed
> > > > > > to axis. I presume axis will make a different wsdl then the one
I
> gave
> > > to
> > > > > > the
> > > > > > tool as it has defined a method signature for the portType as
> > > > > >  public java.lang.Object bookFlights(java.lang.Object
parameters)
> > > throws
> > > > > > java.rmi.RemoteException; would any one mind commenting on this
as
> I
> > > > > defined
> > > > > > the method signature in the wsdl more specific then this... I
know
> that
> > > I
> > > > > > defined a custom collection bean that is of type object - I
> presume
> > > I'll
> > > > > > cast
> > > > > > the parameters to get at it.
> > > > > > Regards,
> > > > > >         James.
> > > > > >
> > > > > > My wsdl and external schema...
> > > > > > <definitions
> > > > > >   targetNamespace="http://ie/tcd/taylorjw/flightbooking/wsdl";
> > > > > >   xmlns="http://schemas.xmlsoap.org/wsdl/";
> > > > > >   xmlns:tns="http://ie/tcd/taylorjw/flightbooking/wsdl";
> > > > > >   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
> > > > > >   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
> > > > > >   xmlns:types="http://ie.tcd/taylorjw/flightbooking"; >
> > > > > >
> > > > > > <types>
> > > > > > <xsd:schema
> > > > > > xmlns:xsd = "http://www.w3.org/2001/XMLSchema";
> > > > > > elementFormDefault = "qualified"
> > > > > > targetNamespace = "http://ie.tcd/taylorjw/flightbooking";>
> > > > > > <xsd:import namespace = "http://ie.tcd/taylorjw/flightbooking";
> > > > > > schemaLocation="BookFlights.xsd"/>
> > > > > > <xsd:import namespace = "http://www.w3.org/2001/XMLSchema"; />
> > > > > >
> > > > > > </xsd:schema>
> > > > > > </types>
> > > > > >
> > > > > > <message name="bookFlightsReq">
> > > > > >     <part name="parameters" element="types:bookFlightsRequest"
/>
> > > > > > </message>
> > > > > >
> > > > > > <message name="bookFlightsResp">
> > > > > >     <part name="parameters" element="types:bookFlightsResponse"
/>
> > > > > > </message>
> > > > > >
> > > > > > <portType name="IBookFlightsPort">
> > > > > > <operation name="bookFlights">
> > > > > > <input message="tns:bookFlightsReq" />
> > > > > > <output message="tns:bookFlightsResp" />
> > > > > > </operation>
> > > > > > </portType>
> > > > > >
> > > > > > <binding name="BookFlightsSOAPBinding"
> type="tns:IBookFlightsPort">
> > > > > > <soap:binding style="document"
> > > > > > transport="http://schemas.xmlsoap.org/soap/http"; />
> > > > > >     <operation name="bookFlights">
> > > > > >          <soap:operation style="document"
soapAction="bookFlights"
> />
> > > > > >          <input>
> > > > > >               <soap:body use="literal" />
> > > > > >          </input>
> > > > > >          <output>
> > > > > >               <soap:body use="literal" />
> > > > > >          </output>
> > > > > >     </operation>
> > > > > >       </binding>
> > > > > >
> > > > > >       <service name="BookFlightsService">
> > > > > >            <port name="BookFlightsSOAPPort"
> > > > > > binding="tns:BookFlightsSOAPBinding">
> > > > > >                 <soap:address
> > > > > >
> location="http://localhost:9081/AxisWeb/services/BookFlightsSOAPPort";
> > > />
> > > > > >            </port>
> > > > > >       </service>
> > > > > >
> > > > > > </definitions>
> > > > > >
> > > > > >
> > > > > > <!--BookFlights.xsd -->
> > > > > >
> > > > > > <?xml version="1.0" ?>
> > > > > > <schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema";
> > > > > >     targetNamespace = "http://ie.tcd/taylorjw/flightbooking";
> > > > > >     xmlns:fb="http://ie.tcd/taylorjw/flightbooking";>
> > > > > >
> > > > > > <xsd:complexType name="Booking">
> > > > > > <xsd:sequence>
> > > > > > <xsd:element name="passenger" type="fb:Passenger"/>
> > > > > > <xsd:element name="flight" type="fb:Flight" minOccurs="0"
> > > > > > maxOccurs="unbounded"/>
> > > > > > </xsd:sequence>
> > > > > > </xsd:complexType>
> > > > > >
> > > > > >     <xsd:complexType name="Passenger">
> > > > > > <xsd:sequence>
> > > > > >
> > > > > > <xsd:element name="passengerNum" type="xsd:integer" />
> > > > > > <xsd:element name="firstName" type="xsd:string" />
> > > > > > <xsd:element name="lastName" type="xsd:string" />
> > > > > > <xsd:element name="address" type="xsd:string" />
> > > > > >
> > > > > > </xsd:sequence>
> > > > > >     </xsd:complexType>
> > > > > >
> > > > > >
> > > > > >
> > > > > >     <xsd:complexType name="Flight">
> > > > > > <xsd:sequence>
> > > > > >
> > > > > > <xsd:element name="flightNum" type="xsd:integer" />
> > > > > > <xsd:element name="sourceAirport" type="xsd:string" />
> > > > > > <xsd:element name="destAirport" type="xsd:string" />
> > > > > > <xsd:element name="flightDate" type="xsd:string" />
> > > > > > <xsd:element name="seatsAvailible" type="xsd:integer" />
> > > > > > <xsd:element name="seatPrice" type="xsd:integer" />
> > > > > > <xsd:element name="numberOfSeatsToBook" type="xsd:string" />
> > > > > > <xsd:element name="bookingNumber" type="xsd:integer" />
> > > > > > <xsd:element name="information" type="xsd:string" />
> > > > > >
> > > > > > </xsd:sequence>
> > > > > >     </xsd:complexType>
> > > > > >
> > > > > >
> > > > > > <xsd:element name="bookFlightsResponse">
> > > > > > <xsd:sequence>
> > > > > > <xsd:element name = "bookedFlights" type="fb:Flight"/>
> > > > > > </xsd:sequence>
> > > > > > </xsd:element>
> > > > > >
> > > > > > <xsd:element name="bookFlightsRequest">
> > > > > > <xsd:sequence>
> > > > > > <xsd:element name="bookingRequest" type="fb:Booking"/>
> > > > > > </xsd:sequence>
> > > > > > </xsd:element>
> > > > > >
> > > > > >
> > > > > > </schema>
> > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Between the question and the answer lies free will
> > > >
> > >
> >
> >
> > --
> > Between the question and the answer lies free will
> >
>
>


--
Between the question and the answer lies free will

Reply via email to