QuoteClient.jws Sample

Demonstrates the ability to modify a Web Service control's JCX file to change the Java signature of one or more methods while still adhering to the public contract of the called web service. QuoteServiceControl.jcx was originally generated form the QuoteService.jws web service. But one method in QuoteServiceControl.jcx 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 Web Service control is simplified.

Concepts Demonstrated by this Sample

Location of Sample Files

This sample is located in the service folder of the WebServices project in the SamplesApp sample application. In the file system the location is:

BEA_HOME\weblogic81\samples\workshop\SamplesApp\WebServices\service\QuoteClient.jws

To Run the Sample

  1. Start WebLogic Server in the appropriate domain.
  2. Launch the service either by opening it in WebLogic Workshop and selecting the Start operation or by entering http://localhost:7001/WebServices/service/QuoteClient.jws in the address bar of your browser. If WebLogic Server is running in the appropriate domain on this machine and you have deployed the SamplesApp sample application, you may click here to run the sample.
  3. Navigate to the Test Form tab of Test View, if necessary.
  4. Enter a value for tickerSymbol (BEAS, of course) and invoke the getQuote method.
  5. QuoteClient then calls the getQuote method of QuoteService, via the QuoteServiceControl Web 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 Web Service control.

QuoteServiceControl.jcx 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 Web Service control combines with the hard-coded parameter to produce the two-parameter message the target service expects.

Related Topics

Using WebLogic Built-In Controls

Web Service Control

Defining Java to XML Translation with XML Maps

Designing Conversational Web Services

Using Callbacks to Notify Clients of Events

JwsContext Interface

Test View