开发者

J2EE web service provider and consumer, must be in same EAR?

A method in one EJB will call a Web service in another EJB. Do they need to be packaged in the same EAR, or can I deploy the Web service provider separately (in a WAR)? Will dependency injection (accomplished through @WebServiceRef annotation) work if the two EJBs are deployed separat开发者_开发百科ely?

Thanks!


Do they need to be packaged in the same EAR, or can I deploy the Web service provider separately (in a WAR)?

That depends on how you intend to deploy the EJBs. If you are deploying them in the same EAR file, and therefore, in the same container, I would consider the @WebServiceRef annotation to be pointless and a drag on performance. You might as well inject the other EJB instead of injecting a JAX-WS proxy in it's place.

If you want to separate these out and deploy one of the EJBs (the one providing the webservice) in a WAR file, then it is possible to do so in a Java EE 6 container.

Will dependency injection (accomplished through @WebServiceRef annotation) work if the two EJBs are deployed separately?

Yes, dependency injection will work as long as you have deployed the client in a managed environment (this includes application client containers, web containers and EJB containers). As far as the client EJB is concerned, the container will provide a proxy for the web-service at runtime. All calls will be delegated to the proxy, that will make the required HTTP requests to the actual web-service, and return the appropriate objects after processing the response.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜