users@saaj.java.net

Re: Bad Content-Type for SOAP Part : text/plain

From: Brian Joh <brianj_at_twitter.com>
Date: Wed, 15 Feb 2012 05:34:50 -0500

Looks like there is an empty line before the Content-Type in the SOAP
part. The "Content-Type: text/xml" line that follows is then interpreted
as inside the body instead of the header, which then makes the Content-Type
default to text/plain.

-- 
Brian Joh
Software Engineer
Twitter Mobile
http://twitter.com/brianwjoh <http://www.twitter.com/brianwjoh>
On Wed, Feb 15, 2012 at 4:33 AM, Carlo Bertoldi
<carlo.bertoldi_at_ubiquity.it>wrote:
> Hello,
>  I'm having a problem with SAAJ 1.3.18 on jdk6 and JBoss 5.1.
>
> This is the SOAP request I'm sending to my servlet:
>
> POST /gestorepmu/commFactory HTTP/1.1
> Connection: keep-alive
> Content-Type: multipart/related;boundary=---**-_Part_3_5438437.**
> 1107262647279;type="text/xml"
> Content-Length: 1108
> User-Agent: Java/1.6.0_29
> Host: localhost:8080
> Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
>
>
> ------_Part_3_5438437.**1107262647279
>
> Content-Type: text/xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <soap-env:Envelope xmlns:soap-env="http://**schemas.xmlsoap.org/soap/**
> envelope/ <http://schemas.xmlsoap.org/soap/envelope/>">
>  <soap-env:Body>
>    [...]
>  </soap-env:Body>
> </soap-env:Envelope>
>
> ------_Part_3_5438437.**1107262647279
> Content-Type: text/xml
>
> text
> ------_Part_3_5438437.**1107262647279--
>
>
> I'm parsing it with the following instructions:
>
> messageFactory = MessageFactory.newInstance(**SOAPConstants.SOAP_1_1_**
> PROTOCOL);
> message = messageFactory.createMessage(**mimeHeaders,
> req.getInputStream());
>
> But I keep getting this exception:
> com.sun.xml.messaging.saaj.**SOAPExceptionImpl: Bad Content-Type for SOAP
> Part : text/plain
>
> I really don't understand where that text/plain comes from.
> Can some help me, please?
> Cheers,
>  Carlo
>
> --
> Ubiquity - A little bit forward
> *Carlo Bertoldi*
> Ubiquity
> Via Teodosio 65 - 20131, Milano
> Fisso: +39 02 288584.32 - Fax: +39 02 2829795
> Email: carlo.bertoldi_at_ubiquity.it
> Website: www.ubiquity.it
>