Sending SOAP attachment

Has anyone successfully done this? I haven't been able to find a solution in ColdFusion. I've also read that since ColdFusion still runs on Apache Axis1 and SOAP attachments with MOTM (which is needed for the API we're communicating with) need Axis2 it won't work.
Is there a way to do this with Java?
Any help would be appreciated!

Well, after a lot of searching I've read that to split up the SOAP envelope and the actual file contents, one should use an httpparam of formfield and one of type file.
The steps I've taken so far to not get an error from the API:
set multipartType='related' on the HTTP request
Used HttpConnection.addParam( type='formfield', name='xmldata', value=XmlParse( RequestContent ) ) to set the actual SOAP envelope and contents
Set HttpConnection.addParam( type='file', name='CsvEmails', file=FileLocation, mimetype='text/csv' ) for the file itself
This goes through without an error by the API, but after looking at their logs, the "uploaded" file is only 9 Bytes large without the actual content.

Similar Messages

  • How to send soap attachment without SAAJ

    I have to send XML or text file as an attachment in the web service, just like email attachment. Currently I am intercepting the SOAP message (sent from web service client) and then adding an attachment using SAAJ. Can we send an attachment without intercepting and SAAJ in netbeans just like how we send other data (with basic datatypes ) as parameters to the web service operation ?
    TIA.

    Soap is a protocol that runs over TCP (sockets.) You can build the entire soap message by hand if you want to.
    That said adding something is dependent on the fact that the other side will consume it.

  • SOAP Attachements in Webservices

    Hi,
    Is there any way to send SOAP attachements while accessing the weblogic Webservices,
    i.e As a part of my client program, I want to attach a document/image to a SOAP
    message.
    Thanks in advance
    pidix

    user10455639 wrote:
    Yes I can..what I still dont understand from yourr email is why are you askign this..
    "if you can get the soap header"
    Because any header we should be able to retrieve from this context...Because I saw the following statement from [JavaDoc | http://e-docs.bea.com/wls/docs103/javadocs/weblogic/wsee/jws/JwsContext.html#getInputHeaders()].
    <<<<<<<<<<
    ....The SOAP headers used by WebLogic Workshop to manage conversations are included in the list of headers returned.
    <<<<<<<<<<
    If it works, then just use it :) because it is public supported
    Edited by: LJ on Apr 23, 2009 10:04 PM
    Edited by: LJ on Apr 23, 2009 10:21 PM

  • Sender SOAP Adapter: zipped Payload or zipped Attachement possible?

    Hi,
    I've a SOAP --> PI --> Proxy Scenario. As the payload of the message can become quite huge (around 10MB), I'd like to zip the message.
    From the documentation it's not clear for me if the Sender SOAP Adapter can be enhanced with the standard PayloadZipBean:
    "You cannot add your own modules to this adapter" --> so is it possible to use modules provided by SAP?
    If it's not possible: is there another way to send the message zipped via SOAP, e.g. as a additional attachement to the SOAP message, and to unzip the attachement / use the content of it as message payload for mapping?
    Please note: usage of SOAP is a must for that scenario.
    Best regards
    Holger

    > File size is a question due to limited network speed between sender and PI. If I can reduce the data package to be transferred, it'd be a big help. Therefore I'd like to zip the message.
    In this case it would be sufficient to use Content-Encoding gzip.
    This is part of the HTTP protocol and will be unzipped automatically by the HTTP framework, so you need not do anything special in SOAP adapter.
    See http://tools.ietf.org/html/rfc2616#section-14.11
    Check if your SOAP client is able to use that.
    Regards
    Stefan
    Edited by: Stefan Grube on Mar 31, 2009 2:11 PM

  • How to Send Multiple Attachment by SOAP Adapter

    Hi,
    How to send multiple attachment by SOAP Adapter.
    I am able to send single attachment but at the time of sending multiple attachment i am not able to see in SXMB_moni.
    Regards,
    Anurag

    On the communication channel, please check the 'Do Not Use SOAP envelope' option. Also, please, add the "nosoap" attribute to the SOAP adapter caller. Check the note below for more information
    #856597 FAQ: XI 3.0 / PI 7.0 / PI 7.1 SOAP Adapter
    > "How does the nosoap mode work for the SOAP sender adapter?"

  • Send SOAP DIME Attachment (please comment on my sample code)

    Hi All,
    I had hard time trying to find a send SOAP DIME attachment
    code for the web service. And here it is, I wrote one,
    but I use to easy way to deploy the service.
    I just simply change the extension .java to .jws,
    so, can you all tell me whether it will be a problem or not ?
    And please review my code below, I debugged and no error,
    but I am not sure if it is working right.
    Basiclly 2 operations:
    public String generateID(int artID)
    public File detachFile(String filename)
    Please comment on this code, I am trying to make it
    more robust, so, that I can redo it and post it to share with
    everybody.
    thanks,
    Derek
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Iterator;
    import java.io.*;
    import java.security.*;
    import java.security.NoSuchAlgorithmException;
    import javax.activation.DataHandler;
    import javax.activation.FileDataSource;
    import javax.xml.soap.AttachmentPart;
    import org.apache.axis.AxisFault;
    import org.apache.axis.Message;
    import org.apache.axis.MessageContext;
    import org.apache.axis.attachments.Attachments;
    import org.apache.axis.attachments.AttachmentsImpl;
    import org.apache.log4j.Logger;
    public class AttachmentYPMG
         private static final Logger _logger = Logger.getLogger(AttachmentYPMG.class);
         public AttachmentYPMG()
         public String generateID(int artID)
              String artid = Integer.toString(artID);
              String md5_hash_string = plainStringToMD5(artid);
              return md5_hash_string;
         private String plainStringToMD5(String input) {
                // Some stuff we will use later
                MessageDigest md = null;
                byte[] byteHash = null;
                StringBuffer resultString = new StringBuffer();
                // Bad things can happen here
                try {
                  // Choose between MD5 and SHA1
                       md = MessageDigest.getInstance("MD5");
                } catch(NoSuchAlgorithmException e) {
                    System.out.println("NoSuchAlgorithmException caught!");
                    System.exit( -1);
                // Reset is always good
                md.reset();
                // We really need some conversion here
               md.update(input.getBytes());
                // There goes the hash
                byteHash = md.digest();
               //  Now here comes the best part
                for(int i = 0; i < byteHash.length; i++) {
                  resultString.append(Integer.toHexString(0xFF & byteHash));
              // That's it!
              return(resultString.toString());
         public File detachFile(String filename)
              InputStream is = null;
              FileOutputStream os = null;
              File file = null;
              int totalAttachments ;
              try
                   //Get all the attachments
                   AttachmentPart[] attachments = getMessageAttachments();
                   * getMessageAttachments() as provided by Steve Loughran in his mail
                   * to axis-user group
                   * http://www.mail-archive.com/[email protected]/msg08732.html
                   //Put the logic in a loop for totalAttachments for multiple
                   // attachments.
                   totalAttachments = attachments.length;
                   _logger.debug("saveFile(String filename = " + filename + ") - " +
                                  "Total Attachments Received Are: "+ totalAttachments);
                   //Extract the first attachment. (Since in this case we have only one attachment sent)
                   DataHandler dh = attachments[0].getDataHandler();
                   //Extract the file name of the first attachment.
                   String name = filename;
                   _logger.debug("saveFile(String filename = " + filename + ") - File received on server is: " + name);
                   //Get the streams to file and from attachment, then stream to disk
                   is = dh.getInputStream();
                   file = new File(name);
                   os = new FileOutputStream(file);
                   this.writeBuffersAndClose(is, os);
              } catch (Exception e)
                   _logger.error("detachFile(String filename = " + filename + ")", e);
                   //throw new AttachmentException(e);
              //if(file!= null)
                        return file;
              //else
                   //throw new AttachmentException("The attachment was not saved");
         * extract attachments from the current request
         * @return a list of attachmentparts or an empty array for no attachments
         * support in this axis buid/runtime
         private AttachmentPart[] getMessageAttachments() throws AxisFault
              * Reusing the method implementation for AttachmentPart[]
              * getMessageAttachments() as provided by Steve Loughran in his mail to
              * axis-user group
              * http://www.mail-archive.com/[email protected]/msg08732.html
              MessageContext msgContext = MessageContext.getCurrentContext();
              Message reqMsg = msgContext.getRequestMessage();
              Attachments messageAttachments = reqMsg.getAttachmentsImpl();
              if (null == messageAttachments)
                   System.out.println("no attachment support");
                   return new AttachmentPart[0];
              int attachmentCount = messageAttachments.getAttachmentCount();
              AttachmentPart attachments[] = new AttachmentPart[attachmentCount];
              Iterator it = messageAttachments.getAttachments().iterator();
              int count = 0;
              while (it.hasNext())
                   AttachmentPart part = (AttachmentPart) it.next();
                   attachments[count++] = part;
              return attachments;
         * Simple method for writing one stream from another.
         * @param is
         * @param os
         * @throws IOException
         private void writeBuffersAndClose(InputStream is, OutputStream os)
              throws IOException
              int i = 0;
              byte [] buffer = new byte[1024];
              while (i != -1)
                   i = is.read(buffer, 0, buffer.length);
                   if(i > 0)
                        os.write(buffer, 0, buffer.length);
              is.close();
              os.close();

    Hi All,
    I had hard time trying to find a send SOAP DIME attachment
    code for the web service. And here it is, I wrote one,
    but I use to easy way to deploy the service.
    I just simply change the extension .java to .jws,
    so, can you all tell me whether it will be a problem or not ?
    And please review my code below, I debugged and no error,
    but I am not sure if it is working right.
    Basiclly 2 operations:
    public String generateID(int artID)
    public File detachFile(String filename)
    Please comment on this code, I am trying to make it
    more robust, so, that I can redo it and post it to share with
    everybody.
    thanks,
    Derek
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Iterator;
    import java.io.*;
    import java.security.*;
    import java.security.NoSuchAlgorithmException;
    import javax.activation.DataHandler;
    import javax.activation.FileDataSource;
    import javax.xml.soap.AttachmentPart;
    import org.apache.axis.AxisFault;
    import org.apache.axis.Message;
    import org.apache.axis.MessageContext;
    import org.apache.axis.attachments.Attachments;
    import org.apache.axis.attachments.AttachmentsImpl;
    import org.apache.log4j.Logger;
    public class AttachmentYPMG
         private static final Logger _logger = Logger.getLogger(AttachmentYPMG.class);
         public AttachmentYPMG()
         public String generateID(int artID)
              String artid = Integer.toString(artID);
              String md5_hash_string = plainStringToMD5(artid);
              return md5_hash_string;
         private String plainStringToMD5(String input) {
                // Some stuff we will use later
                MessageDigest md = null;
                byte[] byteHash = null;
                StringBuffer resultString = new StringBuffer();
                // Bad things can happen here
                try {
                  // Choose between MD5 and SHA1
                       md = MessageDigest.getInstance("MD5");
                } catch(NoSuchAlgorithmException e) {
                    System.out.println("NoSuchAlgorithmException caught!");
                    System.exit( -1);
                // Reset is always good
                md.reset();
                // We really need some conversion here
               md.update(input.getBytes());
                // There goes the hash
                byteHash = md.digest();
               //  Now here comes the best part
                for(int i = 0; i < byteHash.length; i++) {
                  resultString.append(Integer.toHexString(0xFF & byteHash));
              // That's it!
              return(resultString.toString());
         public File detachFile(String filename)
              InputStream is = null;
              FileOutputStream os = null;
              File file = null;
              int totalAttachments ;
              try
                   //Get all the attachments
                   AttachmentPart[] attachments = getMessageAttachments();
                   * getMessageAttachments() as provided by Steve Loughran in his mail
                   * to axis-user group
                   * http://www.mail-archive.com/[email protected]/msg08732.html
                   //Put the logic in a loop for totalAttachments for multiple
                   // attachments.
                   totalAttachments = attachments.length;
                   _logger.debug("saveFile(String filename = " + filename + ") - " +
                                  "Total Attachments Received Are: "+ totalAttachments);
                   //Extract the first attachment. (Since in this case we have only one attachment sent)
                   DataHandler dh = attachments[0].getDataHandler();
                   //Extract the file name of the first attachment.
                   String name = filename;
                   _logger.debug("saveFile(String filename = " + filename + ") - File received on server is: " + name);
                   //Get the streams to file and from attachment, then stream to disk
                   is = dh.getInputStream();
                   file = new File(name);
                   os = new FileOutputStream(file);
                   this.writeBuffersAndClose(is, os);
              } catch (Exception e)
                   _logger.error("detachFile(String filename = " + filename + ")", e);
                   //throw new AttachmentException(e);
              //if(file!= null)
                        return file;
              //else
                   //throw new AttachmentException("The attachment was not saved");
         * extract attachments from the current request
         * @return a list of attachmentparts or an empty array for no attachments
         * support in this axis buid/runtime
         private AttachmentPart[] getMessageAttachments() throws AxisFault
              * Reusing the method implementation for AttachmentPart[]
              * getMessageAttachments() as provided by Steve Loughran in his mail to
              * axis-user group
              * http://www.mail-archive.com/[email protected]/msg08732.html
              MessageContext msgContext = MessageContext.getCurrentContext();
              Message reqMsg = msgContext.getRequestMessage();
              Attachments messageAttachments = reqMsg.getAttachmentsImpl();
              if (null == messageAttachments)
                   System.out.println("no attachment support");
                   return new AttachmentPart[0];
              int attachmentCount = messageAttachments.getAttachmentCount();
              AttachmentPart attachments[] = new AttachmentPart[attachmentCount];
              Iterator it = messageAttachments.getAttachments().iterator();
              int count = 0;
              while (it.hasNext())
                   AttachmentPart part = (AttachmentPart) it.next();
                   attachments[count++] = part;
              return attachments;
         * Simple method for writing one stream from another.
         * @param is
         * @param os
         * @throws IOException
         private void writeBuffersAndClose(InputStream is, OutputStream os)
              throws IOException
              int i = 0;
              byte [] buffer = new byte[1024];
              while (i != -1)
                   i = is.read(buffer, 0, buffer.length);
                   if(i > 0)
                        os.write(buffer, 0, buffer.length);
              is.close();
              os.close();

  • How to send any text as soap attachment without SAAJ ?

    I have to send XML or text file as an attachment in the web service, just like email attachment. Currently I am intercepting the SOAP message (sent from web service client) and then adding an attachment using SAAJ. Can we send an attachment without intercepting and SAAJ in netbeans just like how we send other data (with basic datatypes ) as parameters to the web service operation ?
    TIA.

    Wrong forum where to ask such questions.
    Check this one link:
    http://www.unix.com/shell-programming-scripting/18370-sending-email-text-attachment-using-mailx.html?t=18370#post70254

  • Unable to send a SOAP attachment(pdf) in a BPEL process

    Dear Forum,
    I have a requirement to attach a pdf and send it as part of a BPEL process response. Following are the details,
    1) I have a webservice which does the logic of building the pdf and returns it as a SOAP attachment. I have tested this service through SOAP UI and it works fine.
    2) I have a BPEL process which invokes the above webservice and returns the received pdf as a SOAP attachment.
    3) Since BPEL designer doesn't directly support the MIME attachments, I have modified the WSDL related to BPEL process to include MIME parts. Followed the steps as mentioned in the SOA suite documentation - http://docs.oracle.com/cd/B14099_19/integrate.1012/b14448/manipdoc.htm#BABDEEEB
    4) I have tested my bpel service through SOAP UI tool (cannot test it in 'em' console since my service has mime parts) but unable to receive the pdf attachment. BPEL process is throwing the following exception,
    <Mar 26, 2012 5:21:07 PM EDT> <Warning> <oracle.adfinternal.view.faces.renderkit
    .rich.TreeRendererUtils> <BEA-000000> <Context menu child is not a RichMenu>
    <Mar 26, 2012 5:22:19 PM EDT> <Error> <oracle.soa.bpel.engine.ws> <BEA-000000> <
    got RuntimeException
    java.lang.NullPointerException
    at oracle.integration.platform.attchmnt.AttachmentManagerImpl.encodeProp
    erties(AttachmentManagerImpl.java:569)
    at oracle.integration.platform.attchmnt.AttachmentManagerImpl.insertAtta
    chment(AttachmentManagerImpl.java:483)
    at oracle.integration.platform.attchmnt.AttachmentManagerImpl.storeAttac
    hment(AttachmentManagerImpl.java:189)
    at oracle.integration.platform.attchmnt.AttachmentManagerImpl.storeAttac
    hment(AttachmentManagerImpl.java:144)
    From the SOAP UI response(error message), I found that 'Content-Type' for this request is coming as 'text/xml' rather than 'mimemultipartrelated'. Is it not possible to send pdf attachments through BPEL? Please provide your inputs to resolve this issue. I am stuck up with this issue for a while now.

    Hi Vamsee,
    In my case pdf is returned by a webservice, not from any physical location. The example given there shows attaching a pdf file from physical location. But I will get the pdf as part of another webservice response. So I am assigning the attachment to a bpel variable after getting the webservice response. This is where my bpel process is throwing an exception mentioned above.
    Regards,
    Satya.

  • OSB - send file in email attachment in SOAP attachment

    Hi!
    I would like to send a file in email in SOAP attachment.
    I thought it would be a simple task, I will create a proxy service, which calls a business service. There is a routing action in proxy service to business service and after the rouiting there is a replace action, I replace the attachments variable with this:
    <con:attachment xmlns:con="http://www.bea.com/wli/sb/context">
    <con:Content-Type>application/pdf</con:Content-Type>
    <con:Content-Transfer-Encoding>base64</con:Content-Transfer-Encoding>
    <con:Content-Disposition>attachment; filename="Simple.pdf"</con:Content-Disposition>
    <con:body>{$attachments/ctx:attachment/ctx:body}</con:body>
    </con:attachment>
    I received the email, but i cannot open the document, because it is corrupted...
    Please, could someone help me?
    I can't find out the solution.
    Thanks!
    Viktor

    Hi Anuj!
    Thanks for your answer again! :)
    I tried the blog and I could send email with attachment. My problem is that I have to put the file content into the webservice body when i call the proxy service as a webservice. But I want to put the file into the SOAP attachment. So this is my scenario:
    1. the service counsumer calls the proxy service webservice and the service consumer (client) put the file into the request SOAP attachment
    2. the proxy service calls the business service
    3. the business service sends the email with an attachment (and the file is into this attachment)
    Could You help me?
    Thanks!

  • "Content is not allowed in prolog" with SOAP Attachment

    I'm writing an application using SAAJ that sends a soap message to a servlet which responds with some information, including HTML which the client application will display. The HTML has to go into a SOAP attachment so the tags won't get confused with XML.
    I had the whole thing working with plain text sending within a normal node, and I only switched a few lines to make that text an attachment with HTML instead, but now I'm getting the exception "Content is not allowed in prolog" on the Client side when it tries to create the envelope from the SOAPMessage.
    Code for building answering SOAPMessage with attachment (Servlet to Client)
         public static SOAPMessage buildXML(Message newMessage){
              SOAPMessage msg = null;
              try {
                   MessageFactory msgFactory = MessageFactory.newInstance();
                   msg = msgFactory.createMessage();
                   // Create an envelope in the message
                   SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
                   msg.setProperty(SOAPMessage.WRITE_XML_DECLARATION, "true");
                   msg.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, "UTF-8");
                   //Get hold of the the body
                   SOAPBody body = envelope.getBody();
                   SOAPElement soap_message = body.addChildElement("MESSAGE");
                   if (newMessage.message_type != null){
                        SOAPElement soap_message_type = soap_message.addChildElement("MESSAGETYPE");
                        soap_message_type.addTextNode(newMessage.message_type);
                   if (newMessage.questionID != 0){
                        SOAPElement soap_questionID = soap_message.addChildElement("QUESTIONID");
                        soap_questionID.addTextNode("" + newMessage.questionID);
                   if (newMessage.username != null){
                        SOAPElement soap_username = soap_message.addChildElement("USERNAME");
                        soap_username.addTextNode(newMessage.username);
                   if (newMessage.password != null){
                        SOAPElement soap_password = soap_message.addChildElement("PASSWORD");
                        soap_password.addTextNode(newMessage.password);
                   if (newMessage.message_text != null){
                        AttachmentPart soap_message_text = msg.createAttachmentPart("<html><body>" + newMessage.message_text + "</body></html>", "text/html");
                        soap_message_text.setContentId("MESSAGETEXT");
                        msg.addAttachmentPart(soap_message_text);
                        //SOAPElement soap_message_text = soap_message.addChildElement("MESSAGETEXT");
                        //soap_message_text.addTextNode(newMessage.message_text);
                   if (newMessage.sampleString != null){
                        SOAPElement soap_password = soap_message.addChildElement("SAMPLESTRING");
                        soap_password.addTextNode(newMessage.sampleString);
                   SOAPElement tmpEl;
                   for (int i=0; i<newMessage.numArrayUsed; i++){
                        tmpEl = soap_message.addChildElement("SAMPLEINT");
                        tmpEl.addTextNode("" + newMessage.sampleInt);
                   msg.saveChanges();
              } catch (Exception e) {
                   e.printStackTrace();
              return msg;
    You can see in the area where it adds MESSAGETEXT there are two clients commented out which work. The three lines above it are what changed to make it an attachment instead.
    Code in Client for recieving reply from Servlet
    SOAPMessage reply = connection.call(soap_msg, endpoint);
    System.out.println("\nReceived reply from: " + endpoint);
    reply.writeTo(System.out);
    System.out.println("");
    reply_msg = ProcessXML.parse(reply);This is the console output:
    Edit: These forums seem to be inserting an extra > before the <?xml version="1.0" encoding="UTF-8"?> line, but it doesn't exist in the code I'm pasting
    Received reply from: http://localhost:8080/kuj/CaseStudyServlet
    ------=_Part_2_371807.1137465625031
    Content-Type: text/xml; charset=UTF-8
    <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><MESSAGE><MESSAGETYPE>deliverquestion</MESSAGETYPE><QUESTIONID>1</QUESTIONID><USERNAME>zac</USERNAME></MESSAGE></SOAP-ENV:Body></SOAP-ENV:Envelope>
    ------=_Part_2_371807.1137465625031
    Content-Type: text/html
    Content-Id: MESSAGETEXT
    <html><body>This is an Array sort Question. You will be given 10 random integers and you must sort and return them in the order of greatest to least.</body></html>
    ------=_Part_2_371807.1137465625031--
    ERROR:  'Content is not allowed in prolog.'
    17-Jan-2006 02:40:25 com.sun.xml.messaging.saaj.soap.EnvelopeFactory createEnvelope
    SEVERE: SAAJ0511: Unable to create envelope from given source
    com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source:
         at com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(EnvelopeFactory.java:111)
         at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java:39)
         at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:98)
         at com.zacwittedesign.xml.ProcessXML.realParse(ProcessXML.java:32)
         at com.zacwittedesign.xml.ProcessXML.parse(ProcessXML.java:26)
    (snip)And this is the beginning of the code for extracting the info from the SOAPMessage on the Client side:
    private static Message realParse(SOAPMessage msg){
              Message newMessage = new Message();
              try {
                   SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
                   SOAPBody body = envelope.getBody();
    (snip)It dies on SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
    Does anyone know what I'm doing wrong?

    I suppose I should also include the bit where the Servlet actually SENDs the resulting SOAPMessage
    SOAPMessage msg = ProcessXML.buildXML(outMessage);
    // try to send it
    try {
         response.setContentType("text/xml");
         msg.writeTo(response.getOutputStream());

  • Unique Problem: Returning SOAP+ Attachment using a class based webservice

    Hi everyone,
    Im trying to return a Soap+ attachment response back using the following:
    attachDoc(byte[] bdoc, String sTransactionNumber,
                   String sRequestedType)
    Where byte[] is the attachment and the 2 string parameters are soap message contents.
    The attachment is attached successfully to the message and i can send a response back to the clients console using :
    message.writeTo(System.out);
    My problem is that i dont know how to return this soapmessage+attachment back to the client.
    Ive tried using the return type of the method as :
    public SOAPMessage attachDoc(byte[] bdoc, String sTransactionNumber,
                   String sRequestedType)
    but i cant return a SOAPMessage return type in axis.
    Does anyone have any clues how i should sort this out so that the client gets the SOAPMessage and attachment when the method is called ?
    Please help :S
    Thanks,

    I dunno if this is what you asked for....
    Hope this helps a bit
    You may want to check this link out
    http://www-unix.globus.org/mail_archive/discuss/2007/02/msg00037.html
    MessageContext msgContext = MessageContext.getCurrentContext();
    File file = new File("filename.txt");
    org.apache.axis.attachments.AttachmentPart replyPart=
    new org.apache.axis.attachments.AttachmentPart(new DataHandler(new
    FileDataSource(file)));
    Message rspMsg= msgContext.getResponseMessage();
    rspMsg.addAttachmentPart(replyPart);
    so ur basically adding the file to the reply message.
    The link i gave has a better description, it has the entire process of sending file to server and downloading file from server codes.

  • Sender SOAP Adapter

    Hi,
    Scenario is Sender SOAP and Receiver (Server Proxy) .
    Integrated the ESS applications on .net portal using soap adapter..example salary slip, ctcview....
    If we give input as empno to soap adapter it will give you salary details back to .net portal.
    All this functional;ity are working fine..
    Now i need to check the authorization to acess this soap request. As this webservice works for all the employess in the organazation. but i need to restrict for few employees. Is there any authorization check in XI as it is there in ESS.
    If so how to use that . Now in .net portal they are useing the same user name and pwd for all the soap requests.
    Regards
    Vijay
    Edited by: vijay Kumar on May 25, 2010 11:18 AM

    Michal
    Hopefully I can help you for once!
    You can set the SOAP action to debug in the Java Admin Console.
    Set com.sap.aii.af.mp.soap and com.sap.aii.messaging set to DEBUG
    Set location
    &#61680;     Services
    &#61680;     Log Configurator
    &#61680;     Locations
    &#61680;     Choose com.sap.aii.messaging
    &#61680;     Assign Severity Debug
    See https://service.sap.com/sap/support/notes/856597 for more info...
    This note has a an attachment: tcpgw.zip for tracing the whole message...

  • SMIME in sender soap adapter

    Hi,
    I'd like to know the proper format of the POST request to a sender soap adapter with SMIME activated. I've found almost no documentation about it.
    I'm trying to send a document ciphered to PI via soap adapter (HTTP POST). I've done the following steps
    1. I activate SMIME in the sender soap adapter, and I specify "Decrypt" as the security procedure in the sender agreement. I also incorporate the private key in the keystore DEFAULT and reference to it in the sender agreement.
    2. I use OpenSSL to cipher an xml document like this (I use the public certificate associated to the previous private key) :
    --> openssl smime -encrypt -in fich.txt -out fich_encrypted.txt certTesting.pem
    What I get is:
    MIME-Version: 1.0
    Content-Disposition: attachment; filename="smime.p7m"
    Content-Type: application/x-pkcs7-mime; smime-type=enveloped-data; name="smime.p7m"
    Content-Transfer-Encoding: base64
    MIIC....[base64 content of the file encrypted]
    3. I use CURL to send the HTTP POST request to PI. Previously I get the binary file from the base64 content.
    > POST /XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_1[...]
    > Authorization: Basic c2U[...]
    > Host: pi.[...].com:50000
    > Accept: /
    > Content-Type: application/pkcs7-mime; smime-type=enveloped-data; name=fich_encrypted.der
    > User-Agent: Jakarta Commons-HttpClient/3.1
    > Accept-Encoding: text/xml
    > Content-Disposition: attachment; filename=fich_encrypted.der
    > Content-Length: 620
    > Expect: 100-continue
    but I get this error from the SOAP Adapter:
    --> java.io.IOException: invalid content type for SOAP: APPLICATION/PKCS7-MIME.
    I also get the same error if I remove the header Content-Disposition.
    4. If I send the xml file without ciphering (header Content-Type: text/xml;charset=UTF-8) I get the error:
    com.sap.engine.interfaces.messaging.api.exception.MessagingException: SOAP: call failed: java.lang.SecurityException: Exception in Method: VerifySMIME.run(). LocalizedMessage: SecurityException in method: verifySMIME( MessageContext, CPALookupObject ). Message: IllegalArgumentException in method: verifyEnvelopedData( ISsfProfile ). Wrong Content-Type: text/xml;charset=UTF-8. *Expected Content-Type: application/pkcs7-mime or application/x-pkcs7-mime*. Please verify your configuration and partner agreement
    PROBLEM --> I really don't know what the SOAP sender channel is expecting when SMIME is activated. I've tried to send the binary file encripted as an attachment and also directly, but the soap adapter complains.
    Thanks

    HI,
    for XI EP
    Please see the below links so that you can have clear Idea..
    /people/saravanakumar.kuppusamy2/blog/2005/02/07/interfacing-to-xi-from-webdynpro
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/java/integrating%20web%20dynpro%20and%20sap%20xi%20using%20jaxb%20part%20ii.article
    Consuming XI Web Services using Web Dynpro – Part II-/people/riyaz.sayyad/blog/2006/05/08/consuming-xi-web-services-using-web-dynpro-150-part-ii
    Consuming XI Web Services using Web Dynpro – Part I -/people/riyaz.sayyad/blog/2006/05/07/consuming-xi-web-services-using-web-dynpro-150-part-i
    /people/sap.user72/blog/2005/09/15/creating-a-web-service-and-consuming-it-in-web-dynpro
    /people/sap.user72/blog/2005/09/15/connecting-to-xi-server-from-web-dynpro
    Regards
    Chilla..

  • How to process a SOAP Attachment in XI

    Hi,
    I have a SOAP-RFC-SOAP Synchronous scenario. Here the SOAP Message comes with an attachment. I need to process the SOAP Attachment through XI and need to map the content to the RFC and send the response back to the webservice. Here PayloadSwapBean does not work in Sender soap Adapter. Is there any other option of achieving this.
    Thanks,
    Bhargav

    Ask Michal
    The specified item was not found.
    Need need to implement the other direction.
    Regards
    Stefan

  • BPM to soap Attachment

    Hi
    My Scenario is from BPM to soap in synchronous mode in PO.
    BPM is sending request to web service and getting response as attachment in Excel file.
    for BPM to PI  connection ,PI is using sender soap adapter with XI 3.0 message protocol .
    for webservice to PI connection .PI is  using receiver soap adapter with message protocol soap 1.1.
    is it possible to receive excel sheet as attachment from receiver soap adapter ?
    is it possible process excel sheet as attachment to BPM using XI3.0 message protocol?
    Thanks
    Harsh

    Hi harshalata,
    is it possible to receive excel sheet as attachment from receiver soap adapter ?
    are you telling that you want to send attachment to receiver using receiver soap adapter? or to receive response as an attachement?
    PI 7.0 :: Keep attachments in SOAP receiver adapter
    is it possible process excel sheet as attachment to BPM using XI3.0 message protocol?
    as per below link you can not process attachment in BPM.
    PI and BPM Runtime Integration - Process Orchestration - SAP Library

Maybe you are looking for