Java Reference
In-Depth Information
Class and PortType
Think of a
wsdl:portType
as a class, and its
wsdl:operation
child elements as methods:
<portType name="CartEJB">
<operation name="getVersion">
<input message="tns:getVersion"/>
<output message="tns:getVersionResponse"/>
</operation>
</portType>
Each method in your Java service is defined within the
portType
as a
wsdl:operation
to
indicate the abstract operations that your service can perform. But each is also repeated as a
child element of a
wsdl:binding
(which we will look at next). You can see that your
getVer-
sion
method name was used as the WSDL operation name by default. See
Providing a Value
The input of the operation is used to specify method arguments, and the output element speci-
fies the return type.
Method and binding
Methods in the Java service are defined as operations in the WSDL. The WSDL must describe
the physical manner of invoking the service on the wire, and it does so in the
wsdl:binding
element. The operation as defined in
wsdl:portType
tells you what you can do, and the op-
eration child of the
wsdl:binding
element tells you how it must be done.
Because no binding customization was added when you generated this WSDL, JAX-WS se-
lects the default binding of SOAP over HTTP. Other bindings, such as REST over HTTP or
SOAP over JMS, are possible.
That section of the generated WSDL looks like this:
<binding name="CartEJBPortBinding" type="tns:CartEJB">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document">
</soap:binding>
<operation name="getVersion">
<soap:operation soapAction=""></soap:operation>
<input>
<soap:body use="literal"></soap:body>
</input>
<output>
<soap:body use="literal"></soap:body>
</output>
</operation>
</binding>