axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff" <j...@cogentlogic.com>
Subject Re: import schema to wsdl
Date Wed, 08 Jun 2005 21:08:10 GMT
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" <atmanes@gmail.com>
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 <taylorjw@tcd.ie> 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 <atmanes@gmail.com>:
>
> > 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 <taylorjw@tcd.ie> 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 <atmanes@gmail.com>:
> > >
> > > > 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 <jeff@cogentlogic.com> 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" <taylorjw@tcd.ie>
> > > > > 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
>


Mime
View raw message