WSDL Implementation: The Elements





5.6 WSDL Implementation: The service and port Elements

The service element contains one or more port elements, each of which represents a different Web service. The port element assigns the URL to a specific binding. The following snippet shows a complete service definition from Listing 5-2 and Listing 5-13.

<service name="BookPriceService">
  <port name="BookPrice_Port" binding="mh:BookPrice_Binding">
    <soapbind:address location=
     "http://www.Monson-Haefel.com/jwsbook/BookQuote" />
  </port>
</service>

A service may have more than one port element, each of which assigns a URL to a specific binding. It's even possible for two or more port elements to assign different URLs to the same binding, which might be useful for load balancing or failover. Listing 5-15 shows a service element that contains three port elements, two of which refer to the same binding.

Listing 5-15 Defining a service with Multiple port Elements
<service name="BookPriceService">
  <port name="BookPrice_Port" binding="mh:BookPrice_Binding">
    <soapbind:address location=
     "http://www.Monson-Haefel.com/jwsbook/BookQuote" />
  </port>
  <port name="BookPrice_Failover_Port" binding="mh:BookPrice_Binding">
    <soapbind:address location=
     "http://www.monson-haefel.org/jwsbook/BookPrice" />
  </port>
  <port name="SubmitPurchaseOrder_Port"
   binding="mh:SubmitPurchaseOrder_Binding">
    <soapbind:address location=
     "https://www.monson-haefel.org/jwsbook/po" />
  </port>
</service>

5.6.1 The soapbind:address Element

The soapbind:address element is pretty straightforward; it simply assigns an Internet address to a SOAP binding via its location attribute (its only attribute). Although WSDL allows any type of address (HTTP, FTP, SMTP, and so on), the Basic Profile allows only those URLs that use the HTTP or HTTPS schema.BP For example, in Listing 5-15 the first two port elements declare an HTTP address for the location attribute, while the third port declares an HTTPS address.

Two or more port elements within the same WSDL document must not specify exactly the same URL value for the location attribute of the soapbind:address.BP


     Python   SQL   Java   php   Perl 
     game development   web development   internet   *nix   graphics   hardware 
     telecommunications   C++ 
     Flash   Active Directory   Windows