Action item: HTTP binding for accepts header and output Serialization.

?ED       2004-05-20: David Orchard to update HTTP binding to 
                      include discussion of how to generate an 
                      accepts header from schema annotations 
                      conformant to the media types extension 
                      document, and to use outputSerialization 
                      based on that information.


I don't recall exactly what I agreed to on this, but here's my best shot.  I wasn't able to figure out how to relate the schema annotations for binary directly to the Accept header and the outputSerialization, because the schema annotation is buried in an appinfo and not available as type for being referenced.  I haven't seen any use of XPath in WSDL to refer to an "unnamed" component, so that didn't seem the right way to go.  I'm sure I'm just missing something obvious that the media type folks will point out, so I didn't go any further on this.

Insert new Section 3.6.4 Serialization as Other

This serialization format is designed to allow a Web service to send or receive binary data.  The instance data of the input or output is serialized according to the media type of the instance data.  The media type that is expected or allowed on input, and the media type that may or will be sent on output is specified according to the Assigning Media types to binary data in XML.  The sender may specify an HTTP Accept header using the Abstract Data feature.  The Accept header value should be within the set of values defined by the expected Media Type element value.

Example requesting an image/gif
The following is a WSDL service that returns an image/gif or image/jpeg and allows the client to choose which to receive.

<definition>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:tns="http://example.com/thisexample"
           xmlns:xmlmime="http://www.w3.org/@@@@/@@/xmlmime"
           targetNamespace="http://example.com/thisexample">

<xs:import namespace="http://www.w3.org/@@@@/@@/xmlmime"
    schemaLocation="http://www.w3.org/@@@@/@@/xmlmime"/>


<xs:complexType name="Picture">
   <xs:simpleContent>
       <xs:extension base="xs:base64Binary" >
           <xs:attribute ref="xmlmime:contentType" use="optional" />
       </xs:extension>
   </xs:simpleContent>
</xs:complexType>

<xs:element name="companyPicture" type="tns:Picture" 
    <xs:annotation>
        <xs:documentation>This element designates the range of values 
        that the declared binary type will accept 
        </xs:documentation>
        <xs:appInfo>
           <xmlmime:expectedMediaType>image/jpeg, image/gif</xmlmime:expectedMediaType>
        </xs:appInfo>
    </xs:annotation>
</xs:element>

<xs:complexType name="myDataType">
   <xs:sequence>
     <xs:element name="Accept"
             type="xmlmime:contentType"
             minOccurs="0"/>
   </xs:sequence>
  </xs:complexType>

</xs:schema>

<interface name="Image">
 <operation name="getImage" safe="true">
  <input>
   <property uri="http://www.w3.org/@@@@/@@/features/AD/data">
    <constraint xmlns:foo="http://foo">
     foo:myDataType
    </constraint>
   </property>
  </input>
  <output element="tns:companyPicture"/>
 </operation>
</interface>
<binding>
  <operation ref="getImage" http:method="GET" >
    <output messageLabel="xs:NCName" http:outputSerialization="xmlmime:contentType" >
    </output>
  </operation>
</binding>
</definition>

Questions:
- I don't know how to relate the AD/data to the contentType explicitly because the expectedMediatype is buried in the Annotation. I think the relationship between companyPicture expectedMediaType and the AD myDataType is a bit tenous.  
- Can the outputSerialization be a reference rather than a value?
- Is the empty interface operation input to specify empty input params ok?  I *think* this means that the message content model property is set to #none.
- Any other bugs?

Cheers,
Dave

Received on Wednesday, 23 June 2004 20:54:43 UTC