File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes unable to read soapmessage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "unable to read soapmessage" Watch "unable to read soapmessage" New topic

unable to read soapmessage

chaitu sravs

Joined: Oct 21, 2009
Posts: 11
I have a file (test.xml) with the below content:

Content-Type: text/xml; charset=UTF-8

<soapenv:Envelope xmlns:soapenv="" xmlns:apache="" xmlns:mime="" xmlns:noprefix_defaultname="" xmlns:soap="" xmlns:soapenc="" xmlns:tns="urn:attachments.wsdl.test" xmlns:wsdl="" xmlns:xsd="">

Content-Type: text/plain

Hi this is the default mime content.

I have written the below java code (with the intention to get the XML part):


SEVERE: SAAJ0511: Unable to create envelope from given source
Exception in thread "main" com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source:

The SOAPPart is not retrieved. Getting SOAPBody fails with "com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:image/jpg. Is this an error message instead of a SOAP response?" message.

The getAttachments() returns an empty iterator.

Can someone show code for 1. getting the XML SOAP DOM object and 2. the attachment content from the above file?
chaitu sravs

Joined: Oct 21, 2009
Posts: 11
I am just wondering if there is any hint at what is wrong, I searched and searched but in vain...

The above SOAP request file and the Java code reproduce the stated problem in JDK1.6.

I agree. Here's the link:
subject: unable to read soapmessage
It's not a secret anymore!