Sample Web Services

The following sample web services are provided with WebLogic Workshop. They are located in the samples project, which is the default project when you start WebLogic Workshop for the first time.

Follow the links below for more detailed information on each sample, including instructions for running the sample.

# Topics Included in This Section

AccountEJBClient.jws

A web service that demonstrates use of an EJB control (AccountEJBControl.ctrl), which represents the AccountEJB Entity Bean and exposes its business interface to web services. This sample is not related to AccountPublish.jws and AccountSubscribe.jws.

AccountPublish.jws

A web service that demonstrates use of a JMScontrol (AccountPublishJMSControl.ctrl) to publish a message to a JMS topic. This sample is paired with AccountSubscribe.jws, which subscribes to the JMS topic to which AccountPublish.jws publishes. This sample is not related to AccountEJBClient.jws.

AccountSubscribe.jws

A web service that demonstrates use of a JMScontrol (AccountPublishJMSControl.ctrl) to subscribe to a JMS topic. This sample is paired with AccountPublish.jws, which publishes to the JMS topic to which AccountSubscribe.jws subscribes. This sample is not related to AccountEJBClient.jws.

AdvancedTimer.jws

A web service that demonstrates an asynchronous interface to a legacy system (LegacySystem.jws) that does not support asynchrony. It does so by "polling" the legacy system: calling it repeatedly to see if it's done. AdvancedTimer does the polling for the client, invoking a client callback if and when the legacy system responds.

AdvancedTimer uses the @jws:timer timeout= repeats-every= tag.

Buffer.jws

A web service that demonstrates the @jws:message-buffer tag to queue high-traffic requests. Uses a Timer control to delay sending a response back to the client, simulating waiting for a slow back-end service to respond to requests from this web service. The start method is buffered, allowing clients to continue processing immediately after submitting a request.

ConsolidateAddress.jws

A web service that demonstrates use of the ECMAScript language extensions for XML to perform XML mapping using procedural code. An incoming XML document is converted to a different internal Java data structure, then converted back when returned to the client by a subsequent method call. The ECMAScript is in the ConsolidateAddressScript.jsx file. ConsolidateTest.xml is a test document that may be submitted.

ConsolidateAddress uses the <xm:use> XML map tag

Conversation.jws

A web service that demonstrates use of the @jws:conversation tag to control the lifetime of a conversational instance of the web service and provide data persistence.

Conversation.jws implements a synchronous polling interface for the asynchronous HelloWorldAsync web service. A polling interface is necessary if you wish to serve clients that cannot accept asynchronous callbacks due to security arrangements such as firewalls.

Conversations also provide correlation, whereby requests from multiple simultaneous clients are tracked and responses are directed to the right client.

CreditReport.jws

Similar to the Investigate web service developed during Tutorial: Your First Web Service, but more fully developed. Demonstrates use of conversations and Service controls.

CustomerDBClient.jws

A sample that demonstrates use of a database control by managing customer records. CustomerDBClient is a client of CustomerDBControl.ctrl. Together they demonstrate construction of a Database control and use of a Database control by a web service. CustomerDBControl.ctrl demonstrates use of SQL's CREATE, DROP, INSERT, UPDATE, and SELECT statements.

CustomJMSClient.jws

A web service that demonstrates use of a JMS control defined in a CTRL file. CustomJMSClient is a client of the CustomJMSControl.ctrl JMS control.

ExplicitTypes.jws Sample

A web service that demonstrates use of the include-java-types attribute of @jws:paramater-xml and @jws:return-xml to explicitly specify types used in ambiguous situations.

HelloWorld.jws

A very simple web service with a single synchronous method. Illustrates a WebLogic Workshop web service in its simplest form.

HelloWorldAsync.jws

A simple asynchronous web service that illustrates the use of a callback. Uses a Timer control to provide a delay that simulates waiting for a slow back-end service to do some work, then notifies the client of the result via a callback. HelloWorldAsync is used by the Conversation.jws sample, but is also a standalone web service.

InputMapMultiple.jws

Demonstrates the use of an @jws:parameter-xml tag defining an XML map to convert XML input to Java objects, including an indeterminate length list of elements using the <xm:multiple> attribute.

Investigate.jws

This sample represents the state of the Investigate web service after completion of Step 8: Access the Bank Web Service of Tutorial: Your First Web Service.

LuckyNumberDBClient.jws

A sample that uses a database to store players and their lucky numbers. LuckyNumberDBClient uses the LuckyNumber.jws web service to generate random numbers in the range [1,20] inclusive, then checks for winners in a database and returns the number drawn and the list of winners, if any. The database is managed using the LuckyNumberDBControl.ctrl Database control. LuckyNumberDBControl.ctrl creates and manages a PLAYERS table in the database and implements queries against it. Demonstrates using SQL's CREATE , INSERT, SELECT and DROP statements in a database control.

OutputMap.jws

Demonstrates use of the @jws:return-xml tag and implicit <xm:value> tags to convert Java objects to elements in an XML document that is returned to the web service's caller.

OutputScriptMap.jws

A web service that demonstrates use of the ECMAScript language extensions for XML to perform XML mapping using procedural code. A Java object returned by a web service method is converted to a different XML structure in the outgoing message. The ECMAScript is in the PersonScript.jsx file.

QuoteClient.jws

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 from 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.

ServiceFactoryClient.jws

A web service that demonstrates use of a control factory. A control factory provides a way to dynamically manage a collection of instances of a control from a web service.

SimpleJMS.jws

A web service that demonstrates use of a JMS control declared locally in a web service's JWS file.

SimpleMap.jws

A sample showing simple use of a @jws:parameter-xml XML map to convert XML input to Java objects. Uses curly brace "{}" notation as implicit <xm:value> tags.

SimpleTimer.jws

A simple web service that demonstrates use of the Timer control. Uses the @jws:timer timeout= tag.

TraderEJBClient.jws

A web service that demonstrates use of the EJB control TraderEJBControl.ctrl, which represents the TraderEJB Stateless Session Bean and exposes its business interface to web services.

Related Topics

Tutorial: Your First Web Service