Moving MIME Type Information to the Interface (aka PortType)

At the last F2F we all agreed that interfaces should be abstract, i.e.
decoupled from bindings. This rule has the benefit that interfaces can be
used with multiple bindings. It must therefore be possible for tools to
generate programmatic interfaces (stub or skeleton) from the WSDL interface
without reference to any associated bindings.

In WSDL 1.1 this rule is not observed for MIME types. For example, supposed
a service returns a JPEG image. At the message level, the image must be
defined as a binary XSD type. The MIME type information is added at the
binding level. The WSDL 1.1 is like the following:

<definitions ...>

<message name="getImageInput"/>

<message name="getImageOutput">
      <part name="image" type="xsd:binary"/>
</message>

<portType name="imageInterface">
      <operation name="getImage">
            <input name="getImageInput"/>
            <output name="getImageOutput"/>
      </operation>
</portType>

<binding name="imageHTTPBinding" type="imageInterface">
      <http:binding verb="GET"/>
      <operation name="getImage">
            <http:operation location=""/>
            <input>
                  <http:urlReplacement/>
            </input>
            <output>
                  <mime:content type="image/jpeg"/>
            </output>
      </operation>
</binding>

</definitions>

Now if at the message/interface level the image is simply defined as a
binary type, then the best code you can generate is like:

public byte[ ] getImage( );

When you look at the binding and see that the response is actually a MIME
type of "image/jpeg" you can generate a more strongly typed programmatic
interface, e.g.

 public java.awt.Image getImage( );

Proposal

The simplest way to fix this problem is to treat MIME on a par with XSD and
allow the MIME type information to be specified at the <part>, e.g.

<part name="image" mimeType="image/jpeg"/>

Here the mimeType attribute is an alternative to the type attribute which
declares XSD types.

Arthur Ryman,
WebSphere Studio Development Lead,
Web Services, XML and Data Tools

phone: 905-413-3077, TL 969-3077
assistant: 905-413-2323, TL 969-2323
fax: 905-413-4920, TL 969-4920
intranet: http://w3.torolab.ibm.com/~ryman/

Received on Monday, 17 March 2003 15:11:29 UTC