Generating a JAX-WS Web Service from a WSDL File
See Also
When you and your business partners agree on a "contract" in the form of a WSDL file,
you can use the IDE to implement it. The WSDL file is an agreement on the data and messages
that will be exchanged as well as how these messages will be sent and received.
In the IDE, you can use the WSDL file to implement the web service.
Business requirements may demand that you create a platform-independent
description of a web service as a set of XML schema files and WSDL files. Based on this
platform-independent description, you can use the steps that follow to generate
the implementation files. The WSDL file that you use in the steps below can either be
available on disk or via a URL. You can even create the WSDL file yourself, using the IDE,
as described in Creating a WSDL File.
-
For J2EE 1.4 web services, if the WSDL file imports schemas, other WSDL files, or both, from the local file system, the web service will only work
if the imported schemas and WSDL files are copied beforehand into the WEB-INF/wsdl (or META-INF/wsdl)
folder. If you do not do this,
the wscompile tool
will not be able to locate these imported files at the end of the procedure below.
To create a web service from a WSDL file:
- Depending on the implementation form, create a web application project or an EJB module project.
- In the Projects window or Files window, right-click the project node
and choose New > Other. In the Web Services folder, choose
Web Service from WSDL.
The New Web Service from WSDL wizard opens.
- Type the web service name and specify a package to house the web service.
- Browse to a WSDL file in your filesystem or type the URL to a WSDL file.
- Select Use Provider if you want to bypass the XML <--> Java binding layer and have the service use raw XML when processing requests. Instead of XML <--> binding, the Provider interface is used. This is an advanced feature and is unselected by default.
- Click Finish.
For JAX-WS web services (Java EE 5 specification), the IDE
runs the wsimport tool, which reads the WSDL file
and generates all the required artifacts for web service development,
deployment, and invocation. Finally, the IDE generates the skeleton
implementation class, which corresponds to the WSDL port selected in the wizard.
- See Also
- About Web Services
- About Implementing Web Services
- Creating a Web Service from Java
- Creating a WSDL File
Legal Notices