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 Xinjun Chen <xj...@gmail.com> on 2007/04/19 05:58:49 UTC

[Axis2] Eclipse Plugin for Code Gen

Hi all,

I have tried using Eclipse Plugin to generate WSDL from Java. It is very
easy to use. But I have that I have no way to specify the service style. If
I want to make a RPC literal style WSDL, can I still use the plugin or must
I turn to the Java2WSDL command line tool?

Regards,
Xinjun

Re: [Axis2] Eclipse Plugin for Code Gen

Posted by Xinjun Chen <xj...@gmail.com>.
Hi all,

I have tried to generate an RPC style WSDL by the following command:

Java2WSDL.bat -cn com.sns.pay.wiz.ejb.WIZEpaymentCLCreditCardProcessor -sn
EPaymentService -st rpc -u literal -o ..\wsdl

First observation:

I have a method "*public int add(int a, int b) throws RemoteException*" in
the Java class.
When I look at the generated WSDL, the corresponding part is as follows:

 <wsdl:types>
  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:ns0="http://util.pay.sns.com/xsd"
   attributeFormDefault="qualified" elementFormDefault="qualified"
   targetNamespace="http://ejb.wiz.pay.sns.com/xsd">
   *<xs:element name="add">*
    <xs:complexType>
     <xs:sequence>
      <xs:element name="a" nillable="true"
       type="xs:int" />
      <xs:element name="b" nillable="true"
       type="xs:int" />
     </xs:sequence>
    </xs:complexType>
   </xs:element>
   <xs:element name="addResponse">
    <xs:complexType>
     <xs:sequence>
      <xs:element name="return" nillable="true"
       type="xs:int" />
     </xs:sequence>
    </xs:complexType>
   </xs:element>
 </xs:schema>
</wsdl:types>

 <wsdl:message name="addMessage">
  *<wsdl:part name="part1" element="ns:add" />
* </wsdl:message>
 <wsdl:message name="addResponseMessage">
  <wsdl:part name="part1" element="ns:addResponse" />
 </wsdl:message>

 <wsdl:portType name="EPaymentServicePortType">
  <wsdl:operation name="add">
   <wsdl:input message="axis2:addMessage" />
   <wsdl:output message="axis2:addResponseMessage" />
   <wsdl:fault message="axis2:addFault" name="addFault" />
  </wsdl:operation>
 </wsdl:portType>

 <wsdl:binding name="EPaymentServiceSOAP11Binding"
  type="axis2:EPaymentServicePortType">
*  <soap:binding
transport="**http://schemas.xmlsoap.org/soap/http*<http://schemas.xmlsoap.org/soap/http>
*"
   style="rpc" />
  <wsdl:operation name="add">
   <soap:operation soapAction="urn:add" style="rpc" />
*   <wsdl:input>
    <soap:body use="literal"
     namespace="http://ejb.wiz.pay.sns.com" />
   </wsdl:input>
   <wsdl:output>
    <soap:body use="literal"
     namespace="http://ejb.wiz.pay.sns.com" />
   </wsdl:output>
   <wsdl:fault name="addFault">
    <soap:body use="literal"
     namespace="http://ejb.wiz.pay.sns.com" />
   </wsdl:fault>
  </wsdl:operation>
 </wsdl:binding>


I don't think this is the correct RPC style WSDL. Instead, this is exactly
the document literal wrapped style!
But the following highlighted lines will mislead other SOAP toolkit which
takes RPC style seriously.

*  <soap:binding
transport="**http://schemas.xmlsoap.org/soap/http*<http://schemas.xmlsoap.org/soap/http>
*"
   style="rpc" />
  <wsdl:operation name="add">
   <soap:operation soapAction="urn:add" style="rpc" />

*
The expected RPC literal style WSDL reads as follows:
 <wsdl:message name="addMessage">
  *<wsdl:part name="a" type="xs:int" />*
*  <wsdl:part name="b" type="xs:int" />
* </wsdl:message>

By scanning through the source in org.apache.ws.java2wsdl.Java2OMBuilder, it
can be seen that currently if style is not set from the user, Java2OMBuilder
will set it as "document", and the same with use. However, even if the style
and use are set, all the message generation still assumes document/literal
wrapped style.

RPC literal is still WS-I Basic Profile compliant. Will Axis2 Java2WSDL
support RPC literal in the future?


Second observation:

I also notice the following element in the generated WSDL.

   <xs:element *name="addFault"*>
    <xs:complexType>
     <xs:sequence>
      <xs:element *name="addFault"* type="xs:anyType" />
     </xs:sequence>
    </xs:complexType>
   </xs:element>

Does this mean that in case of Exception, the fault message will contains
something like <addFault><addFault>some fault string</addFault></addFault>?
The <addFault> is created twice in the WSDL and this will cause the SOAP
response also contains <addFault> twice.
Is it possible for Axis2 to generate the first level element as <xs:element
*name="addFault" type="xs:anyType"*>?

The same wrapping problem occurs for the subtract method, where the
signature reads "*int subtract(Subtract request) throws RemoteException*".

class Subtract implements Serializable{
 private static final long serialVersionUID = -7705832414279713905L;
 private int a;
 private int b;
 ... // getters and setters
}

The generated code is as follows:

   <xs:element name="subtractFault">
    <xs:complexType>
     <xs:sequence>
      <xs:element name="subtractFault"
       type="xs:anyType" />
     </xs:sequence>
    </xs:complexType>
   </xs:element>
   <xs:element name="subtract">
    <xs:complexType>
     <xs:sequence>
      <xs:element name="request" nillable="true"
       type="ns:Subtract" />
     </xs:sequence>
    </xs:complexType>
   </xs:element>
*   <xs:element name="Subtract" type="ns:Subtract" />*
   <xs:complexType name="Subtract">
    <xs:sequence>
     <xs:element name="a" type="xs:int" />
     <xs:element name="b" type="xs:int" />
    </xs:sequence>
   </xs:complexType>
   <xs:element name="subtractResponse">
    <xs:complexType>
     <xs:sequence>
      <xs:element name="return" nillable="true"
       type="xs:int" />
     </xs:sequence>
    </xs:complexType>
   </xs:element>

Why is the highlighted element *   <xs:element name="Subtract"
type="ns:Subtract" /> *generated?
This element is not referenced at all. In my opinion, the java class
Subtract should cause the generation of a complexType Subtract only, but no
Subtract element should be generated.


Regards,
Xinjun



On 4/19/07, Xinjun Chen <xj...@gmail.com> wrote:
>
> Hi Lahiru,
>
> Thanks for your responsive answer.
>
> But from the following link, it seems that we can specify service style
> http://people.apache.org/~thilina/axis2/docs/reference.html
> However, the reference guide does not tell the possible options.
>
> I will try it and revert here.
>
> Regards,
> Xinjun
>
>
> On 4/19/07, Lahiru Sandakith <sa...@gmail.com> wrote:
> >
> > Hi Xinjun,
> >
> > On 4/19/07, Xinjun Chen <xjchen001@gmail.com > wrote:
> > >
> > > Hi all,
> > >
> > > I have tried using Eclipse Plugin to generate WSDL from Java. It is
> > > very easy to use.
> > >
> >
> >  send feedback if you have any suggestion to make it more easy to use.
> >
> >
> >  But I have that I have no way to specify the service style. If I want
> > > to make a RPC literal style WSDL, can I still use the plugin or must I turn
> > > to the Java2WSDL command line tool?
> > >
> >
> > AFAIK  , currently java2wsdl functionality do not have the facility to
> > do this. So the tools wrapping around that also have that restriction. Its
> > an improvement that we need to do. Just pitting the value on style won't do.
> >
> >
> >
> > Thanks
> >
> > Lahiru
> >
> >
> >  Regards,
> > > Xinjun
> > >
> >
> >
> >
> > --
> > Regards
> > Lahiru Sandakith
>
>
>

Re: [Axis2] Eclipse Plugin for Code Gen

Posted by Xinjun Chen <xj...@gmail.com>.
Hi Lahiru,

Thanks for your responsive answer.

But from the following link, it seems that we can specify service style
http://people.apache.org/~thilina/axis2/docs/reference.html
However, the reference guide does not tell the possible options.

I will try it and revert here.

Regards,
Xinjun


On 4/19/07, Lahiru Sandakith <sa...@gmail.com> wrote:
>
> Hi Xinjun,
>
> On 4/19/07, Xinjun Chen <xj...@gmail.com> wrote:
> >
> > Hi all,
> >
> > I have tried using Eclipse Plugin to generate WSDL from Java. It is very
> > easy to use.
> >
>
>  send feedback if you have any suggestion to make it more easy to use.
>
>
>  But I have that I have no way to specify the service style. If I want to
> > make a RPC literal style WSDL, can I still use the plugin or must I turn to
> > the Java2WSDL command line tool?
> >
>
> AFAIK  , currently java2wsdl functionality do not have the facility to do
> this. So the tools wrapping around that also have that restriction. Its an
> improvement that we need to do. Just pitting the value on style won't do.
>
>
> Thanks
>
> Lahiru
>
>
>  Regards,
> > Xinjun
> >
>
>
>
> --
> Regards
> Lahiru Sandakith

Re: [Axis2] Eclipse Plugin for Code Gen

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

On 4/19/07, Xinjun Chen <xj...@gmail.com> wrote:
>
> Hi all,
>
> I have tried using Eclipse Plugin to generate WSDL from Java. It is very
> easy to use.
>

 send feedback if you have any suggestion to make it more easy to use.

But I have that I have no way to specify the service style. If I want to
> make a RPC literal style WSDL, can I still use the plugin or must I turn to
> the Java2WSDL command line tool?
>

AFAIK  , currently java2wsdl functionality do not have the facility to do
this. So the tools wrapping around that also have that restriction. Its an
improvement that we need to do. Just pitting the value on style won't do.

Thanks

Lahiru

Regards,
> Xinjun
>



-- 
Regards
Lahiru Sandakith