HTTP binding for WSDL 1.2 (example)

Following
 http://lists.w3.org/Archives/Public/www-ws-desc/2003Mar/0068.html
here is an example of a decorated XML tree.

I included an example using feature and property as well.

<wsdl>
    <message name="getImageInput">
      <part name='name' type='xsd:string'/>
    </message>

    <message name="getImageOutput">
      <part name="image" mimeType="image/jpeg"/>
    </message>
    
    <interface name="ImageInterface">
      <operation name="getImage">
	<input name="getImageInput"/>
	<output name="getImageOutput"/>
      </operation>
    </interface>
    
    <!--
    Here, we have two differents ways: one using our open content model,
    one using features and properties:
    -->
    
    <!-- using the open content model -->
    <binding name='ImageInterfaceHttp1' type='s:ImageInterface'>      

      <!-- do we want the verb per binding or per operation?
      Having per binding, requires to write two binding to map one
      method to GET and the other to POST
      -->
      <http:binding verb='GET'/>

      <operation name="getImage">
	<http:operation location='images/(name).jpg'/>
	<input>
	  <!--
	  all part are included in the uri, only section 1.1 applies.
	  no need for further information
          will produce: .../images/bear.jpg
            -->
	</input>
	<output>
	  <!--
	  mime type is included in the part, section 1.3.2.1.1 applies.
	  (note that this section contains a bug regarding the mime type
	  from section introduction 1.3.2.1).

	  no need for further information.
	  -->
	</output>
      </operation>
    </binding>
      
    <!-- the same binding, but using the features and properties model
-->
    <binding name='ImageInterfaceHttp2' type='s:ImageInterface'>      

      <feature name="http://www.example.org/2003/03/http/web-method"/>
      <property
	name='http://www.example.org/2003/03/http/web-method/method'>
	GET
      </property>

      <operation name="getImage">
	<property
	  name='http://www.example.org/2003/03/http/web-method/location'>
	  images/(name).jpg
	</property>
	<input/>
	<output/>
      </operation>
    </binding>

    <!-- for the rest of the example, I'll use the open content model
-->

    <!-- same interface, but this time using the url encoded mechanism
-->
    <binding name='ImageInterfaceHttp'>
      <http:binding verb='GET'/>
      <operation name="getImage">	
	<http:operation location='images'/>
	<input>
	  <!--
            no parts are in the operation location, so let's map them
            using section 1.2.2
            will produce: .../images?name=bear
            -->
	  <http:urlEncoded/>
	</input>
	<output/>          
      </operation>
    </binding>

    <!-- same interface, but this time using HTTP POST -->
    <binding name='ImageInterfaceHttp'>
      <http:binding verb='POST'/>
      <operation name="getImage">	
	<http:operation location='images/(name).jpg'/>
	<input>
	  <!--
	  all part are included in the uri, only section 1.1 applies.
	  no need for further information
          will produce: .../images/bear.jpg
            -->
	  <http:urlEncoded/>
	</input>
	<output/>          
      </operation>
    </binding>

    <!-- same interface, but this time using HTTP POST -->
    <binding name='ImageInterfaceHttp'>
      <http:binding verb='POST'/>
      <operation name="getImage">	
	<http:operation location='images'/>
	<!-- we always use application/x-www-form-urlencoded -->
	<input/>
	<!-- same reply as in the HTTP GET binding -->
	<output/>          
      </operation>
    </binding>

Philippe

Received on Thursday, 10 April 2003 08:36:25 UTC