Draft Proposal for Assigning Media Types

Dear Members of the Task Force,

As you know, the joint task force of WSD and XMLP wgs is chartered to 
address the declaration of media types in XML documents. I am designated 
to be editor on behalf of WSD wg and our joint effort is intended to be 
published as a W3C note reflecting our joint decisions. Our deliverable 
is intended for MTOM/MIFFY as well as WSDL authors.  This note is 
currently indended to address the XML Schema requirements, not the WSDL 
binding requirements for MTOM/MIFFY.

Anish Karmarkar (Oracle XMLP representative) and I worked on a draft 
writeup to provide to this group to be the basis of our deliverable. We 
have used the discussions in WSD WG as our basis and identified several 
issues for the task force to discuss further. We mark these in the 
document. We also went ahead and proposed a solution for some of the 
issues similar to the approach taken in [PASWA].

We also chose an arbitrary namespace prefix, xmlmime. Other suggestions 
are welcome.

To get the ball ralling, I am sending our draft proposal for the Note. 
If you prefer, I could also provide the standard w3c xml/html spec style 
for proposal.

WSDL f2f meeting takes place on Jan28-Jan30th. I would like to get 
closure on most of the issues as soon as we can prior to the meeting and 
present our progress. Your swift response is appreciated. :-)

I would like to start the discussion via email first before committing 
to a telcon only if needed.

Thanks.

--umit

-- 
Umit Yalcinalp                                  
Consulting Member of Technical Staff
ORACLE
Phone: +1 650 607 6154                          
Email: umit.yalcinalp@oracle.com
Assigning Media Types to Binary Data in XML

****Proposed Draft January 12th 2004*****

Abstract 

<TBD>

Table of Contents
1 Introduction
    1.1 Notational Conventions
2 Requirements
3 Attributes for Declaring Media Types
    3.1 mediaType attribute component
    3.2 acceptedMediaType attribute component
4 Declaring media type for binary data
    4.1 Role of acceptedMediaType attribute
5 Examples
    5.1 Example Schema
    5.2 Example Document
6 Issues List
7 References
8 Appendix Attribute Schema


1 Introduction

Data sent and received over the Web typically uses the the MIME media
type defined by RFC 2046 [IETF RFC 2046], as the type system. For
example, "image/jpeg", "application/pdf". As Web services get widely
deployed, there is a need to indicate the media type of the XML
content in the messages sent and received by Web services. There is
also a need to express the media type information in XML Schema [XML
Schema: Structures],[XML Schema: Datatypes] which is the type system
used by WSDL 2.0 [WSDL20] to describe Web services. This would allow
Web services to utilize the widely deployed and supported MIME media
type infrastructure.

MTOM/Miffy [MIFFY] enables one to serialize binary content (an Element
Information Item of type xs:base64Binary) in an optimized way using
MIME packaging. There is a desire to specify the media type
information of such binary data in a standard way in the Infoset [XML
Information Set] and not just in the optimized serialization of that
Infoset.

This document specifies:

- a mechanism to indicate the media type of an Element Information Item whose
  type is xs:base64Binary
- a mechanism to indicate in XML Schema the acceptable media type(s) for an
  Element whose type is xs:base64Binary. 

1.1 Notational Conventions

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in RFC 2119 [IETF RFC
2119].

This specification uses properties from the XML Information Set [XML
Information Set]. Such properties are denoted by square brackets,
e.g. [namespace name].

This specification uses namespace prefixes that are listed in
Table 1. Note that the choice of any namespace prefix is arbitrary and not
semantically significant (see [XML Information Set]).

Table 1. Prefixes and Namespaces used in this specification 

-----
xmlmime   "http://www.w3.org/@@@@/@@/xmlmime"   Defined by this specification 

wsdl      "http://www.w3.org/@@@@/@@/wsdl"      A normative XML Schema [XML Schema: Structures], [XML Schema: Datatypes] document for the "http://www.w3.org/@@@@/@@/wsdl" namespace can be found at http://www.w3.org/@@@@/@@/wsdl. 

xs        "http://www.w3.org/2001/XMLSchema"    Defined in the W3C XML Schema specification [XML Schema: Structures], [XML Schema: Datatypes]. 

xsi       "http://www.w3.org/2001/XMLSchema-instance" 
-----

Namespace names of the general form "http://example.org/..." and
"http://example.com/..." represent application or context-dependent
URIs [IETF RFC 2396].


2 Requirements

This section describes the set of requirements that this document
addresses. 

- Define how to indicate the media type of a document in XML
schema. This is meta-data that may, but not required to,
be used by tools to infer the specific media type of binary data. 

- Define how to indicate the accepted media type of documents that use
the schema. This information is needed define the set of media types
that a binary type may be. For example, an application may be willing
to indicate that binary data represents an image, but leaves it to a
document to further specify whether it is jpeg, gif, etc. This
information is meta-data to indicate the set of media types that
binary data may have and is not required to be present. 

- Define the relationship between the accepted media types declared in
schema and the actual value of the media types in the XML document
instance.


3 Attributes for Declaring Media Types

This section defines two global attribute components for declaring the
media type of binary data in XML Schema to address the requirements
(1) and (2). Their usage is addressed in Section 4. 

3.1 mediaType attribute component

Attribute declaration for the mediaType attribute specifies the
following Infoset properties.

(Note: We intended this to be a table)

- {name} mediaType 
- {target namespace}  http://www.w3.org/@@@@/@@/xmlmime; 
- {type definition} xs:string 
- {scope} global 

----------------------------------------------------------------------

Issue (choices_for_content_model):

We observe that there are three different choices available for
representing the content model and the task force should decide
evaluate the options. These are:

 - HTTP URIs.
 - URN URIs. 
 - IANA media type tokens

There are existing problems for using the first two options that were
covered in XMLP group. 

It is also observed that there is already machinery and
implementations for recognizing IANA media type tokens for the
web. Therefore, we are making the suggestion that we should use the
media type token values as they would already be supported by the
underlying infrastructure that the web services would rely on.

Hence we propose the following text:

The value of the mediaType attribute component must be the name of a
IANA media type token, e.g."image/jpeg".

---------------------------------------------------------------------------

3.2 acceptedMediaType attribute component

Attribute declaration for the acceptedMediaType attribute specifies the
following Infoset properties:

-{name} acceptedMediaType 
-{target namespace}  http://www.w3.org/@@@@/@@/xmlmime; 
-{type definition} xs:string 
-{scope} global 

---------------------------------------------------------------------------

Issue (dependency)

The values for the acceptedMediaType component depends on the values
for of the mediaType. Based on our proposal for
Issue(choices_for_content_model), we propose the following:

The value that the type attribute component must follow the production
rules defined by HTTP 1.1 specification, Section 14.1 [IETF RFC 2616].

Issue (production_rules)

If we choose, this approach, we may want to repeat the production
rules in defining acceptable values as they include "Accept:" token as
part of the value. Therefore, the appendix schema uses the current
value defined by the [PASWA] document to reflect this in the schema.

---------------------------------------------------------------------------

4 Declaring media type for binary data

Documents that want to utilize additional media type information must
denote this by using a binary element information item. A binary element
information item is an element information item defined with the
following additional Infoset properties. 

- One or more attribute information items amongst its [attributes]
property, a binary element information item contains an OPTIONAL
mediaType attribute information item as described above in 3.1
mediaType attribute component.

- A type of the binary element information item must be a type derived
from or equal to xs:base64Binary.

The value of the mediaType attribute information item specifies the media 
type of the parent element information item. The presence of
the xmlmime:mediaType attribute does not change the value of the
element. 

Example:

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

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


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


</xs:element name="companyPicture" type="tns:Picture"/>

</xs:schema>


4.1 Role of xmlmime:acceptedMediaType attribute

The acceptedMediaType attribute is used for decorating the schema by using
Schema extensibility to indicate the accepted range of values for
xmlmime:mediaType attribute only. The xmlmime:acceptedMediaType
is intended to address Requirement (2).

---------------

Note: 

Alternative ways of indicating this meta-data has been covered and
discussed at the WSDL f2f in detail [WSDL Sept f2f]. The writeup tries to
capture the conclusions of this discussion. 

---------------

Applications that need to specify acceptable media types SHOULD use
the attribute when declaring binary elements to declare the range of
acceptable values. The decoration only applies as a hint for the
binary element information items in the Infoset. Therefore, it is used
in conjunction with the declaration of binary element information
items in the schema.  If xmlmime:acceptedMediaType attribute is not
used, the value "*/*" SHOULD be assumed.

Example: 

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:tns="http://example.com/thisexample"
           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:MediaType"/>
       </xs:extension>
   </xs:simpleContent>
</xs:complexType>


</xs:element name="companyPicture" type="tns:Picture" 
             xmlmime:acceptMediaType="image/*"/>

</xs:schema>

5 Examples

--------------------------------------------------------------------------

Note: This section may be redundant if the examples in the previous
section are considered to be adequate.

--------------------------------------------------------------------------

5.1 Example Schema

5.2 Example Document

6 Issues List

All known issues are currently identified in the sections above. 

7 References

[WS Activity] Web Services Activity. (See
http://www.w3.org/2002/ws/Activity.html.)

[WSD WG Web Services Description Working Group]. (See
http://www.w3.org/2002/ws/desc/.) 

[WSDL20] Web Services Description Language (WSDL) Version 2.0:Core Language. 
(See http://www.w3.org/2002/ws/desc/wsdl20)

[XMLP WG XML Protocol Working Group]. (See
http://www.w3.org/2000/xp/Group/.) 

[XMLP Archive] XML Protocol Discussion Archive. (See
http://lists.w3.org/Archives/Public/xml-dist-app/.)

[XML Schema: Structures] XML Schema Part 1: Structures, H. Thompson,
D. Beech, M. Maloney, and N. Mendelsohn, Editors. World Wide Web
Consortium, 2 May 2001. This version of the XML Schema Part 1
Recommendation is
http://www.w3.org/TR/2001/REC-xmlschema-1-20010502. The latest version
of XML Schema Part 1 is available at
http://www.w3.org/TR/xmlschema-1. (See
http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/.)

[XML Schema: Datatypes] XML Schema Part 2: Datatypes, P. Byron and
A. Malhotra, Editors. World Wide Web Consortium, 2 May 2001. This
version of the XML Schema Part 2 Recommendation is
http://www.w3.org/TR/2001/REC-xmlschema-2-20010502. The latest version
of XML Schema Part 2 is available at
http://www.w3.org/TR/xmlschema-2. (See
http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/.)

[IETF RFC 2396] Uniform Resource Identifiers (URI): Generic Syntax,
T. Berners-Lee, R. Fielding, L. Masinter, Authors. Internet
Engineering Task Force, August 1998. Available at
http://www.ietf.org/rfc/rfc2396.txt. (See
http://www.ietf.org/rfc/rfc2396.txt.)

[IETF RFC 2616] Header Field Definitions for HTTP 1.1 to indicate
acceptable media-types, R. Fieldingm, J. Gettys, J. Mogul, H. Frystyk,
L. Masinter, P. Leach, T. Berners-Lee, Authors, W3C/MIT, June
1999. Available at http://www.w3.org/Protocols/rfc2616/rfc2616.html
(See http://www.w3.org/Protocols/rfc2616/rfc2616.html.)

[IETF RFC 2046] Multipurpose Internet Mail Extensions
(MIME) Part Two: Media Types, N. Freed, N. Borenstein, Authors,
November 1996. Available at http://www.faqs.org/rfcs/rfc2046.html (See
http://www.faqs.org/rfcs/rfc2046.html.)

[IETF RFC 2119] Key words for use in RFCs to Indicate Requirement
Levels, S. Bradner, March 1997. Available at
http://www.faqs.org/rfcs/rfc2119.html (See
http://www.faqs.org/rfcs/rfc2119.html)

[XML Information Set] XML Information Set, J. Cowan and R. Tobin,
Editors. World Wide Web Consortium, 24 October 2001. This version of
the XML Information Set Recommendation is
http://www.w3.org/TR/2001/REC-xml-infoset-20011024. The latest version
of XML Information Set is available at
http://www.w3.org/TR/xml-infoset. (See
http://www.w3.org/TR/2001/REC-xml-infoset-20011024.)

[WSDL Sept f2f] WSDL WG September Face2Face Meeting Minutes, is
available at
http://lists.w3.org/Archives/Public/www-ws-desc/2003Sep/0218.html and
contains other references to presentations. (See
http://lists.w3.org/Archives/Public/www-ws-desc/2003Sep/0218.html.)

[PASWA] Proposed Infoset Addendum to SOAP Messages with Attachments
Version 0.61 draft is available at
http://www.gotdotnet.com/team/jeffsch/paswa/paswa61.html (See
http://www.gotdotnet.com/team/jeffsch/paswa/paswa61.html)

[MIFFY] MTOM Inclusion Format For You (MIFFY) Draft Available at 
http://lists.w3.org/Archives/Public/xml-dist-app/2004Jan/att-0023/miffy2004.html (See http://lists.w3.org/Archives/Public/xml-dist-app/2004Jan/att-0023/miffy2004.html)

8 Appendix Attribute Schema

-------------------------------------------------------------------

Note: We have used the definitions from [PASWA]
as a starting point. 

-------------------------------------------------------------------

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

<xs:attribute name="mediaType" >
    <xs:simpleType>
      <xs:restriction base="xs:string" >
      <xs:pattern value="(text|application|image|audio|video|model|multipart|message|x-[-.a-z0-9]+)/[a-z0-9][-.+a-z0-9]+(;\s?.+=.+)*" />
      </xs:restriction>
    </xs:simpleType>
</xs:attribute>

<xs:attribute name="acceptedMediaType" >
    <xs:simpleType>
      <xs:restriction base="xs:string" >
        <xs:pattern value="(text|application|image|audio|video|model|multipart|message|x-[-.a-z0-9]+)/[a-z0-9][-.+a-z0-9]+(;p=(1\.0|0\.\d+))?" />
      </xs:restriction>
    </xs:simpleType>
</xs:attribute>

</xs:schema>

Received on Monday, 12 January 2004 15:13:20 UTC