views:

119

answers:

1

Here's a scenario:

I have a webservice, let's call this StockQuoteService deployed on tomcat (axis). There is this method getStockQuote() exposed via this webservice.

Now, I would like to build a GUI tool which would build a webservice called StockQuoteServiceEx on the fly. The new webservice would expose the same methods as StockQuoteService. However, when getStockQuote() is invoked on StockQuoteServiceEx, this method act like a webservices client, thereby invoking getStockQuote() on StockQuoteService, obtaining the result from it. The purpose of doing this is in manipulating(data masked/shuffled/encrypted) the original result.

Once the webservice is generated, existing clients would update end points from StockQuoteService to StockQuoteServiceEx. So, the question here is, what would be the steps to dynamically generating a web service on the fly?

+1  A: 

Since your willing to expose the same webservice interface/operations: Wouldn't it be easier to let your GUI tool act as a HTTP proxy and place that tool between the client and the actual webservice? Like:

Client(s) ==> GUI Tool (http proxy) ==> StockQuoteService.

That way the client(s) are build against the WSDL of the actual StockQuoteService, but make use of the endpoint address of the GUI tool. You can implement the HTTP proxy in your GUI tool as a simple Servlet which dispatches the request (after manipulation) to the actual webservice using Apache HTTPClient.

R. Kettelerij
I would beg to differ. Firstly, By having a http proxy act as a middle man, the clients would require a code change (what if I were using a webservices client? It would now need to understand talking to a http proxy?) Secondly, if I were to do it in a client environment, they would not like the idea of extra http proxy servers?
Jay
effectively what is required is a top-down Web Service. The java bean skeleton that is usually generated with help of IDEs, in this scenario, would need to be generated with the code that invokes another webservice and manipulates the result based on a config file.
Jay