Jax-WS - When implementing a Web Service, can you call another web service like calling any pojo?
Suppose I have the following 2 web service code, I think I can do the following
@WebService
public class WS1 {
@WebMethod
public String hello() {
WS2 ws2 = new WS2();
ws2.method2();
}
@WebService
public class WS2 {
@WebMethod
public String method2() {
//implementation of method2.
}
I've tested and it worked. Now the question is: is there an开发者_开发知识库y side effect or unforeseen consequences that I am not aware of if I do this? Can I call the 2nd web service object like any normal pojo from server side?
that will work in terms of basic code execution. however, the ws2 instance you instantiate will not have any "container managed" stuff done to it. e.g., dependency injection won't work, any transaction/security support for that service will be ignored, etc. in other words, it's probably not what you want to do in the general case.
精彩评论