Friday, November 30, 2007

Webservices

Using Rational Developer to create a simple Web service and use it in a Web application

Turn EJB components into Web services

Best practices

Here are a few best practices for developing an EJB Web service:

* Avoid overusing Web services in your applications. Examine whether you really need to expose your EJB as a Web service.
* Use a coarse-grained session façade that encapsulates your business logic to be used as a Web service. Avoid exposing all your application's session beans as Web services.
* Examine properly whether you need either RPC-style or document-style Web services. RPC-style Web services are more efficient than document-style Web services. On the contrary, document style is more flexible because you can use schema.
* Make sure you design your Web service so that it creates minimal network traffic.
* Avoid maintaining any kind of state information in your EJB components that you expose as Web services.
* Use JAX-RPC data types as the method parameters for your Web service to give it interoperability with heterogeneous Web services. Avoid types such as Collection, HashMap, and Lists as parameters for your Web service if interoperability is important for your application.
* Many of the conventional best practices for J2EE applications (Web applications) are also relevant to EJB Web services. For example, avoid exposing an EJB component that involves long-running transactions as a Web service.
* Weigh your security requirements against performance, because security comes with a higher cost. The performance costs of end-to-end security are high.

Java Web Services, Part 3: Axis2 Data Binding link


No comments: