Publishing WSDL files using a URL
We can publish a WSDL file using a URL.
Before we can publish a WSDL file using a URL, ensure the Web services-enabled application is installed and running.
The files referenced by the <wsdl-file> element in the webservices.xml might import other WSDL or XML Schema Definition (XSD) files. Typically, all WSDL or XSD files are initially placed into the META-INF/wsdl directory when using EJB or the WEB-INF/wsdl directory when using Java Beans™. If the WSDL or XSD files are not placed in one of these directories, the file referenced by the <wsdl-file> and its imported files are copied to the wsdl directory for publishing purposes.
There are two different forms of URL query strings. The first appends /wsdl to the service and returns only HTTP and JMS bindings. The second appends /extwsdl to the service and returns the extended WSDL file, including HTTP, JMS, and EJB bindings. If a WSDL file contains only EJB bindings and the /wsdl query is used, an error message displays in the browser saying there are no HTTP or JMS bindings in the WSDL file. The error message suggests using the /extwsdl query instead. Publishing a WSDL file using a URL requires that the application have a Web module; either provided by the application or in the form of an HTTP router module. If an EJB application contains a WSDL file with only JMS or EJB Web service bindings, the endptEnabler command can be used to add an HTTP router module to the application.
Only HTTP URLs are supported for publishing.
To publish a WSDL file using a URL:
- Retrieve the outer-most WSDL file. The outer-most WSDL file is the WSDL file defined by the <wsdl-file> element in the webservices.xml file.
Each Web service has an endpoint address, like http://example.com/services/stockquote. We can retrieve the outer-most WSDL file (defined by the <wsdl-file> element within the webservices.xml file) by appending the string "/wsdl" or "/wsdl/" to the endpoint address, for example,http://example.com/services/stockquote/wsdl.
- Retrieve the imported WSDL files. When the outer-most WSDL file imports other WSDL or XSD files, these imported files can be retrieved by appending the relative path to the URL, which is used to retrieve the outer-most WSDL file. This is also true for WSDL files that import other files. This process is similar to the use of relative hyperlinks in HTML documents. If an HTML document contains a hyperlink to other documents, the relative path is appended to create the URL to access the hyperlinked documents.
Example
Suppose we have an application with the following directory structure:<module-root>/ WEB-INF/ webservices.xml /* the <wsdl-file> element points to "WEB-INF/wsdl/fooImpl.wsdl"*/ web.xml ibm-webservices-bnd.xml wsdl/ fooImpl.wsdl /* imports foo.wsdl which is an interface wsdl */ foo.wsdl /* type definition for the interface */If the SOAP address for the foo service is http://examples.com:9082/services/foo, the simple way to retrieve the foo service's outer-most WSDL is with the following form: http://examples.com:9090/services/foo/wsdl or http://examples.com:9090/services/foo/wsdl/. The URL is redirected to http://examples.com:9090/services/foo/wsdl/fooImpl.wsdl, where fooImpl.wsdl is the name of the outer-most WSDL file.
Since the fooImpl.wsdl file has the import <import namespace="http://examples.com/foo" location="a/b/foo.wsdl>, use the URL http://examples.com:9090/services/foo/wsdl/a/b/foo.wsdl to obtain the foo.wsdl file.
Related tasks
Develop a WSDL file for JAX-RPC applications
Publishing WSDL files
Set a service provider to share its policy configuration
Publishing WSDL files using wsadmin