Copyright © tutorialspoint.com

# 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 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 pice of code from Example Session:

      <service name="Hello_Service">
          <documentation>WSDL File for HelloService</documentation>
          <port binding="tns:Hello_Binding" name="Hello_Port">
             <soap:address
                location="http://www.examples.com/SayHello/">
          </port>
       </service>

The binding attributes of por 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="http://schemas.xmlsoap.org/soap/http"/>
       <operation name="sayHello">
          <soap:operation soapAction="sayHello"/>
          <input>
             <soap:body
                encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                namespace="urn:examples:helloservice"
                use="encoded"/>
          </input>
          <output>
             <soap:body
                encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                namespace="urn:examples:helloservice"
                use="encoded"/>
          </output>
       </operation>
       </binding>

Copyright © tutorialspoint.com