You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ax...@ws.apache.org on 2004/10/16 00:17:52 UTC

[jira] Updated: (AXIS-1609) No option available to map all MIME type to javax.activation.DataHandler as required by JAX-RPC 1.1 specification.

The following issue has been updated:

    Updater: sebastien tardif (mailto:at925@freenet.carleton.ca)
       Date: Fri, 15 Oct 2004 3:17 PM
    Comment:
The WSDL file containing some attachments using MIME type application/octet-stream. Attachment done using SwA standard.
    Changes:
             Attachment changed to docHarbor.wsdl
    ---------------------------------------------------------------------
For a full history of the issue, see:

  http://issues.apache.org/jira/browse/AXIS-1609?page=history

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/AXIS-1609

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: AXIS-1609
    Summary: No option available to map all MIME type to javax.activation.DataHandler as required by JAX-RPC 1.1 specification.
       Type: Bug

     Status: Unassigned
   Priority: Major

    Project: Axis
 Components: 
             WSDL processing
   Versions:
             1.2 Beta

   Assignee: 
   Reporter: Sébastien Tardif

    Created: Thu, 14 Oct 2004 8:19 AM
    Updated: Fri, 15 Oct 2004 3:17 PM
Environment: Axis 09/23/2004

Description:
My use case is to use SwA and doing streaming from end to end. The type of attachment is not known. So as suggested by many documents I use the mime type: "application/octet-stream". Wsdl2Java utility use org.apache.axis.attachments.OctetStream to represent the data. It's a class specific to Axis which is one of my concern.

Take a look a the class:
public class OctetStream {
    private byte[] bytes = null;

    public OctetStream() {
    }

    public OctetStream(byte[] bytes) {
        this.bytes = bytes;
    }

    public byte[] getBytes() {
        return this.bytes;
    }

    public void setBytes(byte[] bytes) {
        this.bytes = bytes;
    }
}

It doesn't support streaming! It's probably the reason why people will use attachment instead of the most compatible way: "xsd:base64Binary".

As a third issues:

The JAX-RPC 1.1 specification said:


7.5 Mapping between MIME types and Java types
The following table specifies the standard Java mapping for a subset of the MIME types.
The Java to WSDL/XML and WSDL/XML to Java mapping for the MIME types is
required to conform to the above mapping. This mapping is reflected in the mapped Java
method signatures and WSDL description. A WSDL/XML to Java mapping tool is
required to provide an option to map the above set of MIME types to the
javax.activation.DataHandler class. The DataHandler class provides methods to
get access to the stream representation of the data for a MIME type.
A Java to WSDL mapping tool is required to provide a facility for specifying metadata
related to the above mapping between Java and MIME types. This metadata identifies
whether a Java type is mapped to a MIME type (using the WSDL MIME binding) or is
mapped to an XML schema type (based on the section 4.2, "XML to Java Type
Mapping"). For example, a java.lang.String can be mapped to either an xsd:string
or MIME type text/plain. The mapping metadata identifies a specific mapping.
If a MIME type is mapped to the javax.activation.DataHandler, the getContent
method of the DataHandler class must return instance of the corresponding Java type
for a specific MIME content type.
A JAX-RPC implementation is required to support the above MIME types (as specified
in the TABLE 7-1) and provide implementation of the required
javax.activation.DataContentHandler classes.
...
A JAX-RPC implementation is not required to support MIME types beyond that
specified in the above table. These additional MIME types may be mapped and
supported using the javax.activation.DataHandler class and Java Activation
Framework.
TABLE 7-1 Mapping of MIME Types
MIME Type Java Type
image/gif java.awt.Image
image/jpeg java.awt.Image
text/plain java.lang.String
multipart/* javax.mail.internet.MimeMultipart
text/xml or application/xml javax.xml.transform.Source

Here the approch of another stack:

From: https://jax-rpc.dev.java.net/whitepaper/1.1.2/attachments-howto.html

JAXRPC specification uses the JavaBeans Activation Framework to support various MIME content types. The DataHandler class provides a consistent interface to the data represented in various MIME types. A DataHandler class uses the DataContentHandler interface to convert between a stream and specific Java object based on the MIME type. JAXRPC uses SAAJ, which provides DataContentHandlers for the MIME types supported by JAXRPC. If the MIME type is not one of the JAXRPC supported MIME types, then the user has to register corresponding DataContentHandlers. Here "text/plain" and "text/xml" are both JAXRPC supported MIME types and is taken care of automatically. A DataHandler can be instantiated using the constructor DataHandler(Object obj, String mime_type). The method DataHandler.getContentType returns the MIME type of the encapsulatd data and DataHandler.getContent method retruns a Java object based on the MIME type of the encapsulated data. If you do not want the MIME types to map to coresponding Java types, you can use wscompile with -datahandleronly option to map all MIME types to DataHandler.



---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira