4-6 Programming Advanced Features of JAX-WS Web Services for Oracle WebLogic Server
Return a canned string indicating the response was not received synchronously. Client needs to invoke the servlet again to get
the response. res.getWriter.writeWaiting for response...;
Best Practice: Explicitly close client instances when processing is complete. If not closed, the port will be closed automatically when it goes out of scope.
This will force the termination of the RM sequence we created when sending the first doSomething request. For a better way to handle this, see
Section 5.11, Grouping Messages into Business Units of Work Batching. NOTE: Even though the port is closed explicitly or even if it goes out of scope
the reliable request sent above will still be delivered under the scope of the client ID used. So, even if the service endpoint
is down, RM retries the request and delivers it when the service endpoint available. The asynchronous resopnse will be delivered as if the port instance was
still available. java.io.CloseableanotherPort.close;
} Override
public void destroy { try {
Best Practice: Explicitly close client instances when processing is complete. Close the singleton port created during initialization. Note, the asynchronous
response endpoint generated by creating _singletonPort remains published until our container Web application is undeployed.
java.io.Closeable_singletonPort.close; Upon return, the Web application is undeployed, and our asynchronous
response endpoint is stopped unpublished. At this point, the client ID used for _singletonPort will be unregistered and will no longer be
visible from the Administration Console and WLST. } catch Exception e {
e.printStackTrace; }
} }
4.2 Roadmap for Developing Reliable Web Services
Table 4–2 provides best practices for developing reliable Web services. For best
practices when accessing reliable Web services from behind a firewall, see Section 4.3,
Roadmap for Accessing Reliable Web Services from Behind a Firewall MakeConnection.
Roadmap for Developing Reliable Web Services and Clients 4-7
4.3 Roadmap for Accessing Reliable Web Services from Behind a Firewall MakeConnection
Table 4–3 provides best practices for accessing reliable Web services from behind a
firewall using MakeConnection. These guidelines should be used in conjunction with the general guidelines provided in
Section 4.2, Roadmap for Developing Reliable Web Services
and Section 2.2, Roadmap for Developing Asynchronous Web Service
Clients.
Table 4–2 Roadmap for Developing Reliable Web Services
Best Practice Description
Set the base retransmission interval to a realistic value for your particular
scenario. For more information, see
Section 5.7.4, Configuring the Base Retransmission Interval.
Set the acknowledgement interval to a realistic value for your particular
scenario. The recommended setting is two times the nominal interval between
requests. For more information, see Section 5.7.9, Configuring the
Acknowledgement Interval. Set timeouts inactivity and sequence
expiration to realistic values for your particular scenario.
Consider the following:
■
For very short-lived exchanges, the default timeouts may be too long and sequence state might be maintained longer than necessary.
■
Set timeouts to two times the expected lifetime of a given business unit of work. This allows the sequence to live long enough
For more information, see Section 5.7.7, Configuring Inactivity Timeout
and Section 5.7.6, Configuring the Sequence Expiration.
Use an reliable messaging policy that reflects the minimum delivery
assurance or quality of service required.
By default, the delivery assurance is set to Exactly Once, In Order. If you do not require ordering, it can increase performance to set the delivery
assurance to simply Exactly Once. Similarly, if your service can tolerate duplicate requests, delivery assurance can be set to At Least Once.
For more information about delivery assurance for reliable messaging, see
Table 5–1, Delivery Assurances for Reliable Messaging and
Section 5.4, Creating the Web Service Reliable Messaging WS-Policy File.
4-8 Programming Advanced Features of JAX-WS Web Services for Oracle WebLogic Server
4.4 Roadmap for Securing Reliable Web Services