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 Afkham Azeez <af...@gmail.com> on 2006/03/02 05:29:42 UTC

[Axis2] MIME Parsing fails with Sun's JavaMail API Implementation

Hi Folks,
I encountered a somewhat critical situation, where if we use Sun's
JavaMail API implementation, instead of Geronimo's JavaMail API
implementation, parsing of MIME Encoded messages fails. The initial
failure occurs in the javax.mail.internet.ContentType class, where we
pass in the Content-Type header.

I reckon when we deploy axis2.war in Tomcat, if  the Sun JavaMail API
implementation gets placed ahead of Gernimo's implementation, we'll
not be able to process MIME Encoded messages. Thoughts?

FYI, I'm attaching a stacktrace below:
----------------------------------------------- Stack Trace
-----------------------------------------------------
org.apache.ws.commons.om.OMException: Invalid Content Type Field in
the Mime Message
        at org.apache.ws.commons.attachments.MIMEHelper.<init>(MIMEHelper.java:112)
        at org.apache.axis2.transport.TransportUtils.selectBuilderForMIME(TransportUtils.java:204)
        at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:97)
        at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:66)
        at org.apache.axis2.saaj.SOAPPartImpl.<init>(SOAPPartImpl.java:126)
        at org.apache.axis2.saaj.SOAPMessageImpl.<init>(SOAPMessageImpl.java:68)
        at org.apache.axis2.saaj.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:160)

caused by:
javax.mail.internet.ParseException
	at javax.mail.internet.ParameterList.<init>(ParameterList.java:81)
	at javax.mail.internet.ContentType.<init>(ContentType.java:82)
-------------------------------------------- End of Stack Trace
---------------------------------------------

The relevant Content-Type header valueis;
multipart/related;
boundary=MIMEBoundaryurn:uuid:F02ECC18873CFB73E211412712924004;
type=application/xop+xml;
start=<0....@apache.org>;
start-info=text/xml; charset=UTF-8

The above header is Parsed successfully if we use Geronimo's implementation.

--
Thanks
Afkham Azeez

Re: [Axis2] MIME Parsing fails with Sun's JavaMail API Implementation

Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
On Thu, 2006-03-02 at 11:49 +0000, Steve Loughran wrote:
> Looks like xop+xml is not a valid mime type. There is a bug in some of 
> suns xsd's that say that + isnt allowed in a mime type, perhaps this is 
> the same in software.

It is a valid MIME type:

www.iana.org/assignments/media-types/application/xop+xml. Sun needs to
understand that MIME types can be registered after their software is
written. Duh.

> Where is the content-type being set? I'd change it.

No way; they need to fix their code ..

We should record this as a known bug in their stuff.

Sanjiva.


Re: [Axis2] MIME Parsing fails with Sun's JavaMail API Implementation

Posted by Steve Loughran <st...@apache.org>.
Afkham Azeez wrote:
> Hi Folks,
> I encountered a somewhat critical situation, where if we use Sun's
> JavaMail API implementation, instead of Geronimo's JavaMail API
> implementation, parsing of MIME Encoded messages fails. The initial
> failure occurs in the javax.mail.internet.ContentType class, where we
> pass in the Content-Type header.
> 
> I reckon when we deploy axis2.war in Tomcat, if  the Sun JavaMail API
> implementation gets placed ahead of Gernimo's implementation, we'll
> not be able to process MIME Encoded messages. Thoughts?
> 
> FYI, I'm attaching a stacktrace below:
> ----------------------------------------------- Stack Trace
> -----------------------------------------------------
> org.apache.ws.commons.om.OMException: Invalid Content Type Field in
> the Mime Message
> 
> The relevant Content-Type header valueis;
> multipart/related;
> boundary=MIMEBoundaryurn:uuid:F02ECC18873CFB73E211412712924004;
> type=application/xop+xml;
> start=<0....@apache.org>;
> start-info=text/xml; charset=UTF-8
> 
> The above header is Parsed successfully if we use Geronimo's implementation.
> 


Looks like xop+xml is not a valid mime type. There is a bug in some of 
suns xsd's that say that + isnt allowed in a mime type, perhaps this is 
the same in software.

Where is the content-type being set? I'd change it.

Re: [Axis2] MIME Parsing fails with Sun's JavaMail API Implementation

Posted by Steve Loughran <st...@apache.org>.
Thilina Gunarathne wrote:
> Hmmmm...Too bad...
> 
> It seems the content-types generated by the two implementations are not
> interoperable.. Did you try using SUN Mail in both the client and server
> sides.
> 
> 
>> The relevant Content-Type header valueis;
>> multipart/related;
>> boundary=MIMEBoundaryurn:uuid:F02ECC18873CFB73E211412712924004;
>> type=application/xop+xml;
>> start=<0....@apache.org>;
>> start-info=text/xml; charset=UTF-8
> 
>> The above header is Parsed successfully if we use Geronimo's
> implementation.
> 
> We need to have a look at the MIME specs to see whether this is valid or not
> (Or a comment from a MIME GURU)....Then we can file a bug report to the
> appropriate impl...

+xml is the allowed way to declare stuff is of an xml-derived format, 
but not everything handles it yet.

there is an errata for sun to fix their servlet xsd:
http://jcp.org/aboutJava/communityprocess/maintenance/jsr154/errata204.txt

but it is not applied to the official schema, as of last month
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd

Probably safest to switch.

NB, the sun mail, activation implementations all come with glassfish; 
the source is public on their license. Someone on the maven list is 
working out how to rebuild and redist the glassfish versions (the 
binaries have stricter restrictions than the source, see)

-steve

Re: [Axis2] MIME Parsing fails with Sun's JavaMail API Implementation

Posted by Thilina Gunarathne <cs...@gmail.com>.
Hmmmm...Too bad...

It seems the content-types generated by the two implementations are not
interoperable.. Did you try using SUN Mail in both the client and server
sides.


>The relevant Content-Type header valueis;
>multipart/related;
>boundary=MIMEBoundaryurn:uuid:F02ECC18873CFB73E211412712924004;
>type=application/xop+xml;
>start=<0....@apache.org>;
>start-info=text/xml; charset=UTF-8

>The above header is Parsed successfully if we use Geronimo's
implementation.

We need to have a look at the MIME specs to see whether this is valid or not
(Or a comment from a MIME GURU)....Then we can file a bug report to the
appropriate impl...

~Thilina

--
"May the SourcE be with u"
http://webservices.apache.org/~thilina/
http://thilinag.blogspot.com/
http://www.bloglines.com/blog/Thilina