users@saaj.java.net

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

From: Carlo Bertoldi <carlo.bertoldi_at_ubiquity.it>
Date: Wed, 15 Feb 2012 11:45:59 +0100

Many thanks, you saved me so many hours of debugging.
I owe you a beer ;)
Cheers,
  Carlo

On 15/02/12 11:34, Brian Joh wrote:
> 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 <mailto: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 <tel:%2B39%2002%20288584.32> - Fax: +39 02
> 2829795 <tel:%2B39%2002%202829795>
> Email: carlo.bertoldi_at_ubiquity.it <mailto:carlo.bertoldi_at_ubiquity.it>
> Website: www.ubiquity.it <http://www.ubiquity.it>
>
>
>
>


-- 
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