Working with Web Services - Developing Web Services
(Page 4 of 9 )
WebLogic Workshop fully supports creating and using Web services. With Workshop, you can create Web services from scratch or extend an existing Web service. Workshop also supports creating control wrappers around existing Web services, whether they were created with Workshop or exist outside WebLogic Server.
To create a Web service, follow the steps shown in Figure 9.3:
Select the folder where the Web service will be created.
Choose File, New, Web Service from the WebLogic Workshop menu.
In the New File dialog box, enter a filename for the Web service and click Create.
From a Workshop development perspective, Web services look much like controls. Web services have methods, can support callbacks, and can use other controls, EJBs, or J2EE services. You can add methods simply by dragging them from the Data Palette, as you would with a control or Page Flow.
Exposing Web Services Beyond Workshop Web services are typically created to make a service or an interface available to the outside world. WebLogic Workshop Web services are no different, and external Web service consumers can easily use them.
Examine the creditServices Web service, which the Wonderland Casino requires to support checking a player's credit limit. creditServices supports the checklimit method, which takes a string name and a bet in the form of an integer and returns true or false, depending on whether the player's bet is within his or her limit. Table 9.1 lists some of the more important components created for the creditServices Web service.

Figure 9.3 -- Creating Web services.
Table 9.1 Web Services Components
Component | Example | Description |
Overall URL | http://localhost:7001/ CasinoServicesWS/support/ creditServices.jws | The URL to the service's main page. All Web services automatically generate a set of JSP pages in support of using the Web service. The URL is created from the URL of the running instance of Workshop and the path to the Web service. |
WSDL | http://localhost:7001/ CasinoServicesWS/ support/creditServices.jws?WSDL | A complete WSDL description of the Web service, which external clients can use to access the service. Note that for Web services that provide callbacks, two sets of WSDL are supplied, one with and one without callback definitions. |
Support JARs | creditServices.jar and webservicesclient.jar | Client support JAR files that can be used standalone Java clients to call the Web service as though it were a local class. |
Support pages | Overview, Console, Test Form, and Test XML | Workshop generates a set of JSP pages containing support for the Web services. The Overview page provides downloadable client JAR files, WSDL, and so on. Test Form provides a simple JSP with entries for each method of the Web service. The Test XML page is a example of the XML used to call service methods. |
The target-namespace Property - By default, newly created Web services do not have a defined namespace. For those unfamiliar with the concept of namespaces, simply consider them as a way to control name collisions. Typically, a namespace is defined by using the Web name of the entity that has developed the service (for example, http://www.samspublishing.com), followed by details of the service. For example, you could use the namespace http://www.samspublishing.com/81kickstart/casino/supportservices as the target namespace of the Web service to ensure that no other services with the same name will be confused with yours.
This chapter is from BEA WebLogic Workshop 8.1, by Albert J. Saganich, Jr., et al. (Sams, 2004, ISBN: 0-672-32622-1). Check it out at your favorite bookstore today.
Buy this book now. |
Next: Using Web Services Within Workshop Applications >>
More Graphic Design Articles
More By Albert J. Saganich, Jr.