This section describes how to create Web services and add them to a Web service collection, and manage existing Web services. See “Exposing Components as Web services” for information about deploying existing components as Web services.
This section describes how to:
Create a Web service from a WSDL file – this bottom-up approach (creating a Web service from the WSDL) allows you to create a Web service from an existing WSDL file.
Create a Web service from a Java file – this top-down approach (creating a Web service from a component) allows you to create a Web service from a Java file.
The Web service can be contained in various projects. See “Web service projects” for more information about projects.
Creating a Web service from a WSDL
From the Web Service container, select File | New | Other.
The New wizard displays. Select Sybase Web Services in the left pane, and Web Service in the right pane. Click Next. You can also create the Web service within a project by selecting Web Service Project. If you do not select a project at this time, you will be asked later to provide a project for the Web service.
The Create Web Service wizard displays. Follow the instructions to create a Web service from a WSDL file. Table 4-3 describes the wizard properties.
Complete the wizard instructions and click Finish to create the Web service. If you choose a Project for this Web service, you can view the project by selecting Window | Show View | Package Explorer. The Projects appear in the right pane. Expand the project and package to view the Web service. Along with a Web service, the wizard generates the other required files, including a .wsdd file.
You can right-click the .wsdd file and then select Deploy to deploy it as a Web service.
Creating a Web service from a Java file
From the Web Service container, select File | New | Other.
The New wizard displays. Select Sybase Web Services in the left pane, and Web Service in the right pane. Click Next. You can also create the Web service within a project by selecting Web Service Project. If you do not select a project at this time, you are asked later to provide a project for the Web service.
The Create Web Service wizard displays. Follow the instructions to create a Web service from a Java file. Table 4-3 describes the wizard properties.
Complete the wizard instructions and click Finish to create the Web service. If you choose a Project for this Web service, you can view the project by selecting Window | Show View | Package Explorer. The Projects appear in the right pane. Expand the project, and package to view the Web service. Along with a Web service, the wizard generates the other required files, including a .wsdd file.
You can right-click the .wsdd file and then select Deploy to deploy it as a Web service.
Window |
Property |
Description |
|---|---|---|
Select the Web Service Project |
Project Type |
Select the project in which you will create a Web service. The project wizard displays only if you choose to create a Web service project. |
Create the Project |
Project Name |
Provide a name for your project. |
|
Project Contents |
Use the Browse button to select the project contents directory that contains your project, or click the check box to use the default directory, which is the project name located in the $Eclipse/workspace directory. |
Select Approach |
Create from WSDL or Create from Java File |
You can create the The Web service from an existing Java file or .wsdl file. Click the appropriate check box. |
If Creating From WSDL |
Locate From a Local File, URL, or UDDI |
Provide the location of the .wsdl file, by entering the file location, URL, or UDDI site. If the file is on the local file system use Browse to locate it. If you are locating the file from a UDDI site, follow the instructions for publishing to a UDDI site as described in Table 4-8. |
Package Name |
The name of the package in which the Web service is created. If you do not enter a package name, “default” is used. |
|
If Creating From Java File |
Create From Java File |
Enter the Java file being used to create the Web service. |
Options |
You can specify various preferences used for you Web service deployment. These options are described in Table 4-6. |
|
Method Selection |
Select the methods/operations to be exposed in the Web service’s WSDL file. |
|
Summary |
A summary of your entries. Verify they are accurate and click Finish, or Back to change your selections. |
The WST development tool allows you to create and maintain various projects that contain collections of Web services, class files, readme files, and so on, that make up a Web service project depending on your need. For example, you can create:
Server projects – generate and contain the server-side files required to deploy a Web service project to the server.
Client projects – generate and contain the client-side files required to deploy a Web service project to the client.
Projects – generate and contain both the server-side and client-side files required to deploy a Web service project to the server and client.
Sybase recommends that when creating projects, you keep the client-side code in a client project and server-side code in a separate server project. This allows you to generate, compile, and maintain the client-side and server-side files, artifacts, and dependent classes independently.
To get an idea of how projects can be used to keep track of your various Web service projects, See “Creating the sample projects and installing the samples”.
This section describes how to use the WST development tool to manage Web services already contained in a server. Each procedure described in this section requires that you first:
Connect to the server that contains the Web service.
Expand the Web Services icon.
Expand the Web service collection to which the Web service belongs.
Viewing the WSDL
Right-click the Web service and then select View WSDL.
The WSDL file for this Web service displays in the right pane. You cannot edit this file.
Activating a Web service
If a Web service is already activated, this option is dimmed; clients can only access a Web service that is activated:
Right-click the Web service and then select Activate.
Deactivating a Web service
If a Web service is already deactivated, this option is dimmed.
Right-click the Web service and then select Deactivate.
Refreshing a Web service
Refresh a Web service if you make any changes to it.
Right-click the Web service and then select Refresh.
Deleting a Web service
Right-click the Web service and then select Delete.
This section describes how to create and manage Web service clients from a Web service. Each procedure requires that you first:
Connect to the server that contains the Web service.
Expand the Web Services icon.
Expand the Web service collection to which the Web service belongs.
The
wizards described in this section generate a test client runtime
JAR file, sybasewstrt.jar, which contains one
file, manifest.mf, that lists the JAR files
required by the runtime client:
When compiling the client class, do not include sybasewstrt.jar. Set the required JARs in the classpath individually.
The classpath should include at a minimum: sybasewstrt.jar, sybasewst.jar, jaxrpc.jar, and the path to the client artifacts.
When running the client, use either the “-classpath” option, or “set classpath” to specify the location of the required files identified by sybasewstrt.jar.
After using the wizard to generate the various files required by the client, see Chapter 9, “Developing Web Service Clients” for a description of how to develop a client.
Creating a Web service client
Right-click the Web service and then select Create Web Service Client.
The Create Web Service Client wizard displays.
Follow the wizard instructions described in Table 4-4. Click Finish when done.
The wizard generates the test client, and necessary client artifacts in the package you specify.
Creating a JSP client
This procedure generates JSP client pages from the Web service and stores them on the server. Once created, you can test the JSP pages by Launching the JSP client.
Right-click the Web service and then select Create JSP client.
Launching a JSP client
This procedure launches the JSP client you created in the proceeding procedure, by starting a Web browser, and running the JSP.
Right-click the Web service and then select Launch JSP Client.
Deleting a JSP client
If you created a JSP client for this Web service, this procedure deletes it.
Right-click the Web service and then select Delete JSP Client.
This section describes how to manage Web service operations (or methods). These procedures require that you:
Expand the Web service collection.
Expand the Web service.
Expand the operations folder.
If you deploy a Web service that contains overloaded methods, the WST development tool displays only the first method of the overloaded method. Allowing or disallowing access to the method, affects all overloaded methods.
For example, if the Web service contains an overloaded method that contains the methods echo(String, String) and echo (String), the GUI displays only echo (String, String) twice, but the allowed/disallowed operation affects both echo(String, String) and echo(String).
Invoking an operation
This procedure invokes an operation of the Web service to which it belongs.
Right-click the operation and then select Invoke.
Allowing an operation
Allowing a Web service operation makes it available to clients. If a Web service operation is already allowed, this option is dimmed.
Right-click the operation and then select Allow.
Disallowing an operation
Prevent access to a Web service operation by following this procedure. If a Web service operation is already disallowed, this option is dimmed.
Right-click the operation and then select Disallow.
Table 4-5 describes the Web service operation properties.
| Copyright © 2005. Sybase Inc. All rights reserved. |
|
|