axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anil VVNN <>
Subject [Axis2] Best way to handle Axis generated code
Date Thu, 12 Apr 2007 16:04:17 GMT


Now I understand that editing the generated files from wsdl2java is not a
good practice with the exception of skeleton code. Because if you change
wsdl in future you got to generate java files (wrapper objects) again which
will not contain changes I did manually so I got to put that code manually
again and its not a good design practice. 

So, now I have a design issue, I want to implement Strategy pattern in my
service piece .Here is the problem description, 

1) My service is using ADB framework and I have a requirement for a client
to send POJO to service end. So, here I have an interface and implementation

Transporter (Interface) --> ABCTransporter (Implementation class) under
package name "service" 
So, class names are com.service.Transporter and com.service.ABCTransporter 

Basically these classes have getters and setters (i.e. POJO) and I want to
pass this object (ABCTransporter) from client (Java SOAP client) to server

Here is the WSDL code, 

     <element name="MessageRequest"> 
                  <element name="transporter" nillable="true"
      <complexType abstract="true" name="Transporter"/> 
        <complexType name="ABCTransporter"> 
              <extension base="tns:Transporter"> 
                                <element name="StartDate" nillable="true"
                                <element name="EndDate" nillable="true"
    <wsdl:message name="addRequest"> 
                <wsdl:part name="part1" element="tns:MessageRequest"/> 

2) Now WSDL2Java creates wrapper objects on these message transport objects
which will create under package called "webservice" i.e.
com.webservice.Transporter and com.webservice.ABCTransporter 

3) Now at the service end when the request comes in, it will receive
com.webservice.ABCTransporter thats what client is sending 

        com.webservice.Transporter transporter =
(com.webservice.Transporter) msgRequest.getTransporter(); 
         //The following condition determines if the request is from ABC or
         if (transporter instanceof com.webservice.ABCTransporter) { 

The above line is the problem with if condition, how could I get rid off if
and else conditions, can I use Strategy pattern but again I have no control
over com.webservice.Transporter & com.webservice.ABCTransporter classes as
these are generated by wsdl2java tool on top of my domain classes
com.service.Transporter & com.service.ABCTransporter 

Any ideas. Thanks. 

- Anil 

View this message in context:
Sent from the Axis - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message