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.
Before you begin
Prerequisites:
- Optional: Create a 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 or a Java project.
To import, select the Java Resources:
src folder, and from the file menu select and browse to where your package is.
About this task
To create a web service from a bean using the IBM® WebSphere JAX-RPC runtime environment:
Procedure
- Switch to the Java EE
perspective (Window > Open Perspective > Java EE).
- In the Enterprise 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. This will set several default values
on the remaining wizard panels.
- 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 Generic Services Client, 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 launches 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 Note that if you are routing web service traffic through the
TCP/IP monitor that you cannot test the web service using the Universal
Test Client.
- 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 if required.
- Change the WSDL file name or path if required. Any path information
you provide in this field will create folders within the WEB-INF/wsdl
folder. This can be useful if you do not want to overwrite WSDL or
XSD files already in the default folder.
- 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. You will need to escape some special characters in the properties
files. For example somePackage=http://someNamespace should
be somePackage=http\://someNamespace. Otherwise,
the colon (:) would be treated as delimiter resulting in trying to
map somepackage to http. For more
information about formats for properties files in Java, refer to: Java Platform
API documentation: java.util.Properties load method.
- 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 or Generic
Services Client. 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 Namespace to Package Mappings page:
if you selected Define custom mapping for namespace to
package 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 namespace=package. You will need to escape some special characters in the properties
files. For example http://someNamespace=somePackage should
be http\://someNamespace=somePackage. Otherwise,
the colon (:) would be treated as delimiter resulting in trying to
map http to //someNamespace=somePackage.
For more information about formats for properties files in Java, refer to: Java Platform
API documentation: java.util.Properties load method.
- 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. Note that if you are routing web
service traffic through the TCP/IP monitor that you cannot test the
web service using the Universal Test Client.
- 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.
Results
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.