views:

36

answers:

1

I have a set of different interfaces and I need to give them access via web services.

I have implemented this task in .NET as follows: dynamically generated interface implementation on the IL, marked methods with WebMethod annotation, and in *.asmx handler called generated stub.

More needs to be able to change the method signatures (eg change the type of certain argument or add new arguments), ie not always explicitly implement an interface, and use it as a decorator pattern.

Example:

interface ISomeService { 
  void simpleMetod (String arg1); 
  void customMetod (CusomType arg1, Integer arg2); 
}

// Need to dynamically generate such class 
@WebService 
class SomeWebService {
  private ISomeService someService = new SomeServiceImpl (); 

  @WebMethod 
  public void simpleMethod (String arg1) {
    someService.simpleMethod (arg1); 
  }

  @WebMethod 
  public void customMethod (String arg1, Integer arg2) {
    someService.customMethod (CusomType.fromString (arg1), arg2); 
  }
}

Interfaces such as ISomeService quite a lot. And manually write code like this I don't want.

I work with Java recently, what technology/libraries should be used to solve such task.

Thanks.

A: 

You can use Axis2 to create a deployable archive out of Java service class (without annotations) and service descriptor.

Superfilin