In this step, you will use WebLogic Workshop to create a simple, synchronous web service called the Investigate web service. You will also deploy and run Investigate on WebLogic Server.
The tasks in this step are:
...on Linux
If you are using a Linux operating system, follow these instructions.
$HOME/bea/weblogic81/workshop/Workshop.sh
sh Workshop.sh
Once you have created a new web service tutorial application, you must ensure that WebLogic Server is running while you build your web service.
You can confirm whether WebLogic Server is running by looking at the status bar at the bottom of WebLogic Workshop. If WebLogic Server is running, a green ball is displayed as pictured below.
If WebLogic Server is not running, a red ball is displayed, as pictured below.
If you see the red ball in the status bar, then follow the instruction below to start WebLogic Server.
Note: On the Start up Progress dialog, you may click Hide and continue to the next task.
Web services expose their functionality through methods, methods that clients invoke when they want to request something from the web service. In this case, clients will invoke a method to request credit reports. The service you are building will eventually collect credit information from other sources. But for now, to keep things simple, you will provide a method that returns a simple report immediately.
Note: If you switched from WebLogic Workshop to another application (for example, to read this topic), the method name may no longer be available for editing. To re-open it for editing, right-click its name, select Rename, type requestCreditReport, and then press Enter.
In this task you will complete the requestCreditReport method by adding a parameter and a return value.
/** * @common:operation */ public String requestCreditReport(String taxID) { return "Applicant " + taxID + " is approved."; }As you can see, this is not a very interesting credit evaluation process. In the next step of the tutorial, you will implement a more precise evaluation process.
As it is now written, the requestCreditReport method works like this: the client invokes the method by supplying a tax identification number, the method then immediately returns a String to the client saying that the applicant with the supplied tax identification number was approved.
Before you go on to test your web service, click the Design View tab.
The long blue arrow indicates that the requestCreditReport method is an
operation: a method of your web service that is exposed to clients. (The
long blue arrow is the graphical equivalent of the Javadoc annotation
@common:operation.)
The white arrow pointing to the right indicates that the
requestCreditReport method takes one or more parameters. In this case, the
requestCreditReport takes one parameter: the String taxID.
The white arrow pointing to the left indicates that the method returns some data. In this case, the method returns the String value "Applicant " + taxID + " is approved."
You can test and debug code with the Workshop Test Browser, a browser-based tool through which you can call methods of your web service.
The browser refreshes to display a summary of your request parameters and your service's response, as shown here:
Under Service Request, the summary displays the essence of what was sent by the client (= you) when the method was called. It shows the parameter values passed with the method call, as in the following example:
taxID = 123456789
Under Service Response, the summary displays what was returned by the Investigate web service. The response is formatted as a fragment of Extensible Markup Language (XML), this is the payload of the SOAP message returned by the web service.
To the left of the request and response is the Message Log area. This area lists a separate entry for each test call to the service method. Entries in the Message Log correspond to your service's methods, updating with a new entry for each test you make.
To try this out, click the Test operations link to return to the original Test Form page, then enter a new value in the string taxID box and click requestCreditReport. When the page refreshes, request and response data corresponding to your second test is displayed as a second entry in the Message Log. You can click each log entry to view the data for the corresponding test. Click Clear Log to empty the list of log entries and start fresh.