-SAAJ0511: Unable to create envelope from given source
843833May 12 2005 — edited Jan 28 2007I have a file which has the content of a SOAP message (with attachment) as followed:
------=_Part_0_7640919.1115912226734
Content-Type: text/xml
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header><edc:transid xmlns:edc="http://www.edc.com">4</edc:transid><edc:cmdid xmlns:edc="http://www.edc.com">50</edc:cmdid><edc:attDataInfo xmlns:edc="http://www.edc.com">.\testdata\FormExample.xml</edc:attDataInfo></SOAP-ENV:Header><SOAP-ENV:Body/></SOAP-ENV:Envelope>
------=_Part_0_7640919.1115912226734
Content-Type: image/jpeg
���� JFIF �� C
------=_Part_0_7640919.1115912226734--
I'm trying to load the content of this file into a soap message (as code given below), but it crashed with the message just after printing the string "3333" from my code:
-SAAJ0511: Unable to create envelope from given source
Any idea why?
I did my test with a simple String text attachment, but no help neither.
=============
private MimeHeaders createMimeHeaders(String mimeType) {
MimeHeaders mimeHeaders = new MimeHeaders();
mimeHeaders.setHeader("Content-Type", mimeType);
return mimeHeaders;
}
InputStream inputData = new BufferedInputStream(new FileInputStream(new File("mySoapMsgInFile.txt")));
SOAPMessage soapMessage= MessageFactory.newInstance().createMessage(createMimeHeaders("text/xml"), inputData)
SOAPPart soapPart = soapMessage.getSOAPPart();
System.out.println("3333");
SOAPEnvelope envelope = soapPart.getEnvelope();
System.out.println("4444");
this.header = envelope.getHeader();
....