Section 10.9. WSDL File

10.9. WSDL File

The WSDL file describes a Web Service interface along with its parameters and registers the web service with JBoss. If you thought the previous descriptors were tedious and painful to look at, then you're in for a treatthe WSDL file is much worse. Example 10-5 is the InventoryService.wsdl WSDL file used to deploy the Inventory Web Services.

Example 10-5. InventoryService.wsdl
 <?xml version="1.0" encoding="UTF-8"?> <definitions name="InventoryService" targetNamespace="http://localhost:8080/jbossatwork-ws" xmlns:tns="http://localhost:8080/jbossatwork-ws" xmlns="" xmlns:xsd="" xmlns:ns2="http://localhost:8080/jbossatwork-ws/types" xmlns:soap="">   <types>     <schema targetNamespace="http://localhost:8080/jbossatwork-ws/types"             xmlns:tns=http://localhost:8080/jbossatwork-ws/types             xmlns:soap11-enc=""             xmlns:xsi=""             xmlns:wsdl=""             xmlns="">       <complexType name="CarDTOArray">         <sequence>           <element name="cars" type="tns:CarDTO" nillable="true" minOccurs="0"                    maxOccurs="unbounded"/></sequence></complexType>       <complexType name="CarDTO">         <sequence>           <element name="id" type="int"/>           <element name="make" type="string" nillable="true"/>           <element name="model" type="string" nillable="true"/>           <element name="modelYear" type="string" nillable="true"/>           <element name="status" type="string"                    nillable="true"/>         </sequence>       </complexType>     </schema>   </types>   <message name="InventoryEndpoint_findAvailableCars"/>   <message name="InventoryEndpoint_findAvailableCarsResponse">     <part name="result" type="ns2:CarDTOArray"/></message>   <portType name="InventoryEndpoint">     <operation name="findAvailableCars">       <input message="tns:InventoryEndpoint_findAvailableCars"/>       <output message="tns:InventoryEndpoint_findAvailableCarsResponse"/>     </operation>   </portType>   <binding name="InventoryEndpointBinding" type="tns:InventoryEndpoint">     <soap:binding transport="" style="rpc"/>     <operation name="findAvailableCars">       <soap:operation soapAction=""/>       <input>         <soap:body use="literal" namespace="http://localhost:8080/jbossatwork-ws"/>       </input>       <output>         <soap:body use="literal" namespace="http://localhost:8080/jbossatwork-ws"/>       </output>     </operation>   </binding>   <service name="InventoryService">     <port name="InventoryEndpointPort" binding="tns:InventoryEndpointBinding">       <soap:address location="REPLACE_WITH_ACTUAL_URL"/>     </port>   </service> </definitions> 

This WSDL file ties the InventoryService web service to the InventoryEndpoint interface and maps the CarDTO and CarDTOArray WSDL types to XSD data types. In the Client section, we'll use the WSDL file to generate proxy code that encapsulates the details of communicating with the Web Service.

The following line in the WSDL file tells JBoss that it can choose its own URL for the web service:

 <soap:address location="REPLACE_WITH_ACTUAL_URL"/> 

By default, JBoss deploys our WSDL to the following URL:


But we don't like the URL that JBoss uses, and we want to set the URL ourselves so it's meaningful to our clients.

JBoss at Work. A Practical Guide
JBoss at Work: A Practical Guide
ISBN: 0596007345
EAN: 2147483647
Year: 2004
Pages: 197

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: