WSDL - <service> Element


The <service> element defines the ports supported by the web service. For each of the supported protocols, there is one port element. The service element is a collection of ports.

  • Web service clients can learn the following from the service element −

    • where to access the service,
    • through which port to access the web service, and
    • how the communication messages are defined.
  • The service element includes a documentation element to provide human-readable documentation.

Here is a piece of code from the Example chapter −

<service name = "Hello_Service">
   <documentation>WSDL File for HelloService</documentation>
   <port binding = "tns:Hello_Binding" name = "Hello_Port">
         location = "">

The binding attributes of port element associate the address of the service with a binding element defined in the web service. In this example, this is Hello_Binding

<binding name =" Hello_Binding" type = "tns:Hello_PortType">
   <soap:binding style = "rpc"
      transport = ""/>
   <operation name = "sayHello">
      <soap:operation soapAction = "sayHello"/>
            encodingStyle = ""
            namespace = "urn:examples:helloservice" use = "encoded"/>
            encodingStyle = ""
            namespace = "urn:examples:helloservice" use = "encoded"/>