开发者

Dynamic WebService implementation

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 
cl开发者_StackOverflow中文版ass 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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜