users@jax-ws.java.net

Re: SOAP attachments Interoperability

From: Anne Thomas Manes <atmanes_at_gmail.com>
Date: Tue, 28 Feb 2006 08:00:53 -0500

Florian,

There are three choices for attachment protocols:
- WS-Attachments over DIME (DIME)
- SOAP with Attachment over MIME (SwA)
- MTOM over MIME (MTOM)

ASP.NET with WSE 2.0 supports DIME.
ASP.NET with WSE 3.0 supports MTOM
WCF supports MTOM.

JAX-WS supports SwA (by default) and MTOM (when enabled).

Axis 1.x supports SwA and DIME.
Axis 2 supports MTOM.

The best choice for interoperability is definitely MTOM.

When using MTOM, you don't actually define an attachment -- you simply
define the binary file as part of your SOAP message as
type="xsd:base64Binary" or type="xsd:hexBinary. MTOM automatically packages
all binary types as MIME attachments for you transparently. You indicate the
type of content in the element at runtime using an MTOM attribute extension,
xmime:contentType. So, for example, the element would be define thus:

    <xs:element name="MyBinaryData">
      <xs:complexType>
        <xs:simpleContent>
          <xs:extension base="xs:base64Binary" >
            <xs:attribute ref="xmime:contentType" use="required"/>
          </xs:extension>
        </xs:simpleContent>
      </xs:complexType>
    </xs:element>

The xmime:base64Binary and xmime:hexBinary types have been predefined adding
xmime:contentType attribute. In addition, you can identify what type of data
might be expected in the element using the xmime:expectedContentType
attribute. e.g.,

xmime:expectedContentTypes="image/jpeg, image/png"


These MTOM extensions are defined in the "Describing Media Content of Binary
Data in XML" specification (
http://www.w3.org/TR/2005/NOTE-xml-media-types-20050504/).

Here are some useful links with samples/instructions:
http://www.codeproject.com/soap/MTOMWebServices.asp
http://java.sun.com/webservices/docs/2.0/jaxws/mtom-swaref.html

Anne

On 2/28/06, Florian Rengers <rengers_at_grit.de> wrote:
>
> Hi all,
>
> I have to write a SOAP Service with J2EE that deliver different
> documents like Word, pdf and image files.
>
> As a Service Consumer I have to write a dotNET Client which invokes the
> service with the identifier of the desired document.
>
>
> I have three main questions:
>
> 1.)
> There are many types of attachment handlings and encodings like MTOM,
> sWA, DIME and MIME.
> Which of these are really both supported from .NET and from a Java.
> A read that I should use mime for an interoperable service, but I also
> read that dotNET does not support MIME encoding.
>
>
> 2.)
> Which Java Technology should I use for this, Apache Axis or JAX-WS?
> I personally would prefer JAX-WS, but AXIS is in a wide use, has a more
> production state and has a better support for attachment handling, I
> suppose.
>
>
> 3.)
> Do I have to define the attachment type in the wsdl-file. I saw some
> examples in which that was done.
> This is a problem for me because as I described the attachment type will
> differ for each response.
>
>
> Hope that someone can help me out of my uncertainty.
>
> greetings
>
> Florian
> istList
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jax-ws.dev.java.net
> For additional commands, e-mail: users-help_at_jax-ws.dev.java.net
>
>