QuoteClient.jws Sample
Demonstrates the ability to modify a Service control's CTRL file to change the Java signature of one or more methods while still adhering to the public contract of the called web service. QuoteServiceControl.ctrl was originally generated form the QuoteService.jws web service. But one method in QuoteServiceControl.ctrl has had a parameter removed and replaced with a hard-coded value in the accompanying XML map. Thus, the outgoing XML message is the same, but the Java signature visible to clients of the Service control is simplified.
Use of a Service control
Customization of a Service control
Declaration and use of a client callback
Use of Conversations
This sample is located in the service folder of the samples WebLogic Workshop project. In the file system the location is:
BEA_HOME\weblogic700\samples\workshop\applications\samples\service\QuoteClient.jws
To run this web service:
Start WebLogic Server in the appropriate domain.
On Microsoft Windows systems, from the Start menu navigate to:
BEA WebLogic Platform 7.0->WebLogic Workshop->WebLogic Workshop Examples->Start Examples Server.
On Linux or Solaris systems, run:
BEA_HOME/weblogic700/samples/workshop/startWebLogic.sh
Launch the service either by opening it in WebLogic Workshop and selecting the Start operation or by entering http://localhost:7001/samples/service/QuoteClient.jws in the address bar of your browser. If WebLogic Server is running in the appropriate domain on this machine, you may click here to run the sample.
Navigate to the Test Form tab of Test View, if necessary.
Enter a value for tickerSymbol (BEAS, of course) and invoke the getQuote method.
QuoteClient then calls the getQuote method of QuoteService, via the QuoteServiceControl Service control, which will return a price quote for the specified ticker symbol.
Running this sample isn't the interesting aspect of it. If you examine QuoteService.jws, you will see that its getQuote method expects two parameters. But QuoteClient is calling the method with a single parameter. This is accomplished via an XML map on the QuoteServiceControl Service control.
QuoteServiceControl.ctrl was originally generated from QuoteService.jws. It was then modified: the first parameter of getQuote was removed from the Java signature, meaning callers are no longer expected to pass it. An XML map was then added to getQuote, with the value of the <customerID> element hard-coded. This leaves the message shape as QuoteService expects it, with two parameters. The calling service passes one parameter, which the Service control combines with the hard-coded parameter to produce the two-parameter message the target service expects.
Controls: Using Resources from a Web Service
Service Control: Using Another Web Service
Customizing a Service Control: Defining Java to XML Translation with XML Maps
Maintaining State with Conversations