SOAP Message Attachment MIME Problem

Hi there,
I'm having problem trying to send a binary file with SOAP.
I can send an XML Doc (MIME type text/xml) but when I try to put the ByteArrayInputStream that holds the binary file and the content to application/octec-stream
I got this exception:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type application/octet-stream
     at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:851)
     at javax.activation.DataHandler.writeTo(DataHandler.java:305)
     at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1089)
     at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:635)
     at javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:233)
     at com.sun.xml.messaging.soap.MessageImpl.saveChanges(MessageImpl.java:371)
Anyone had this problem ?
Any work around ?
Or this is a problem because the JAXM is not fineshed yet ?
Thanks,
Marcio

Hey guys... I pray you are all still listening.
I have been on the most mind numbing cookie trail ever (I'm blatantly lying - I'm a Java programmer!) following these blasted exception trails to an 'Unknown Source'
After initially reading this thread I quickly knocked up ObjectDataSource as follows:
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;
import javax.activation.DataSource;
public class ObjectDataSource
implements DataSource
     public static final long serialVersionUID;
     public static final String CONTENT_TYPE;
     static {
          serialVersionUID = 42L;
          CONTENT_TYPE = "application/x-java-serialized-object";
     } // end static initializer
     private byte[] objectBytes;
     private String contentId;
     public ObjectDataSource(Serializable object, String contentId)
     throws IOException
          if (contentId == null || contentId.equals(""))
               this.contentId = object.getClass().getName();
          else
               this.contentId = contentId;
          ByteArrayOutputStream baoStream = new ByteArrayOutputStream();
          ObjectOutputStream ooStream = new ObjectOutputStream(baoStream);
          ooStream.writeObject(object);
          ooStream.flush();
          ooStream.close();
          objectBytes = baoStream.toByteArray();
     } // end primary constructor
     public InputStream getInputStream()
     throws java.io.IOException
          ByteArrayInputStream baiStream = new ByteArrayInputStream(objectBytes);
          return new ObjectInputStream(baiStream);
     } // end getInputStream
     public OutputStream getOutputStream()
     throws java.io.IOException
          throw new IOException("Cannot write to this stream");
     } // end getOutputStream
     public String getContentType()
          return CONTENT_TYPE;
     } // end getContentType
     public String getName()
          return contentId;
     } // end getName
} // end ObjectDataSource classand use it as follows:
AttachmentPart attachment = soapResponse.createAttachmentPart();
ObjectDataSource ods = new ObjectDataSource(requestedObject, null);
attachment.setDataHandler(new DataHandler(ods));
attachment.setContentId(ods.getName());
soapResponse.addAttachmentPart(attachment);
soapResponse.saveChanges();... this is within my 'SOAPServlet extends JAXMServlet' servlet, which happens to work fine when testing the servlet outside a web-container. But testing with Tomcat 5.5.x It doesn't work... infact, it damn well dissappears. I try readObject after retrieving and casting the InputStream to an ObjectInputStream from the AttachmentPart, but I get a:
Exception in thread "main" java.lang.ClassCastException: java.io.ByteArrayInputStream which is totally bizzare!
So I do a bit of investigation to discover ....
application/x-java-serialized-object
java.lang.String
javax.mail.internet.MimePartDataSource
java.io.ByteArrayInputStream
0 // this would be the available bytes in the ByteArrayInputStreamNow the first two lines confirm my ObjectDataSource is there somewhere or that that data was sent over the wire (ha, i'm on the same damn machine), but where the hell did MimePartDataSource come from?
I have previously encountered the various exceptions including java.io.EOFException when trying to read from the byte stream and java.io.StreamCorruptedException when wrapping that byte stream with an object stream.
These setbacks have royally ****ed my project; cahnces are slim that it will get finished. I'm ready to give up.
Any help will be appreciated?
Warm regards,
Darren B

Similar Messages

  • Passing Soap message in Mime message

    Hi, is it possible to Passing Soap message in Mime message. if yes, please direct me to some sample codes. thanks

    Your question is sounds little ambiguous. A SOAP message is basically XML over HTTP. So the mime would be XML. What do you mean by "SOAP message in MIME message"?

  • Save Message as Mime problem

    I would like to save the current message as Mime from within code.
    I have tried using the ItemSaveMessage() Token, but keep getting an invalid parameter error.
    Do you have any ideas on what could be causing this, I have tried many different ways and still get this same error.
    Here is my code:
    object oAccount = state.CurrentAccount;
    GroupwareTypeLibrary.Account8 account;
    if (!(oAccount == null))
    account = ((GroupwareTypeLibrary.Account8)(oAccount));
    int stCount = account.SentItems.Messages.Count;
    message = (GroupwareTypeLibrary.Message3)account.SentItems.M essages.Item(stCount);
    GroupWiseCommander.GWCommander cmd = new GroupWiseCommander.GWCommanderClass();
    string strRes = "";
    string command = "ItemSaveMessage(" + '"' + message.MessageID + '"' + ',' + '"' + "C:\\" + '"' + ',' + '"' + "Mime" + '"' + ")";
    cmd.Execute(command, out strRes);

    Hi,
    I also trying the same against GroupWise 7 client. I got the same error and then I made some changes to the command as below:
    ItemSaveMessage("4A76C845.*";"C:\gw.eml";900)
    Please note that the 1st parameter should be a proper message ID. I guess you can also use 00 to save the current message.
    The MIME get saved to the file location I have specified, but the content of the file is not valid (it is corrupted).
    Can somebody help me to resolve this issue?
    Thanks,
    Hilmi.
    Originally Posted by CandiceS
    I would like to save the current message as Mime from within code.
    I have tried using the ItemSaveMessage() Token, but keep getting an invalid parameter error.
    Do you have any ideas on what could be causing this, I have tried many different ways and still get this same error.
    Here is my code:
    object oAccount = state.CurrentAccount;
    GroupwareTypeLibrary.Account8 account;
    if (!(oAccount == null))
    account = ((GroupwareTypeLibrary.Account8)(oAccount));
    int stCount = account.SentItems.Messages.Count;
    message = (GroupwareTypeLibrary.Message3)account.SentItems.M essages.Item(stCount);
    GroupWiseCommander.GWCommander cmd = new GroupWiseCommander.GWCommanderClass();
    string strRes = "";
    string command = "ItemSaveMessage(" + '"' + message.MessageID + '"' + ',' + '"' + "C:\\" + '"' + ',' + '"' + "Mime" + '"' + ")";
    cmd.Execute(command, out strRes);

  • Downloading soap message attachement

    Hi experts,
    In my scenario, ABAP Proxy is sending an attachement. I could see that attachement in MONI, now i need to download that attachement to an ftp server. Can someone help me what are the various parameters i need to configure in FILE receiver communication channel?

    Hi Kiran,
    You want to use File adapter it means that First your Proxy will dump the file at some location (on the server/FTP) and then from there you will pick that file.
    It can be achived without any Design. You only need to Do the configuration part give any dummy interface and namespace and configure the file adapter properly like give Source address and destination address.
    thanks
    Sunil Singh

  • ABAP runtime error in sxmb_moni when SOAP message has header with some tags

    Hi!!!
    I have a problem with sxmb_moni transaction.
    If I double-click on a successfully processed
    message, then this monitor can't show me
    the message details but fails with the following error:
    <COPY_AND_PASTE_FROM_SCREEN>
    Runtime errors         OBJECTS_OBJREF_NOT_ASSIGNED_NO                              
    Exception              CX_SY_REF_IS_INITIAL                                        
    Occurred on     02.03.2005 at 16:44:21  
    Access with 'ZERO' object reference not possible.                                                
    What happened?                                                            
    Error in ABAP application program.                                                 
    The current ABAP program "CL_XMS_PROP_STRING============CP " had to be             
    terminated because one of the                                                     
    statements could not be executed.                                                  
    This is probably due to an error in the ABAP program.
    </COPY_AND_PASTE_FROM_SCREEN>
    This situation takes place only when I want
    to look at a SOAP message which was sent to XI
    from .Net platform or was sent to
    .Net platform from XI (via SOAP adapter).
    In all other cases sxmb_moni works fine.
    I know that the problem is connected with some tags from Header record of SOAP message:
          <soap:Header>
             <wsa:Action>http://aaa.bbb.ccc/MessageResponse</wsa:Action>
             <wsa:MessageID>uuid:1838f870-1688-4cfe-8c4f-afe14d98c515</wsa:MessageID>
             <wsa:RelatesTo>uuid:308b950f-8cff-4b63-9861-93b041825f9d</wsa:RelatesTo>
             <wsa:To>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:To>
             <wsse:Security>
                <wsu:Timestamp wsu:Id="Timestamp-389847df-8760-4d57-9777-6ce159d85205">
                   <wsu:Created>2005-03-02T08:54:29Z</wsu:Created>
                   <wsu:Expires>2005-03-02T08:59:29Z</wsu:Expires>
                </wsu:Timestamp>
             </wsse:Security>
          </soap:Header>
    If I take a SOAP message I have problem with, and
    I remove all tags from this Header (or remove
    the whole Header) and send it from any XML editor
    that can send SOAP messages then sxmb_moni hasn't
    any problems with showing me details of a such message.
    Any hints how to force a .Net platform not to send
    a such header or how to force sxmb_moni transaction
    not to fail if a such header occurs?
    Regards,
    Andrzej Filusz

    Hi Santhosh
    1.Check your authorization settings in XI and R/3. Whether the user has sufficient rights to execute the Function Module etc. This is the most common reason for this error.
    2.If the XI system was brought online even before the R/3 system then re-activate the communication channels from the Integration directory.
    Cheers..
    Vasu
    <u><i><b>** Reward Points if found useful **</b></i></u>

  • SOAP messages Listener, help plz

    I'm new to web services and I have to do a projec that makes some analysis on the SOAP messages. My problem now is how to catch the SOAP messages sent/received by a web service and save it for the further analysis?. I'm using Apache Axis2 with jdk 1.6 using Eclipse. Could anyone suggest me how to do it please

    I am connecting to the database successfully ....
    but I am not able to use my web application....
    when I am typing the address of my web applicaion it is giving me the error as...plz confirm that is it a Listener error..or ODBS error
    Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
    [Oracle][ODBC][Ora]ORA-12541: TNS:no listener

  • Axis SOAP Adapter - Setting MIME headers for attachements (Handlers?)

    Hello,
    I need to know if/how it is possible to set the individual MIME headers of the parts making up a multipart/related SOAP message using only standard Axis Handlers e.g. "com.sap.aii.axis.xi.XI30DynamicConfigurationHandler" (as described in the Axis FAQ in Note 1039369).
    I know I can insert transport headers  using "com.sap.aii.axis.xi.XI30DynamicConfigurationHandler", but I can't see a way of setting a MIME header for, say, the first part (i.e. the SOAP part) or the second part (e.g. an attachement). Is this possible without writing your own Axis handler? The Axis FAQ, in "Advanced usage question 31" implies that you can set MIME Headers but only shows an example of setting the transport header.
    I am using the SOAP Adapter to send a message comprising and XML message (in the SOAP body) and a PDF document (as an attachement). The external company this is being sent to requires that we have specific values for the "Content-Id" MIME header in each part of the multipart/related document. This is why I need to understand if we can do this without writing our own Axis Handler.
    Incidentally, I have tried to write a custom Axis Handler but couldn't get PI to find it after deployment. I did this by inserting my JAR file in the "com.sap.aii.adapter.lib.sda" (as per Notes 1039369 / 1138877) and then using JSPM. After deployment, though, when I tried to start the SOAP Adapter I got the following error in the RWB: "failed to initialize: org.apache.axis.ConfigurationException: java.lang.ClassNotFoundException: com.hp.gerryaxis.GerryAxis..." (my class was called "GerryAxis" and I placed this in package "com.hp.gerryaxis"). I'm not an experienced Java programmer (my background is in ABAP), so if anyone can suggest whey I'm getting this error, I'd be very grateful (for example, could my choice of package be causing the problem?).
    Thanks for your help.

    I went ahead and wrote a simple bespoke Axis Handler. By invoking this from the standard "HandlerBean" in the module processor of my communication channel, I was able to overwrite and set new MIME headers in the Attachment Parts of my SOAP Message. I was also able to change the contents of the SOAP Envelope; for example, I found I could easily delete the SOAP Header. However, I've encountered a problem when I try and update the MIME headers of the SOAP Part i.e. the Part of the multipart/related message containing the SOAP Envelope.
    Does anyone know why I can't seem to change the MIME headers of the SOAP Part?
    The Axis API calls I used were as follows:
    (1) To update the MIME headers of attachements in my SOAP message:
    (a) Message = MessageContext.getCurrentMessage()
    (b) Iterator = Message.getAttachments()
    (c) AttachmentPart = Iterator.getNext()
    (d) AttachmentPart.setMimeHeader(name, value)
    This works.
    (2) To update the MIME headers of the SOAP (root) Part:
    (a) Message = MessageContext.getCurrentMessage()
    (b) SOAPPart = Message.getSOAPPart()
    (c) SOAPPart.setMimeHeader(name, value)
    This DOESN'Twork - the MIME headers of the SOAP Part never change.
    (3) To update the SOAP Envelope (delete the SOAP Header):
    (a) Message = MessageContext.getCurrentMessage()
    (b) SOAPPart = Message.getSOAPPart()
    (c) SOAPEnvelope = SOAPPart.getEnvelope()
    (d) SOAPHeader = SOAPEnvelope.getHeader()
    (e) SOAPHeader.removeContents()
    This works.
    I just don't understand why the call to SOAPPart.setMimeHeader() doens't work when I try and insert new MIME headers to the SOAP Part (e.g. "Content-Name") or when I try and change existing MIME headers there (e.g. "Content-ID"). I don't get any errors.
    The code of my handler is:
    @(#)GerryAxis.java       
    Set MIME headers in the SOAP and specified attachment part of a message
    package com.hp.handlers;
    import org.apache.axis.handlers.BasicHandler;
    import org.apache.axis.AxisFault;
    import org.apache.axis.attachments.AttachmentPart;
    import org.apache.axis.Message;
    import org.apache.axis.MessageContext;
    import java.util.Iterator;
    import javax.xml.soap.SOAPMessage;
    import javax.xml.soap.SOAPEnvelope;
    import javax.xml.soap.SOAPHeader;
    import javax.xml.rpc.handler.soap.SOAPMessageContext;
    The <code>GerryAxis</code> handler class sets MIME headers.
    <p>
    This handler accepts the following parameters:
    <ul>
    <li><b>name</b>: Name of header
    <li><b>value</b>: Value for header
    <li><b>attachment</b>: Attachment number
    </ul>
    public class GerryAxis extends BasicHandler {
      /* (non-Javadoc)
    @see org.apache.axis.Handler#invoke(org.apache.axis.MessageContext)
      public void invoke(MessageContext msgContext) throws AxisFault {
        int i=0;
        boolean found = false;
        AttachmentPart ap = null;
        javax.xml.soap.SOAPPart sp = null;
        StringBuffer debug = new StringBuffer();
        try {
          // The MIME header change is controlled from the parameters "name", "value", "attachment" which  are
          // set in the module processor as parameters.
          String name  = (String)getOption("name");
          String value = (String)getOption("value");
          String attachment  = (String)getOption("attachment");
          Message msg = msgContext.getCurrentMessage();
          // Get the SOAP Part (the part holding the SOAP Envelope
          sp = msg.getSOAPPart();
          if (sp == null)
              debug.append("getSOAPPart returned <null> / ");
          // Set a MIME header in the SOAP Part - THIS DOES NOT WORK - WHY?     
          sp.setMimeHeader(name,value);
          // Remove the SOAP Header for the Envelope - this works fine
          SOAPEnvelope se = sp.getEnvelope();
          SOAPHeader sh = se.getHeader();
          sh.removeContents();
          // For debugging - writes some debuggin information to a "DEBUG" MIME header in the first Attachement Part
          debug.append("name = " + name +" / ");
          debug.append("value = " + value +" / ");
          debug.append("attachment = " + attachment + " / ");
          debug.append("getMimeHeader for SOAPPart returned " + sp.getMimeHeader(name)[0] + " / ");
          debug.append("getContentId for SOAPPart returned " + sp.getContentId() + " / ");
          // Update the specified attachement's MIME header - this works fine
          Iterator it = msg.getAttachments();
          while (it.hasNext()) {
            i++;
            ap = (AttachmentPart) it.next();
            if (i == new Integer(attachment).intValue()) {
              found = true;
              break;
          if (found) {
            ap.removeMimeHeader(name);
            ap.setMimeHeader("DEBUG",debug.toString());
            ap.setMimeHeader(name,value);
          msg.saveChanges();
        catch (Exception e) {
          throw AxisFault.makeFault(e);
    Thanks
    Edited by: Gerry Deighan on Oct 3, 2010 10:27 PM

  • Writting attached file from SOAP message to a FTP folder

    Hi everybody,
    Our scenario is an interface which receives a SOAP message with a file attached. As we don't need to do any mapping into the attachment, we are supposed to deliver that file as it is into a FTP folder.
    Our problem is that we cannot find how to configure File comm channel to write the attached file and no the SOAP XML message which is what we are getting now. Any help on this?
    Thanks in advance.

    Hi
    check these forum posts
    SOAP with attachments
    Mail Sender Adapter - Attachment Handling
    Regards
    Vishnu

  • Adding PDF file as attachment to SOAP message

    Hi,
    I want to add a pdf file from the hard disk to a soap message as attachment. I have the following code:
    // CREATE MESSAGE
    SOAPMessage msg= fac.createMessage();
    SOAPEnvelope nEnv= msg.getSOAPPart().getEnvelope();      
    //READ FILE FROM THE HD
    String pdfFileName = "somepdffile.pdf";      
    FileReader fr = new FileReader(pdfFileName);
    BufferedReader buffr = new BufferedReader(fr);
    String sPdf="";
    String line = testB.readLine();
    while(line!=null)
    sPdf += line;
    line = testB.readLine();
    //WRITE THE FILE TO BYTE ARRAY AND THEN TO STREAM
    byte[] pdfData = sPdf.getBytes();
    ByteArrayInputStream stream = new ByteArrayInputStream(pdfData);
    //CREATE ATTACHMENT ADD THE STREAM AS CONTENT
    AttachmentPart attPDF = msg.createAttachmentPart();          
    attPDF.setContent(stream, "application/pdf");
    msg.addAttachmentPart(attPDF);          
    return msg;
    I GET THE NEXT EXCEPTION:
    javax.activation.UnsupportedDataTypeException: no object DCH for MIME type application/pdf
    at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:851)
    at javax.activation.DataHandler.writeTo(DataHandler.java:305)
    at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1089)
    at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:635)
    at javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:233)
    at com.sun.xml.messaging.soap.MessageImpl.saveChanges(MessageImpl.java:356)
    at javax.xml.messaging.JAXMServlet.doPost(JAXMServlet.java:192)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
    at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
    at java.lang.Thread.run(Thread.java:536)
    javax.xml.soap.SOAPException: java.security.PrivilegedActionException: javax.xml.messaging.JAXMException: Bad response: (500, Internal Server Error)
    at com.sun.xml.messaging.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:93)
    at mp.soap.SendingServlet.getPolisPrint(SendingServlet.java:320)
    at mp.soap.SendingServlet.doPost(SendingServlet.java:234)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
    at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
    at java.lang.Thread.run(Thread.java:536)
    CAN ANYONE TELL ME WHAT THE SOLUTION IS ?
    PLEASE HELP ME !!!
    Birol

    testB == buffr ! Sorry.
    IT IS STILL NOT WORKING !!!!!
    // CREATE MESSAGE
    SOAPMessage msg= fac.createMessage();
    SOAPEnvelope nEnv= msg.getSOAPPart().getEnvelope();
    //READ FILE FROM THE HD
    String pdfFileName = "somepdffile.pdf";
    FileReader fr = new FileReader(pdfFileName);
    BufferedReader buffr = new BufferedReader(fr);
    String sPdf="";
    String line = buffr.readLine();
    while(line!=null)
    sPdf += line;
    line = buffr.readLine();
    //WRITE THE FILE TO BYTE ARRAY AND THEN TO STREAM
    byte[] pdfData = sPdf.getBytes();
    ByteArrayInputStream stream = new ByteArrayInputStream(pdfData);
    //CREATE ATTACHMENT ADD THE STREAM AS CONTENT
    AttachmentPart attPDF = msg.createAttachmentPart();
    attPDF.setContent(stream, "application/pdf");
    msg.addAttachmentPart(attPDF);
    return msg;

  • 2 levels of MIME attachments in SOAP message

    Hello,
    I'm not a java specialist, and i want to know a few things before i start something wich eventually turns out impossible to do.
    i want to create a SOAP message with one attachment. this attachment must be a multipart/mixed MIME message itself:
    -- Part1
    soapxml
    -- Part1 (1 SOAP attachment = MIME message)
    Content-Type: multipart/mixed; boundary:"Part2"
    -- Part2
    subAttachA
    -- Part2
    subAttachB
    -- Part2
    subAttachC
    --Part2
    --Part1
    * first of all: should i use a MimeBodyPart objects for subAttachX and create it with MimeMultiPart.createMimeBodyPart() ?
    - that MimeMultiPart i create like this: new MimeMultiPart("mixed") ?
    - THIS IS THE MOST IMPORTANT: how do i get this MimeMultiPart into the SOAP attachment part ?
    could this work:
    //MimeMultipart extends MultiPart + constr: new MimePartDataSource(MultiPart part)
    MimePartDataSource mds = new MimePartDataSource(MimeMultiPart multipart);
    //MimePartDataSource extends DataSource + constr: DataHandler(DataSource ds)
    DataHandler dh = new DataHandler(mds);
    //will the following line automatically set: Content-Type: multipart/mixed; boundary:"Part2"
    //if not, how can i obtain the boundary (="Part2")
    AttachmetPart ap = soapMessage.CreateAttachmetPart(dh);
    //will i still be able to set the Content-Id
    ap.setContentId("miID");
    All help greatly appreciated,
    Pieter

    Did you already tried the way i described ?
    because i can't start untill another question is answered, maybe you know the answer:
    http://forum.java.sun.com/thread.jsp?forum=34&thread=351252

  • Outbound SOAP Message with Attachment

    The requirement is to invoke a web service by sending attachments in the outbound SOAP message. The attachment body needs to be assigned in the message flow, using an element E1 extracted from the message incoming into the flow.
    I am trying to use attachments variable to set content-type (text/xml) and body using E1. However, these are not getting assigned to attachments variable, as seen by logging the variable.
    I was told that $attachments cannot be changed inside the flow (it is marked black in the console unlike the header and body that are marked green). If that is the case, how do we invoke services using attachments from a message flow?
    Any pointers would be appreciated.

    Hi,
    A SOAP message may need to be transmitted together with attachments of various sorts, ranging from facsimile images of legal documents to engineering drawings. Such data are often in some binary format. For example, most images on the Internet are transmitted using either GIF or JPEG data formats. In this document we describe a standard way to associate a SOAP message with one or more attachments in their native format in a multipart MIME structure for transport.
    yes it is possible to send attachment with the SOAP.
    SOAP Message Packages
    A "SOAP message package" contains a primary SOAP 1.1 message. It may also contain additional entities that are not lexically within the SOAP message but are related in some manner. These entities may contain data in formats other than XML. The primary SOAP 1.1 message in a message package may reference the additional entities. Such additional entities are often informally referred to as "attachments." This section describes how to construct SOAP message packages and how SOAP processors will process them.
    A SOAP message package is constructed using the Multipart/Related media type, which is defined in RFC 2387. The rules for the construction of SOAP message packages are as follows:
    The primary SOAP 1.1 message must be carried in the root body part of the Multipart/Related structure. Consequently the type parameter of the Multipart/Related media header will always equal the Content-Type header for the primary SOAP 1.1 message, i.e., text/xml.
    The MIME Multipart/Related encapsulation of a SOAP message is semantically equivalent to a SOAP protocol binding in that the SOAP message itself is not aware that it is being encapsulated. That is, there is nothing in the primary SOAP message proper that indicates that the SOAP message is encapsulated .
    For more details you can refer these links
    http://www.w3.org/TR/SOAP-attachments
    http://www.w3.org/TR/soap12-af/
    regards
    Aashish Sinha
    PS : reward points if helpful

  • Soap message with Attachment

    Hi All,
    I have a requirement wherin I have to send an attachment(image) along with the soap payload.i.e. the soap message contains the payload and an attachment.For eg. the soap message is as shown below:
    <?xml version="1.0" encoding="UTF-8" ?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
      <SOAP-ENV:Body>
        <ns1:MT_Soap xmlns:ns1="http://www.adc.com/sample">
             <Record>
                <FieldXML>abc</FieldXML>
                <FieldAthmt />
             </Record>
          </ns1:MT_Soap>
      </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    How can I include the attachment(which is on a local machine) in the above soap message?
    Is it posssible to send the attachment in the field "FieldAtthmt"?
    If it is possible to send an attachment with the soap message then how can that attachment be handled in XI?
    Thanks in advance,
    Vikram

    Hi,
    A SOAP message may need to be transmitted together with attachments of various sorts, ranging from facsimile images of legal documents to engineering drawings. Such data are often in some binary format. For example, most images on the Internet are transmitted using either GIF or JPEG data formats. In this document we describe a standard way to associate a SOAP message with one or more attachments in their native format in a multipart MIME structure for transport.
    yes it is possible to send attachment with the SOAP.
    SOAP Message Packages
    A "SOAP message package" contains a primary SOAP 1.1 message. It may also contain additional entities that are not lexically within the SOAP message but are related in some manner. These entities may contain data in formats other than XML. The primary SOAP 1.1 message in a message package may reference the additional entities. Such additional entities are often informally referred to as "attachments." This section describes how to construct SOAP message packages and how SOAP processors will process them.
    A SOAP message package is constructed using the Multipart/Related media type, which is defined in RFC 2387. The rules for the construction of SOAP message packages are as follows:
    The primary SOAP 1.1 message must be carried in the root body part of the Multipart/Related structure. Consequently the type parameter of the Multipart/Related media header will always equal the Content-Type header for the primary SOAP 1.1 message, i.e., text/xml.
    The MIME Multipart/Related encapsulation of a SOAP message is semantically equivalent to a SOAP protocol binding in that the SOAP message itself is not aware that it is being encapsulated. That is, there is nothing in the primary SOAP message proper that indicates that the SOAP message is encapsulated .
    For more details you can refer these links
    http://www.w3.org/TR/SOAP-attachments
    http://www.w3.org/TR/soap12-af/
    regards
    Aashish Sinha
    PS : reward points if helpful

  • How to attach a DOM object as stream to SOAP message?

    Hi friends,
    I want to attach a parsed XML document (DOM object) to SOAP message, but but I do not want to attach it as a String, instead, I want to attach it as a binary format, given a DOM object.
    Any one can help tell me what can I do for it? and what is the content type it should be?
    Thanks!

    I knew the Java Doc API, actually I can attach text string format, but since what I want is binary data (i.e, serialize form of DOM stream), it does not seem to work as attachment.
    1).if I use:
    attachment.setContent(doc, "application/octec-stream");it throws:
    javax.activation.UnsupportedDataTypeException: no object DCH for MIME type application/octec-stream
    2). if I use:
    attachment.setContent(doc, "application/xml");it still throws:
    javax.activation.UnsupportedDataTypeException: no object DCH for MIME type application/octec-stream
    3). if I use serailized form of the document String docString = DOMUtil.serializeDocument(doc);
    attachment.setContent(docString, "text/xml");I checked the docString, which is like this form:
    <?xml version="1.0"?>
    <a xmlns="http://foo.org">
    <b>text</b>
    </a>
    but it throws:
    java.io.IOException: Unable to run the JAXP transformer on a stream null
    3). it only works if I use serailized form of the document, and set content-type to "text/plain"
    String docString = DOMUtil.serializeDocument(doc);
    attachment.setContent(docString, "text/plain");Any idea what is wrong here?
    Thanks!

  • Reading attachment in SOAP message with ABAP mapping

    I am searching an ABAP code to read attachment in sender SOAP message..
    I am using PI 7.3, I can read by java mapping but I get another error after reading the attachment.. So I try to abap mapping..
    That's it..
    Thanx ..

    Hello Mark,
    1. My Soap Sender Adapter, I checked the Keep Attachment option
    2. I am getting the WSDL file from the SOAP Sender Agreement.. it is like http(s)://host:port/XISOAPAdapter/MessageServlet?channel=p:s:c? as you said.
    I used the user-defined function, it works when <inc:Include href="cid:test.jpg" xmlns:inc="http://www.w3.org/2004/08/xop/include" /> is deleted in the message.
    If the coming message includes <inc:Include href="cid:test.jpg" xmlns:inc="http://www.w3.org/2004/08/xop/include" />,
    the <null> error occurs.
    Thanx for your reply..

  • Attach file to XI SOAP message

    Hi,
    Good day...
    Can any body help me how to attach file to XI SOAP message. The file to be attached is in TXT format.
    Your help is much appreciated.
    Thank you very much...
    maaukaau

    Hi-
    <i>1) In this scenario, can I access the Ms-Access locally with XI server?</i>
    Yes you can access
    <i>2) if yes then why I am not able to update the database.</i>
    Check if the JDBC adpter is configured properly and also if the cache is updated.
    Hope this links helps you.
    /people/bhavesh.kantilal/blog/2006/07/03/jdbc-receiver-adapter--synchronous-select-150-step-by-step -- JDBC receiver adapter (synchronous step by step)
    /people/sameer.shadab/blog/2005/10/24/connecting-to-ms-access-using-receiver-jdbc-adapter-without-dsn -- Connect to MS Access database using reciever JDBC
    For Configuring jDBC adapter -
    http://help.sap.com/saphelp_nw2004s/helpdata/en/22/b4d13b633f7748b4d34f3191529946/frameset.htm

Maybe you are looking for

  • How to make a Website in Muse with a Login Forum

    I need to build a website for a client in Muse which has access to a Login Forum, so that users can login to a secure site and upload messages and images/video. I have never done this before, but I'm quite experienced in other aspects of Web Design a

  • Fixed Day in a week as Delivery date in Purchase Order.

    Dear All I have the below requirement For a material/ vendor combination users would like see  always a fixed day as delivery date in Purchase Order. For  example for a Material X and Vendor Y always Wednesday of the week should be delivery date. Whe

  • How to find out captured audio data is stored completely

    We are using livepkgr to capture audio with AMS Standard. Since server-side scripting is not available with AMS Standard, we are using a PHP script to manipulate captured audio. Everything works well in testing, but we are wondering about the followi

  • Public class or just simply class?

    As I continue my reading into various books there are some books which will have you add the access modifier public in front of your classname. Other books will just have you leave it out. I tried out a simple program that declared a class in a separ

  • Running an AIR app as a service.

    Hi, I'm trying to use the ServerSocket class in AIR to make a server of some sort.  The problem is that I cannot get it to run as a windows service.  I used "sc create" to create the service.  I don't call nativeWindow.activate, so there shouldn't be