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 Magnus Lassi <ma...@gmail.com> on 2007/08/10 17:46:50 UTC

WSDL2Java -generates multiple requests/response classes

Hi all,

I am using Axis 2.1.2 and I am trying to generate the stub classes for both
the service and client code with WSDL2Java. My problem is that it generates
multiple request/response object such as HelloWorldReply, HelloWorldReply1
etc which I assume has to do with my WSDL. I get multiple request/reply
classes when I use the Axis2 codegen plugin (Eclipse 3.3), if I run it from
the command line I get three request objects and one reply object.

The WSDL validates correctly with the WSDL editor in Eclipse 3.3, as far as
I know it's pretty standard type of WSDL, we use it across our company.

The commandline parameters looks like this: %AXIS2_HOME%\bin\WSDL2Java -uri
HelloWorld.wsdl -p com.acme.ws -d adb -s -wv 1.1 -ss -sd -ssi

I would appreciate if anyone has any ideas. I have also included the WSDL I
am using below.

TIA,
Magnus


<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns="
http://acme.com/ws/helloworld" xmlns:s1="
http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="
http://acme.com/ws/helloworld" name="HelloWorldServiceDefinitions">
    <types>
        <xs:schema attributeFormDefault="qualified"
elementFormDefault="qualified" targetNamespace="
http://acme.com/ws/helloworld" xmlns:xs="http://www.w3.org/2001/XMLSchema">
            <xs:element name="HelloWorldRequest"
type="ns:HelloWorldRequest"/>
            <xs:element name="HelloWorldReply" type="ns:HelloWorldReply"/>
            <xs:complexType name="HelloWorldRequest">
                <xs:annotation>
                    <xs:documentation>Stuff in request that needs to be
set.</xs:documentation>
                </xs:annotation>
                <xs:sequence>
                    <xs:element name="Version" type="xs:string">
                            <xs:annotation>
                                <xs:documentation>Identifies the
version/level of a service operation expected by a caller (in each request)
and performed by the callee (in each reply).</xs:documentation>
                            </xs:annotation>
                    </xs:element>
                    <xs:element name="FullName" type="xs:string">
                            <xs:annotation>
                                <xs:documentation>Identifies the name of the
guy.</xs:documentation>
                            </xs:annotation>
                    </xs:element>
                    <xs:element name="Message" type="xs:string">
                            <xs:annotation>
                                <xs:documentation>Optional message sent
in.</xs:documentation>
                            </xs:annotation>
                    </xs:element>
                </xs:sequence>
            </xs:complexType>
            <xs:complexType name="HelloWorldReply">
                <xs:annotation>
                    <xs:documentation>Stuff in reply that client will
see.</xs:documentation>
                </xs:annotation>
                <xs:sequence>
                    <xs:element name="Message" type="xs:string">
                        <xs:annotation>
                            <xs:documentation>Message from the web
service..</xs:documentation>
                        </xs:annotation>
                    </xs:element>
                </xs:sequence>
            </xs:complexType>
        </xs:schema>
    </types>
    <message name="HelloWorldRequest">
        <part name="HelloWorldRequest" element="ns:HelloWorldRequest"/>
    </message>
    <message name="HelloWorldReply">
        <part name="HelloWorldReply" element="ns:HelloWorldReply"/>
    </message>
    <portType name="HelloWorldPortType">
        <operation name="processHelloWorld"
parameterOrder="ProcessShipmentRequest">
            <input message="ns:HelloWorldRequest"/>
            <output message="ns:HelloWorldReply"/>
        </operation>
    </portType>
    <binding name="HelloWorldServiceSoapBinding"
type="ns:HelloWorldPortType">
        <s1:binding style="document" transport="
http://schemas.xmlsoap.org/soap/http"/>
        <operation name="processHelloWorld">
            <s1:operation soapAction="processHelloWorld" style="document"/>
            <input>
                <s1:body use="literal"/>
            </input>
            <output>
                <s1:body use="literal"/>
            </output>
        </operation>
    </binding>
    <service name="HelloWorldService">
        <port name="HelloWorldServicePort"
binding="ns:HelloWorldServiceSoapBinding">
            <s1:address location="http://localhost:7001/helloworld"/>
        </port>
    </service>
</definitions>

Re: WSDL2Java -generates multiple requests/response classes

Posted by Magnus Lassi <ma...@gmail.com>.
Thank you! Now I understand what I did incorrectly. I have been away from
web services for a long while and haven't used Axis and I'm more familiar
with creating XML Schemas than WSDL so it was kind of hard to analyze what I
did wrong.

It generates correctly after I corrected my WSDL now.

Thanks,
Magnus

On 8/15/07, Lahiru Sandakith <sa...@gmail.com> wrote:
>
> Hi Magnus,
>
> As from your wsdl I have generated the stub via Eclipse Codegen Wizard and
> I am attaching it with this mail.
> It contains 2 Request classes class as HelloWorldRequest and
> HelloWorldRequest1.
>
> The reason for this is your wsdl contains
>
> <xs:element name="HelloWorldRequest" type="ns:HelloWorldRequest"/>
>
> and
>
> <xs:complexType name="HelloWorldRequest">
>                 <xs:annotation>
>                     <xs:documentation>Stuff in request that needs to be
> set.</xs:documentation>
>                 </xs:annotation>
>                 <xs:sequence>
>                     <xs:element name="Version" type="xs:string">
>                            ...................
>             </xs:complexType>
>
> With the same name.
> HTH
>
> Thanks
>
> Lahiru
>
> On 8/10/07, Magnus Lassi <ma...@gmail.com> wrote:
> >
> > Hi all,
> >
> > I am using Axis 2.1.2 and I am trying to generate the stub classes for
> > both the service and client code with WSDL2Java. My problem is that it
> > generates multiple request/response object such as HelloWorldReply,
> > HelloWorldReply1 etc which I assume has to do with my WSDL. I get multiple
> > request/reply classes when I use the Axis2 codegen plugin ( Eclipse 3.3),
> > if I run it from the command line I get three request objects and one reply
> > object.
> >
> > The WSDL validates correctly with the WSDL editor in Eclipse 3.3, as far
> > as I know it's pretty standard type of WSDL, we use it across our company.
> >
> > The commandline parameters looks like this: %AXIS2_HOME%\bin\WSDL2Java
> > -uri HelloWorld.wsdl -p com.acme.ws -d adb -s -wv 1.1 -ss -sd -ssi
> >
> > I would appreciate if anyone has any ideas. I have also included the
> > WSDL I am using below.
> >
> > TIA,
> > Magnus
> >
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <definitions xmlns=" http://schemas.xmlsoap.org/wsdl/" xmlns:ns="
> > http://acme.com/ws/helloworld" xmlns:s1="http://schemas.xmlsoap.org/wsdl/soap/"
> > targetNamespace=" http://acme.com/ws/helloworld"
> > name="HelloWorldServiceDefinitions">
> >     <types>
> >         <xs:schema attributeFormDefault="qualified"
> > elementFormDefault="qualified" targetNamespace="
> > http://acme.com/ws/helloworld" xmlns:xs="http://www.w3.org/2001/XMLSchema
> > ">
> >             <xs:element name="HelloWorldRequest"
> > type="ns:HelloWorldRequest"/>
> >             <xs:element name="HelloWorldReply"
> > type="ns:HelloWorldReply"/>
> >             <xs:complexType name="HelloWorldRequest">
> >                 <xs:annotation>
> >                     <xs:documentation>Stuff in request that needs to be
> > set.</xs:documentation>
> >                 </xs:annotation>
> >                 <xs:sequence>
> >                     <xs:element name="Version" type="xs:string">
> >                             <xs:annotation>
> >                                 <xs:documentation>Identifies the
> > version/level of a service operation expected by a caller (in each request)
> > and performed by the callee (in each reply).</xs:documentation>
> >                             </xs:annotation>
> >                     </xs:element>
> >                     <xs:element name="FullName" type="xs:string">
> >                             <xs:annotation>
> >                                 <xs:documentation>Identifies the name of
> > the guy.</xs:documentation>
> >                             </xs:annotation>
> >                     </xs:element>
> >                     <xs:element name="Message" type="xs:string">
> >                             <xs:annotation>
> >                                 <xs:documentation>Optional message sent
> > in.</xs:documentation>
> >                             </xs:annotation>
> >                     </xs:element>
> >                 </xs:sequence>
> >             </xs:complexType>
> >             <xs:complexType name="HelloWorldReply">
> >                 <xs:annotation>
> >                     <xs:documentation>Stuff in reply that client will
> > see.</xs:documentation>
> >                 </xs:annotation>
> >                 <xs:sequence>
> >                     <xs:element name="Message" type="xs:string">
> >                         <xs:annotation>
> >                             <xs:documentation>Message from the web
> > service..</xs:documentation>
> >                         </xs:annotation>
> >                     </xs:element>
> >                 </xs:sequence>
> >             </xs:complexType>
> >         </xs:schema>
> >     </types>
> >     <message name="HelloWorldRequest">
> >         <part name="HelloWorldRequest" element="ns:HelloWorldRequest"/>
> >     </message>
> >     <message name="HelloWorldReply">
> >         <part name="HelloWorldReply" element="ns:HelloWorldReply"/>
> >     </message>
> >     <portType name="HelloWorldPortType">
> >         <operation name="processHelloWorld"
> > parameterOrder="ProcessShipmentRequest">
> >             <input message="ns:HelloWorldRequest"/>
> >             <output message="ns:HelloWorldReply"/>
> >         </operation>
> >     </portType>
> >     <binding name="HelloWorldServiceSoapBinding"
> > type="ns:HelloWorldPortType">
> >         <s1:binding style="document" transport="
> > http://schemas.xmlsoap.org/soap/http"/>
> >         <operation name="processHelloWorld">
> >             <s1:operation soapAction="processHelloWorld"
> > style="document"/>
> >             <input>
> >                 <s1:body use="literal"/>
> >             </input>
> >             <output>
> >                 <s1:body use="literal"/>
> >             </output>
> >         </operation>
> >     </binding>
> >     <service name="HelloWorldService">
> >         <port name="HelloWorldServicePort"
> > binding="ns:HelloWorldServiceSoapBinding">
> >             <s1:address location="http://localhost:7001/helloworld"/>
> >         </port>
> >     </service>
> > </definitions>
> >
>
>
>
> --
> Thanks
> Lahiru Sandakith
>
> http://sandakith.wordpress.com/
> GPG Key Fingerprint : 8CD8 68E0 4CBC 75CB 25BC  1AB1 FE5E 7464 1F01 9A0F
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Re: WSDL2Java -generates multiple requests/response classes

Posted by Lahiru Sandakith <sa...@gmail.com>.
Hi Magnus,

As from your wsdl I have generated the stub via Eclipse Codegen Wizard and I
am attaching it with this mail.
It contains 2 Request classes class as HelloWorldRequest and
HelloWorldRequest1.

The reason for this is your wsdl contains

<xs:element name="HelloWorldRequest" type="ns:HelloWorldRequest"/>

and

<xs:complexType name="HelloWorldRequest">
                <xs:annotation>
                    <xs:documentation>Stuff in request that needs to be
set.</xs:documentation>
                </xs:annotation>
                <xs:sequence>
                    <xs:element name="Version" type="xs:string">
                           ...................
            </xs:complexType>

With the same name.
HTH

Thanks

Lahiru

On 8/10/07, Magnus Lassi <ma...@gmail.com> wrote:
>
> Hi all,
>
> I am using Axis 2.1.2 and I am trying to generate the stub classes for
> both the service and client code with WSDL2Java. My problem is that it
> generates multiple request/response object such as HelloWorldReply,
> HelloWorldReply1 etc which I assume has to do with my WSDL. I get multiple
> request/reply classes when I use the Axis2 codegen plugin (Eclipse 3.3),
> if I run it from the command line I get three request objects and one reply
> object.
>
> The WSDL validates correctly with the WSDL editor in Eclipse 3.3, as far
> as I know it's pretty standard type of WSDL, we use it across our company.
>
> The commandline parameters looks like this: %AXIS2_HOME%\bin\WSDL2Java
> -uri HelloWorld.wsdl -p com.acme.ws -d adb -s -wv 1.1 -ss -sd -ssi
>
> I would appreciate if anyone has any ideas. I have also included the WSDL
> I am using below.
>
> TIA,
> Magnus
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns="
> http://acme.com/ws/helloworld" xmlns:s1="
> http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://acme.com/ws/helloworld"
> name="HelloWorldServiceDefinitions">
>     <types>
>         <xs:schema attributeFormDefault="qualified"
> elementFormDefault="qualified" targetNamespace="
> http://acme.com/ws/helloworld" xmlns:xs="http://www.w3.org/2001/XMLSchema
> ">
>             <xs:element name="HelloWorldRequest"
> type="ns:HelloWorldRequest"/>
>             <xs:element name="HelloWorldReply" type="ns:HelloWorldReply"/>
>             <xs:complexType name="HelloWorldRequest">
>                 <xs:annotation>
>                     <xs:documentation>Stuff in request that needs to be
> set.</xs:documentation>
>                 </xs:annotation>
>                 <xs:sequence>
>                     <xs:element name="Version" type="xs:string">
>                             <xs:annotation>
>                                 <xs:documentation>Identifies the
> version/level of a service operation expected by a caller (in each request)
> and performed by the callee (in each reply).</xs:documentation>
>                             </xs:annotation>
>                     </xs:element>
>                     <xs:element name="FullName" type="xs:string">
>                             <xs:annotation>
>                                 <xs:documentation>Identifies the name of
> the guy.</xs:documentation>
>                             </xs:annotation>
>                     </xs:element>
>                     <xs:element name="Message" type="xs:string">
>                             <xs:annotation>
>                                 <xs:documentation>Optional message sent
> in.</xs:documentation>
>                             </xs:annotation>
>                     </xs:element>
>                 </xs:sequence>
>             </xs:complexType>
>             <xs:complexType name="HelloWorldReply">
>                 <xs:annotation>
>                     <xs:documentation>Stuff in reply that client will
> see.</xs:documentation>
>                 </xs:annotation>
>                 <xs:sequence>
>                     <xs:element name="Message" type="xs:string">
>                         <xs:annotation>
>                             <xs:documentation>Message from the web
> service..</xs:documentation>
>                         </xs:annotation>
>                     </xs:element>
>                 </xs:sequence>
>             </xs:complexType>
>         </xs:schema>
>     </types>
>     <message name="HelloWorldRequest">
>         <part name="HelloWorldRequest" element="ns:HelloWorldRequest"/>
>     </message>
>     <message name="HelloWorldReply">
>         <part name="HelloWorldReply" element="ns:HelloWorldReply"/>
>     </message>
>     <portType name="HelloWorldPortType">
>         <operation name="processHelloWorld"
> parameterOrder="ProcessShipmentRequest">
>             <input message="ns:HelloWorldRequest"/>
>             <output message="ns:HelloWorldReply"/>
>         </operation>
>     </portType>
>     <binding name="HelloWorldServiceSoapBinding"
> type="ns:HelloWorldPortType">
>         <s1:binding style="document" transport="
> http://schemas.xmlsoap.org/soap/http"/>
>         <operation name="processHelloWorld">
>             <s1:operation soapAction="processHelloWorld"
> style="document"/>
>             <input>
>                 <s1:body use="literal"/>
>             </input>
>             <output>
>                 <s1:body use="literal"/>
>             </output>
>         </operation>
>     </binding>
>     <service name="HelloWorldService">
>         <port name="HelloWorldServicePort"
> binding="ns:HelloWorldServiceSoapBinding">
>             <s1:address location="http://localhost:7001/helloworld"/>
>         </port>
>     </service>
> </definitions>
>



-- 
Thanks
Lahiru Sandakith

http://sandakith.wordpress.com/
GPG Key Fingerprint : 8CD8 68E0 4CBC 75CB 25BC  1AB1 FE5E 7464 1F01 9A0F