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

9.3. A Proxy Service Using Apache SOAP

I'm going to use http://mindstrm.com:8004/glue/urn:CorpDataServices as the backend for the services we develop through the rest of this chapter. In this example we'll create an Apache SOAP service called urn:QuoteProxyService that gets its data from the GLUE-based service we've been working with. In other words, this new Apache SOAP service acts as a proxy to the quote retrieval part of the GLUE-based service. This setup is depicted in Figure 9-2.

Figure 9-2. A proxy service

Instead of simply replicating the getQuote() service method from urn:CorpDataServices, let's do something more interesting. After all, we're free to design the proxy service any way we want; the fact that it gets its data from another service is really just an implementation detail. So let's add some value to urn:QuoteProxyService by giving it a method that can handle multiple stock symbols in a single call. This facility would be convenient for client applications that work with multiple stocks at one time. The method name is getQuotes(); it takes a single string array as its parameter. Each element of the array is a stock symbol, and the return value of the method is an array of quotes. The new service doesn't proxy the getHeadlines() method of the urn:CorpDataServices service. There's no real reason for this; I just chose to design my proxy that way.

Once again ...

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