Java Reference
In-Depth Information
"j"
})
public class Add {
protected int i;
protected int j;
//getters and setters omitted
That class acts as the wrapper for each of the integers that will be sent in the request. The @Xml
annotations on this class come from JAXB. They indicate how JAXB should marshal and un-
marshal instances of this class to and from XML. The @XmlType annotation is used to specify
that this Add class matches a top-level complex type (or an enum) within an XML schema, and
the “name” property is specified as “add” in it, to match the item's name within the schema. If
you look at the schema that your WSDL refers to, you see the following complex type, which
matches your Add class:
<xs:complexType name="add">
<xs:sequence>
<xs:element name="i" type="xs:int"></xs:element>
<xs:element name="j" type="xs:int"></xs:element>
</xs:sequence>
</xs:complexType>
But why does this type get created for you? Integers are defined as basic types provided with
XML Schema; they are not custom types that you have written that require something spe-
cial. The complex type that wraps these two integers is created in order to match your WSDL,
which uses the document/literal style. Here is the portion of the WSDL that tells you this:
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"></soap:binding>
<operation name="add">
<soap:operation soapAction=""></soap:operation>
<input>
<soap:body use="literal"></soap:body>
</input>
Had you been using RPC and not document, the values would have been passed separately to
the operation invocation just like method parameters.
NOTE
For more information on document versus RPC and literal versus Encoding, see Choosing Encoding,
Use, and Parameter Styles .
Search WWH ::




Custom Search