Steps to Create and Invoke a Reliable Web Service

5-10 Programming Advanced Features of JAX-WS Web Services for Oracle WebLogic Server

5.1.4.4 Failure Scenarios with Non-buffered Reliable Web Services

A non-buffered Web service operates differently than a buffered Web service in that it does not buffer a request to hardened storage before acknowledging it and attempting to process it. A non-buffered Web service will not attempt to reprocess a request if the service logic fails, whereas a buffered Web service will attempt to reprocess the request. In both cases, buffered or non-buffered, any response generated by the Web service will be buffered before it is sent back to the client. A non-buffered Web service may be useful in the following cases: ■ Web service operates against non-transactional resources and should not process any request more than once because rolling back the transaction that dequeued the buffered request cannot roll back the side effects of the non-transactional service. ■ Web service is relatively light weight, and does not take very long to process requests. ■ Web service performance is of paramount importance and risk of losing request or response is acceptable. Non-buffered Web services will not incur the overhead of buffering the request to a store, and thus can deliver better throughput than a buffered Web service. The performance gain is dependent on how much time and resources are required to buffer the requests for example, very large request messages may take significant time and resources to buffer. A non-buffered Web service is operationally similar to a buffered Web service in most failure scenarios. The exceptions are cases where the service RM destination itself fails. For example, in all the RM source failure scenarios described, the behavior is the same for a buffered or a non-buffered Web service RM destination. For non-buffered Web services the failure window is open between the following two points: ■ The request is accepted for processing. ■ The response from the Web service is registered for delivery to the client RM source. If the Web service RM destination fails between these two points, the RM source will assume the request has been successfully processed since it has been acknowledged but will never receive a response, and the request may never have been processed. Carefully consider this failure window before configuring a Web service to run as non-buffered.

5.2 Steps to Create and Invoke a Reliable Web Service

Configuring reliable messaging for a WebLogic Web service requires standard JMS tasks such as creating JMS servers and Store and Forward SAF agents, as well as Web service-specific tasks, such as adding additional JWS annotations to your JWS file. Optionally, you create custom WS-Policy files that describe the reliable messaging capabilities of the reliable Web service if you do not use the pre-packaged ones. If you are using the WebLogic client APIs to invoke a reliable Web service, the client application must run on WebLogic Server. Thus, configuration tasks must be performed on both the source WebLogic Server instance on which the Web service client code is deployed, as well as the destination WebLogic Server instance on which the reliable Web service itself is deployed. Table 5–6 summarizes the steps to create a reliable Web service and a client that invokes an operation of the reliable Web service. The procedure describes how to create the JWS files that implement the Web service and client from scratch; if you Using Web Services Reliable Messaging 5-11 want to update existing JWS files, use this procedure as a guide. The procedure also describes how to configure the source and destination WebLogic Server instances. It is assumed that you have completed the following tasks: ■ You have created the destination and source WebLogic Server instances. You deploy the reliable Web service to the destination WebLogic Server instance, and the client that invokes the reliable Web service to the source WebLogic Server instance. ■ You have set up an Ant-based development environment. ■ You have working build.xml files that you can edit, for example, to add targets for running the jwsc Ant task and deploying the generated reliable Web service. For more information, see Developing WebLogic Web Services in Getting Started With JAX-WS Web Services for Oracle WebLogic Server. For best practices for developing asynchronous and reliable Web services and clients, see Section 4, Roadmap for Developing Reliable Web Services and Clients . Table 5–6 Steps to Create and Invoke a Reliable Web Service Step Description 1 Configure the destination and source WebLogic Server instances. You deploy the reliable Web service to the destination WebLogic Server instance, and the client that invokes the reliable Web service to the source WebLogic Server instance. For information about configuring the destination WebLogic Server instance, see Section 5.3, Configuring the Source and Destination WebLogic Server Instances. 2 Create the WS-Policy file. Optional Using your favorite XML or plain text editor, optionally create a WS-Policy file that describes the reliable messaging capabilities of the Web service running on the destination WebLogic Server. For details about creating your own WS-Policy file, see Section 5.4, Creating the Web Service Reliable Messaging WS-Policy File. Note : This step is not required if you plan to use one of the WS-Policy files that are included in WebLogic Server; see Appendix A, Pre-packaged WS-Policy Files for Web Services Reliable Messaging and MakeConnection for more information. 3 Create or update the JWS file that implements the reliable Web service. This Web service will be deployed to the destination WebLogic Server instance. See Section 5.5, Programming Guidelines for the Reliable JWS File. For examples demonstrating best practices, see Section 4, Roadmap for Developing Reliable Web Services and Clients. 4 Update the build.xml file that is used to compile the reliable Web services. Update your build.xml file to include a call to the jwsc Ant task which will compile the reliable JWS file into a Web service. See Running the jwsc WebLogic Web Services Ant Task in Getting Started With JAX-WS Web Services for Oracle WebLogic Server for general information about using the jwsc task. 5 Compile and deploy the reliable JWS file. Compile the reliable JWS file by calling the appropriate target and deploy to the destination WebLogic Server. For example: prompt ant build-reliableService deploy-reliableService 6 Create or update the Web service client. The Web service client invokes the reliable Web service and will be deployed to the source WebLogic Server. See Section 5.6, Invoking a Reliable Web Service from a Web Service Client . 7 Configure reliable messaging. Optional Configure reliable messaging for the reliable Web service using the Administration Console. The WS-Policy file attached to the reliable Web service provides the initial configuration settings. See Section 5.7, Configuring Reliable Messaging . 8 Implement a reliability error listener. Optional Implement a reliability error listener to receive notifications if a reliable delivery fails. See Section 5.8, Implementing the Reliability Error Listener . 5-12 Programming Advanced Features of JAX-WS Web Services for Oracle WebLogic Server Each of these steps is described in more detail in the following sections. In addition, the following topics are discussed: ■ Section 5.11, Grouping Messages into Business Units of Work Batching —Describes how to group messages into business units of work—also called batching—to improve performance when using reliable messaging. ■ Section 5.12, Client Considerations When Redeploying a Reliable Web Service —Describes client considerations for when you deploy a new version of an updated reliable WebLogic Web service alongside an older version of the same Web service. ■ Section 5.13, Interoperability with WebLogic Web Service Reliable Messaging —Provides recommendations for interoperating with WebLogic Web services reliable messaging.

5.3 Configuring the Source and Destination WebLogic Server Instances