Multipart WSDL best practices

WAS supports deployment of Web services using a multipart WSDL file. That is, WSDL files import other WSDL files when the WSDL file listed in the <wsdl-file> element of the webservices.xml deployment descriptor contains all <wsdl:service> and <wsdl:port> elements. The WSDL file is divided into an implementation WSDL and an interface WSDL.

The <wsdl:import> element indicates a reference to another WSDL file. If the <wsdl:import> element location attribute does not contain a URL, that is, it contains only a file name, and does not begin with http://, https:// or file://, the imported file must be located in the same directory and must not contain a relative path component. For example, if META-INF/wsdl/A_Impl.wsdl is in your module and contains the import statement <wsdl:import="A.wsdl" namespace="..."/> , the file, A.wsdl must also be located in the module META-INF/wsdl directory.

It is recommended that all WSDL files be placed in either the META-INF/wsdl directory, if you are using enterprise JavaBeans (EJBs), or the WEB-INF/wsdl directory, if you are using Java beans, even if there are relative imports within the WSDL files. Otherwise, there are implications with the WSDL publication when you use a path like the following <location="../interfaces/A_Interface.wsdl"namespace="..."/>. Using a path like this fails because the presence of the relative path, regardless of whether the file is located at that path or not. If the location is a URL, it must be readable at both deployment and server startup.


WSDL publication

The files located in the META-INF/wsdl or WEB-INF/wsdl directory can be published through either a URL or file, including WSDL or XSD files. For example, if the file referenced in the <wsdl:file> element of the webservices.xml deployment descriptor is located in the META-INF/wsdl or WEB-INF/wsdl directory, it is publishable. If the files imported by the <wsdl:file> are located in the wsdl/ directory or its subdirectory, they are publishable.

If the WSDL file referenced by the <wsdl:file> element is located in a directory other than wsdl, or its subdirectories, the file and its imported files, either WSDL or XSD files, which are in the same directory, are copied to the wsdl directory without modification when the application is installed. These types of files can also be published.

If the <wsdl:file> imports a file located in a different directory, the file is not copied to the wsdl directory and not available for publishing.


See Also

Developing a WSDL file