The Web Service wizard assists you in creating a new Web service,
configuring it for deployment, and deploying the Web service to a server.
Once your Web service is deployed, the wizard assists you in generating the
client proxy and sample application to test the Web service. When you have
completed testing, you can publish your Web service to a UDDI Business Registry
using the Export wizard.
Prerequisites:
- Create a dynamic Web project as described in Creating a WebSphere® Server and Web project.
It is strongly suggested that you start the server before running the Web
service wizard since it may take several minutes to start the WebSphere Application
Server depending on the speed of your computer. To start the server, select
it in the Servers view (Window > Show View > Servers),
right-click and click Start.
- Create or import a bean into the Java™ source folder of the Web project. To
import, select the Java Resources: src folder, and from
the file menu select and browse to where your
package is.
To create a Web service from a bean using the IBM® WebSphere JAX-RPC
runtime environment:
- Switch to the J2EE perspective (Window > Open Perspective >
J2EE).
- In the Project Explorer view, select the bean that you created
or imported into the source folder of your Web project.
- Click File > New > Other. Select Web Services in
order to display the various Web service wizards. Select the Web Service wizard.
Click Next.
- Web Services page: select Bottom up Java bean Web service as your Web service
type. You can optionally choose to do the following:
- Select the stages of Web services development that you want
to complete using the slider:
- Develop: this will develop the WSDL definition and implementation of the
Web service. This includes such tasks as creating the modules which will contain
the generated code, WSDL files, deployment descriptors, and Java files
when appropriate.
- Assemble: this ensures the project that will host the Web service or client
gets associated to an EAR when required by the target application server.
- Deploy: this will create the deployment code for the service.
- Install: this will install and configure the Web module and EARs on the
target server. If any changes to the endpoints of the WSDL file are required
they will be made in this stage.
- Start: this will start the server once the service has been installed
on it.
- Test: this will provide various options for testing the service, such
as using the Web Service Explorer or sample JSPs.
- Select your server: the default server is displayed. If you
want to deploy your service to a different server click the link to specify
a different server.
- Select your runtime: the default runtime is displayed. If you
want to deploy your service to a different runtime click the link to specify
a different runtime.
- Select the service project: the project selected in your workspace
is displayed. To select a different project and EAR click on the project link. Ensure that the project selected as the Client Web Project is different
from the Service Web Project, or the service will be overwritten by the client's
generated artifacts.
- If you want to create a client, select the type of proxy to
be generated and repeat the above steps for the client.
- Publish the Web service: this will launch the Web Services Explorer
to publish your Web service to a UDDI registry.
- Monitor the Web service: this will send the Web service traffic
through the TCP/IP Monitor, which allows you to watch the SOAP traffic generated
by the Web service and to test this traffic for WS-I compliance. Alternately
you can manually set up a TCP/IP monitor as described in Using the TCP/IP Monitor to test Web services
- Service Endpoint Interface Selection page:
- You can select to use an existing service endpoint interface (SEI) rather
than letting the wizard generate one.
- Set the service deploy scope. This indicates how to deploy the server
implementation. Application uses one instance of the implementation class
for all requests. Request creates a new instance of the implementation class
for each request. Session creates a new instance of the implementation class
for each session.
- Set the SOAP action. This option is used to set the soapAction field in
the generated WSDL. Default sets the soapAction field according to the deployment
information. None sets the soapAction field to double quotes (""). Operation
sets the soapAction field to the operation name.
- You can also choose to exclusively map MIME types using WSDL 1.1 standards.
If the MIME type cannot map to WSDL 1.1 standards (for example, if the attachment
is an array or a Java bean property), the command fails.
- Web Service Java Bean Identity page:
- Change the WSDL port name or WSDL file name.
- Select the methods to expose.
- Set the void return - this field is for a Web service method with return
type of void that describes whether a response is expected from the Web service.
Oneway: this argument is the default for a JMS transport. Twoway: this argument
is the default for an HTTP transport.
- Select the encoding style. This specifies which style and use combinations
are generated into the WSDL file. The combinations are RPC/encoded, RPC/literal,
or document/literal. Only document/literal is WS-I compliant.
- Select your security options. Security is not WS-I compliant.
- Select if you want to customize the package to namespace mappings.
- Specify extra and stop classes. Extra specifies other classes that are
represented in the WSDL file. You can use the -stopClasses argument to define
additional classes that cause the search to stop.
- Web Service Package to Namespace Mappings page: The Web services
wizard generates a WSDL file from the specified Java bean. By default it will
create a namespace based on the package name of the Java bean. To override
this default behavior you can specify your own namespaces to be generated
in the WSDL file. If you selected Define custom mapping for package to
namespace on the previous page, you can enter your custom mapping pairs
on this page by clicking Add. Alternately, you can click Import to
import custom mapping pairs from a .properties file.
The content of the properties file must be of the format package=namespace.
- Extra and Stop Classes Configuration page: if you selected Specify
extra and stop classes you can import your extra and stop classes on this
page. Extra specifies other classes that are represented in the
WSDL file. You can use the -stopClasses argument to define additional classes
that cause the search to stop.
- Web Service Test page: If you selected to test the Web service,
select the test facility for the generated Web service. This will open the
Web service in the Web Services Explorer. Select the operation you want to
test, enter the required information, and click Go. The result will
display in the Status pane. Click Next.
- Web Service Proxy page: if you have selected to generate a proxy,
select the proxy security options and select if you want to customize the
package to namespace mappings.
- Web Service client package to namespace mapping page: if you selected
Define custom mapping for package to namespace on the previous page,
you can enter your custom mapping pairs on this page by clicking Add.
Alternately, you can click Import to import custom mapping pairs from
a .properties file. The content of the properties
file must be of the format package=namespace.
You can also choose to disable data binding and use SOAP elements when generating Java from
WSDL.
- Web Service Client Test page:
- Select your test facility. You can test the generated proxy in the Universal
Test Client or the Web Service Explorer, or you can generate a sample Web
service JSP.
- If you selected to test the proxy through a JSP, you can select the folder
where the JSP will be located, and you can select the methods that will be
included in the JSP.
- Select Run test on server to start the server for you automatically.
- Web Service Publication page: Select whether or not you want to
publish this Web service to a UDDI registry. Click Finish.
After the Web service has been created, the following may occur depending
on the options you selected:
- If you have selected to test the generated proxy using Web service JSPs,
the proxy is launched in a Web browser at the following URL: http://localhost:port/WebProjectClient/sampleBeanName/WebServiceName/TestClient.jsp You
can use this sample application to test the Web service by selecting a method,
entering a value for the method, and clicking Invoke. The result of
the method will display in the results pane.
- If you have selected to test the generated proxy using the Universal Test
Client, it will be launched in a browser window at the following URL: http://localhost:9080/UTC/preload?object= BeanPackage. BeanServiceProxy. In the Reference pane,
under Object References, expand the proxy stub to display the methods of the
Web service. Click the method you want to test, enter a value in the Parameters
pane, and click Invoke. The result will be generated
below.
- If you have selected to test the Web service using the Web Services Explorer,
the Explorer will open. Select the operation you want to test, enter the required
information, and click Go. The result will display in the Status pane.
- If you have selected to publish the Web service, the Web Services Explorer
is launched displaying the page required to publish your Web service to the IBM UDDI
Test Registry. Follow the instructions in Publishing the Web service to
complete this task.