Introduction of WSDL

WSDL elements :
ia2cf27cn-7123

  • Description of elements :
  • wsdl_1
    wsdl_2

    Relation between code and elements :

    If you are publishing this class using

    Endpoint.publish("http://testhost:9899/ws/helloexample", new sayHello());
    

    So your generated wsdl will be mapped like below.

    Interface or class name: PortType
    Method name: Operation
    Method name: input message (request)
    Method name+Response: output message (response)

    <portType name="sayHello">
        <operation name="helloWorld">
           <input message="tns:helloWorld"/>
           <output message="tns:helloWorldResponse"/>
        </operation>
    </portType>
    

    Endpoint.publish(“http://testhost:9899/ws/helloexample&#8221;,new sayHello())
    : address location

      <wsdl:service name="sayHelloService">
      <wsdl:port name="sayHelloPort" binding="tns:sayHelloPortBinding">
      <soap:address location="http://testhost:9899/ws/helloexample" />
      </wsdl:port>
    

    For more info http://stackoverflow.com/questions/20891198/details-on-wsdl-ports

    Relation between elements :

    WSDL_11vs20

    Structure-of-WSDL-Crunchify-Tutorials-Tips

    Define a service in WSDL :

  • Create an Empty Definition
  • The document element is called [wsdl:]definitions in the http://schemas.xmlsoap.org/wsdl/ namespace.

    We’ll use the ‘name’ attribute to give a common name for the tideinfo service:

    <wsdl:definitions name="tideinfo"
       xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
       targetNamespace="http://www.smallx.com/services/tideinfo/2005/wsdl"
       xmlns:service="http://www.smallx.com/services/tideinfo/2005/wsdl"
    >
       <wsdl:documentation xmlns="http://www.w3.org/1999/xhtml">
       <p>This service provides tide information by NOAA tide monitor location.</p>
       </wsdl:documentation>
    </wsdl:definitions>
    

    Inside this element is where all the descriptions of the messages/etc. go.

    The [wsdl:]documentation element is nice to use for descriptions of how to use the service or where to get more information.

  • Import the Schema
  • We can import the schema for the schema via the [wsdl:]import element:

    <wsdl:definitions ...>
    
    <wsdl:import namespace="http://www.smallx.com/services/tideinfo/2005" 
                 location="http://www.smallx.com/tideinfo-service/tideinfo.xsd"/>
    
    </wsdl:definitions>
    

    This makes the element declarations and types available to the WSDL definitions.

  • Define the Service
  • We have only one service:

    <wsdl:definitions ...>
    
    <wsdl:service name="tideinfo">
       <wsdl:port name="tideinfo-port" binding="service:tideinfo-binding"/>
    </wsdl:service>
    
    </wsdl:definitions>
    

    We’ve defined the port but referred to the [service:]tideinfo-binding binding.

    We need to define [service:]tideinfo-binding.

  • Define the Binding
  • The [service:]tideinfo-binding binding:

    <wsdl:definitions ...>
    
    <wsdl:binding name="tideinfo-binding">
       <wsdl:operation name="get-tides">
           <wsdl:input message="service:get-tides"/>
           <wsdl:output message="service:tides"/>
       </wsdl:operation>
    </wsdl:binding>
    
    </wsdl:definitions>
    

    We now need to define the messages.

  • Define the Messages
  • The messages:

    <wsdl:definitions ...>
    
    <wsdl:message name="get-tides">
       <part name="body" element="t:tideinfo"/>
    </wsdl:message>
    
    <wsdl:message name="tides">
       <part name="body" element="t:tideinfo"/>
    </wsdl:message>
    
    </wsdl:definitions>
    

    This service uses the same element for request and response.

  • The Whole Thing
  • <wsdl:definitions name="tideinfo"
       xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
       targetNamespace="http://www.smallx.com/services/tideinfo/2005/wsdl"
       xmlns:service="http://www.smallx.com/services/tideinfo/2005/wsdl"
       xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    >
       <wsdl:documentation xmlns="http://www.w3.org/1999/xhtml">
       <p>This service provides tide information by NOAA tide monitor location.</p>
       </wsdl:documentation>
    
    <wsdl:import namespace="http://www.smallx.com/services/tideinfo/2005" 
                 location="http://www.smallx.com/tideinfo-service/tideinfo.xsd"/>
    
    <wsdl:message name="get-tides">
       <part name="body" element="t:tideinfo"/>
    </wsdl:message>
    
    <wsdl:message name="tides">
       <part name="body" element="t:tideinfo"/>
    </wsdl:message>
    
    <wsdl:binding name="tideinfo-binding">
       <soapbind:binding style="document"
                         transport="http://schemas.xmlsoap.org/soap/http"/>
       <wsdl:operation name="get-tides">
           <wsdl:input message="service:get-tides">
              <soap:body part="body" use="literal"/>
           </wsdl:input>
           <wsdl:output message="service:tides">
              <soap:body part="body" use="literal"/>
           </wsdl:output>
       </wsdl:operation>
    </wsdl:binding>
    
    <wsdl:service name="tideinfo">
       <wsdl:port name="tideinfo-port" binding="service:tideinfo-binding">
          <soap:address location="http://www.smallx.com/tideinfo-service/tideinfo.pd"/>
       </wsdl:port>
    </wsdl:service>
    
    </wsdl:definitions>
    

    For more info http://courses.ischool.berkeley.edu/i290-14/s05/lecture-22/allslides.html

    Advertisements

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s