O'Reilly logo

Java and SOAP by Robert Englander

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

6.1. Custom Type Encoding

Let's start off by working with a custom data type that uses a nonstandard serialization. We'll develop this example using Apache SOAP. Imagine that we're developing a web service that acts as a pass-thru proxy to a proprietary stock market data feed. We want to send the data to the service already serialized in the form used by the feed. Yep, another contrived example! But by the time we finish it, I bet you'll have thought of a few uses for this technique. The service is designed to allow client applications to pass agreed-upon formats to the downstream data feed service without having to modify the web service itself. So the serialized data format is not known to the web service; it's understood only by the client application and the data feed. Figure 6-1 shows what this architecture might look like. Both of the client applications use the same service and invoke the same methods. However, they may or may not be using the same serialization format for the data to be sent to the data feed.

Figure 6-1. A pass-thru service

Let's say that the default data format for the feed is a linear self-describing format. This format is an arbitrary-length string that contains a variable number of named data fields and their string values. The format can accept from 1 to 9 fields. The first character of the message contains the number of fields, and can be any ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required