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 Arnout Engelen <ar...@bzzt.net> on 2007/01/25 13:56:46 UTC

[Axis1.4] java2wsdl and generics

Hi,

I thought it'd be neat to have a common base type for all my return 
value types, containing an 'error type', 'error message', and optionally 
the returned value. My first stab was (simplified for brevity&clarity):

public class WsResult
{
  public Integer errorCode;
  public String errorString;
}
public class WsResultValue<T> extends WsResult
{
  public T value;
}

Now when I create an interface that returns a WsResultValue<Foo>, it 
seems java2wsdl ignores the 'Foo' and simply generates:

   <complexType name="WsResultValue">
    <complexContent>
     <extension base="tns1:WsResult">
      <sequence>
       <element name="value" nillable="true" type="xsd:anyType"/>
      </sequence>
     </extension>
    </complexContent>
   </complexType>
(...)
   <wsdl:message name="getFooResponse">
      <wsdl:part name="getFooReturn" type="tns1:WsResultValue"/>
   </wsdl:message>

Ideally, of course, a 'WsResultValue<Foo>' would be generated. Failing 
that, I'd be quite satisfied with anyType as type for the value, as long 
as a complexType for Foo is also generated in the wsdl.

Would either of this be possible to achieve with limited effort? How? 
Any other elegant solutions to this problem? Should I just make a "class 
WsFooResult extends WsResult" for each type I want to be able to return?

I'd prefer not to be required to change the wsdl after running 
java2wsdl, as we currently simply change the Java files and then run 
java2wsdl and wsdl2java to update the webservice.


Kind regards,

Arnout

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org