Java Reference
In-Depth Information
Using Modular WSDLs
Problem
You want to physically separate the concrete from the abstract WSDL in order to provide a
more modular and flexible interface.
Solution
Create a set of files: one or more schema files that you import into the WSDL in place of
the <types> section, and then create two WSDLs that import an abstract WSDL via the
<wsdl:import> or <wsdl:include> directive.
Discussion
The ideas in this solution are simple, but let's see how they works in code. Here's an example
of using the schema import, which is how most of the examples in this topic work:
<wsdl:types>
<xsd:schema>
<xsd:import namespace="http://soacookbook.com/email"
schemaLocation="http://localhost:8080/EmailService/Email.xsd" />
</xsd:schema>
</wsdl:types>
That's the preferred alternative to specifying types inline within the WSDL <types> section
like this:
<wsdl:types>
<s:schema elementFormDefault="qualified"
targetNamespace="http://soacookbook.com">
<s:element name="SomeElement">...
Besides specifying an external schema, you can also break up the WSDL itself. The abstract
WSDL document contains the namespace definitions, the messages, and the port type. The
concrete WSDL imports the abstract WSDL and contains the <binding> and <service> ele-
ments because these provide actual values for transport mechanism, encoding, and service
URI.
The WSDL in Example 12-15 is based on the specification example of an abstract WSDL in
its own document.
Example12-15.StockQuoteAbstract.wsdl
Search WWH ::




Custom Search