Chapter 8. Router solutions using Web Services Gateway 161
8.4 Design guidelines
As the solution was being designed, the following topics were considered.
SOAP messaging style
SOAP provides support for both RPC style Web services and document-style
Web services. In RPC style, Web services are invoked using remote method
calls. In document-style messaging, Web Services are invoked by sending a
complete well-formed document describing the task to be performed, and
possibly, some parametric data.
These are some advantages of SOAP RPC-based Web services:
򐂰 They are simpler to develop than SOAP message-oriented messaging.
򐂰 They use a higher level API.
򐂰 They support strong typing: all calls must conform to the method signature.
The disadvantages of RPC-based SOAP messaging are:
򐂰 Higher coupling between the Web service requester and provider because
the requester to provider binding includes both methods and parameters.
On the other hand, when using document-style Web services, the XML
document is arbitrary. This style is more flexible and can be used to send
one-way messages without needing a response (unlike RPC-style) but involves
more work for the developer.
Prior to the Web Services Gateway provided with IBM WebSphere Application
Server V5.0.2, RPC-style SOAP messages were required. With V5.0.2, support
for document-style messages was added. If you are using the Apache SOAP
Channel, then the SOAP message format must be RPC style. To handle
Document style SOAP messages, use the SOAP/HTTP channel (which supports
both RPC style and Document style SOAP messages). We used the RPC-based
mechanism in our sample solution.
SOAP encoding style
In addition to the messaging style, the SOAP encoding style should be
considered. Message parts can be encoded using encoding rules (“encoded”), or
may reference a concrete schema definition (“literal”).
WS-I has stated a preference for the use of literal, non-encoded XML.
162 Broker Interactions for Intra- and Inter-enterprise
SOAP caching
Using WebSphere Application Server dynamic caching to cache SOAP
messages can significantly reduce the overhead of Web services. A Web service
is a candidate for caching if its requests can be grouped into classes based on
identifiers, and if the Web service's responses do not contain arbitrarily changing
information based on the system state or time.
Caching a SOAP message is not as easy as putting it in a HashMap. You need to
determine what makes two SOAP request identical. Only then can a caching
framework determine when to send a client a cached response instead of letting
the request propagate further into the system.To decide if two SOAP request are
identical, you could have to look at the SOAP Body, or at the SOAP Body and
some combination of SOAP header values.
Message optimization
The performance of an application based on Web services is affected by three
factors:
򐂰 Network transmission time.
򐂰 The time it takes to handle the messages, including XML parsing, flow
management, invocation of the service and the encoding of the final response
򐂰 The time the service itself takes to execute
The two first factors can be improved by optimizing the number, size, and
structure of the messages you use. For example:
򐂰 Don’t pass parameters that you don’t need.
򐂰 Don’t use two or more invocations when you can do the same operation
implementing a more complex service. A good example for this could be:
Instead of repeatedly using an operation that returns the price of a product,
implement a service that returns the price for a list of products.
The third factor can be improved using a good caching system, as discussed
previously.
Security
Security is certainly important in an intra-enterprise environment, but becomes
crucial in an inter-enterprise environment. General security guidelines are:
򐂰 Use https when invoking external services.
The Web Services Gateway can invoke Web services that include https:// in
their addresses, if the Java and WebSphere security properties have been
configured to allow it.

Get Patterns: Broker Interactions for Intra- and Inter-enterprise now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.