Java Reference
In-Depth Information
strictions. The chief disadvantage to the document/literal wrapped style is that it generally res-
ults in the most complex WSDL.
There is another wrinkle, however: if you plan to use document/literal wrapped, the content
type of the wrapper element must be specified as sequence in the XML schema. This indic-
ates that its constituent elements will be ordered, which is key to modeling method signatures
in Java, where parameter order matters.
If you want an element to be optional, it must be declared nillable in your schema.
With document/literal wrapped, your WSDL looks like this:
<message name="authorSearch">
<part name="parameters" element="tns:authorSearch"></part>
</message>
<message name="authorSearchResponse">
<part name="parameters" element="tns:authorSearchResponse"></part>
</message>
<portType name="Catalog">...</portType>
Bare
Using the bare (non-wrapper) parameter style indicates that the service operation will receive
the complete XML document instance. The glaring drawback to using a bare style is that be-
cause you are passing your entire XML document instance and are foregoing using the name
of any operation, you have only one shot. That is, you can only define one method per service
that accepts that particular document type. Your operation is also limited to defining only a
single parameter.
Say that you want to define a service operation called “authorSearch” using document/literal
bare. Your operation will accept an Author matching an Author type in a schema, and search
for topics written by that author.
But what if you want to define an operation in the same service to allow you to add an author
to your database? You're painted into a corner because you didn't specify the operation name.
The runtime must select which operation to perform based on trying to match the parameter
it was passed with the operation signatures. If you had an add(Author a) operation and a
search(Author a) operation, the runtime wouldn't know which one you meant. During in-
vocation of wsimport , you would receive an error such as this:
[ERROR] Non unique body parts! In a port, as per BP 1.1 R2710
operations must have
unique operation signaure on the wire for successful dispatch. In port
CatalogPort,
Operations "authorSearch" and "add" have the same request body block
{http://ns.soacookbook.com/catalog}author. Try running wsimport with
Search WWH ::




Custom Search