We started discussing this a little bit the other day:
http://www.nabble.com/Generics-as-SEI-SEB-to19151067.html
Dan
On Friday 29 August 2008 2:22:22 pm ANTONIO CEBRIAN CHULIA wrote:
> Hi all,
>
> In the project I'm working on we need to create the same Web Service
> again and again in a by-type basis. The functions and the contract the
> interface provides remain the same across all versions only changing the
> main type the interface has to work on. To not overwhelm you I'll put it in
> simpler terms. Let's suppose we are trying to implement a simple WS that
> acts as an echo service, whichever object you send to it, the WS returns it
> back verbatim. It seems logical to use generics in the description, so:
>
> public interface EchoIf<T> {
> public T echo(T in);
> }
>
> so we can instantiate for instance:
>
> @WebService(endpoint="EchoIf")
> public class EchoInteger implements EchoIf<Integer> {
> public Integer echo(Integer in){
> return in;
> }
> }
>
> or
>
> @WebService(endpoint="EchoIf")
> public class EchoString implements EchoIf<String> {
> public String echo(String in){
> return in;
> }
> }
>
> The problem we are facing is that because of the generic in the interface
> the tools like java2wsdl generates a WSDL with a xs:anyType for the method
> parameter and return types. Even if we make the classes implement totally
> specified interfaces like:
>
> public interface EchoIntegerIf extends EchoIf<Integer> {
> }
>
> we still get the xs:anyType in the WSDL wich makes the definition of the
> contract between the WS and the rest of the world not type-bounded.
>
> Has it to be that way? How would you implement this scenario? Are we doing
> something wrong? We don't want to mess specifying the types in XSD and
> wiring it to the WSDL. The solution we are looking for is how to generate
> the WSDL description straightforwardly.
>
>
> Any ideas?
>
> Best regards.
--
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog