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

Similar Messages

  • !!One clear answer on MIME attachments for SOAP!!

    There are a lot of answers in the forum but one states this the other another solution and it is quite confusing for me to find my way out the soap.
    I'm programming in java ofcourse working on soap and saaj packages. How can i send to the client a soap message that will include a mime type attachment??
    Thank you in advance :)

    I haven't used mine for booting, just for backup.
    StorageReview use to be a good source for reviews and benchmark numbers - but need to take a grain of salt - not identical to how a drive will perform under OS X or using HFS+.
    Your standard quiet fast WD Caviar 640:
    HD Tune: WDC WD6400AAKS-00A7B0 Benchmark
    Transfer Rate Minimum : 59.1 MB/sec
    Transfer Rate Maximum : 109.1 MB/sec
    Transfer Rate Average : 93.7 MB/sec
    Access Time : 11.8 ms
    Burst Rate : 87.2 MB/sec
    CPU Usage : 19.3%
    WD Green Power 1TB
    HD Tune: WDC WD10EADS-00L5B1 Information
    Firmware version : 01.0
    WDC WD10EADS-00L5B1
    Transfer Rate Minimum : 41.6 MB/sec
    Transfer Rate Maximum : 95.6 MB/sec
    Transfer Rate Average : 74.3 MB/sec
    Access Time : 14.0 ms
    Burst Rate : 115.7 MB/sec
    CPU Usage : 4.5%
    Black Caviar: HD Tune: WDC WD1001FALS-00J7B Benchmark
    Transfer Rate Minimum : 53.9 MB/sec
    Transfer Rate Maximum : 108.7 MB/sec
    Transfer Rate Average : 86.1 MB/sec
    Access Time : 12.9 ms
    Burst Rate : 111.5 MB/sec
    CPU Usage : 2.8%
    The Green drive I think has changed slightly in the year it has been out (you would hope so for all drives, often firmware tweaks and drive mechanics, DSP chip, whatever) but it has had variable speed, 5400 rpm speed, and not designed for quick fast changes and seeks - the type of characteristics for random file access and low latency that your 10K Raptor enjoys.

  • Does Workshop deal with SOAP Messages with Attachments

    I try to send back an image from my web service. Is there a way to make a SOAP Messages
    with Attachments using BEA Workshop?
    Thanks,
    Jerome.

    Hi Jerome,
    I'm pretty sure that Workshop doesn't support SwA (SOAP with Attachments) yet. The
    product manager says that it is being considered for a future version, though :-)
    In the meantime, I don't see any reason why you can't just use a Java class that
    uses the JavaMail API to construct a Multipart MIME message. The MimeMultipart class
    (the one that acts as a container for a multipart/related document) has a writeTo()
    method that you can use to populate a ByteArrayOutputStream. Afterwards, you should
    be able to use the toByteArray() method on this ByteArrayOutputStream, to create
    the byte[] that maps to a xsd:base64Binary data type. The nice thing about this,
    is that the target web service has complete access to the SOAP message (in the first
    Body part), and all the attachments :-)
    Just a thought...
    Mike Wooten
    "Jerome Sonnet" <[email protected]> wrote:
    >
    I try to send back an image from my web service. Is there a way to make
    a SOAP Messages
    with Attachments using BEA Workshop?
    Thanks,
    Jerome.

  • How to send a SOAP message with attachments

    How to send a SOAP message with attachments thru webservice using axis-1_3 can any one sujjest.............................

    Please refer
    http://www.javaworld.com/javaworld/jw-09-2003/jw-0912-webservices.html
    http://xml.sys-con.com/read/40315.htm

  • 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"?

  • SOAP Mime Attachments

    I'm new to web services.. before actually getting my hands dirty.. I need to figure out some things before deciding i will undertake a project..
    I'm thinking of an asynchronous setup..were clients submit batches of data to a web method...clients will poll the service for a response
    (see pattern 3 > http://www.ibm.com/developerworks/library/ws-asynch2/index.html)
    This system must use web standards.. as more then 1 organisation will participate
    this will be a mixed environment - some clients will submit data on the fly, others will send batches
    Each entry in the batch will have 2 images of 3k each ...it seems that the problem is with memory allocation rather than the network performance.
    I'm estimating 500 records per batch.. so a typical payload would come up to 3mb
    Does using SOAP MIME attachments resolve this issue? from what i understood.. this avoids having the images loaded memory as part of the DOM tree..
    would this setup even work??

    Hi I'm in the same boat... can we get some help?
    Thanks

  • 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

  • Signing a soap message seems to not work in jwsdp14

    I'm trying to sign a soap message according to the latest oasis specifications (http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0.pdf) using the libraries provided with jwsdp14 (mainly xmlsec.jar).
    As far as I know, there is not yet documention/example about this specific issue.
    The following is the code I have to sign a soap message: it seems to work fine because the signed soap message respects the above specifications... but what I notice is that the digest and the signature values it contains are always the same, I mean: if i change the source soap message, the signed soap message in output is always the same!
    Any clue??
    import com.sun.org.apache.xml.security.Init;
    import com.sun.org.apache.xml.security.signature.XMLSignature;
    import com.sun.org.apache.xml.security.transforms.Transforms;
    import com.sun.org.apache.xml.security.utils.Constants;
    import com.sun.xml.wss.*;
    import com.sun.xml.wss.reference.DirectReference;
    import org.w3c.dom.Document;
    import javax.xml.soap.SOAPHeader;
    import javax.xml.soap.SOAPMessage;
    import javax.xml.soap.SOAPBody;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.security.PrivateKey;
    import java.security.cert.X509Certificate;
    public class Main {
    public static void main(String[] args) {
    // The file from which we will load the sample SOAP message
    String fileName = "F:\\SampleSoapMessage.xml";
    // Store the WSSE signed message here
    String signatureFileName = "F:\\SignedSampleSoapMessage.xml";
    try {
    // Initialize the apache libraries
    Init.init();
    // Obtain security elements from the keystore
    PrivateKey privateKey = MySecurityUtils.getPrivateKey();
    X509Certificate cert = MySecurityUtils.getCertificate();
    // Obtain a sample SOAPMessage from a file
    FileInputStream fis = new FileInputStream(new File(fileName));
    Document doc = XMLUtil.toDOMDocument(fis);
    SOAPMessage message = MyFileUtils.getMessageFromFile(doc);
    SOAPHeader header = message.getSOAPHeader();
    SOAPBody body = message.getSOAPBody();
    // Set the wsu:Id attribute to the Body
    XMLUtil.setWsuIdAttr(body, "MyId");
    // Create a WSSE context for the SOAP message
    SecurableSoapMessage sssm = new SecurableSoapMessage(message);
    // Create a security header for the message (<wsse:Security>)
    SecurityHeader sh = sssm.findOrCreateSecurityHeader();
    // Insert the certificate (<wsse:BinarySecurityToken>)
    X509SecurityToken stoken = new X509SecurityToken(header.getOwnerDocument(), cert, "X509TokenRef");
    sh.insertHeaderBlock(stoken);
    // Insert the keyinfo referring to the certificate (<ds:KeyInfo>)
    KeyInfoHeaderBlock kihb = new KeyInfoHeaderBlock(header.getOwnerDocument());
    SecurityTokenReference secTR = new SecurityTokenReference(header.getOwnerDocument());
    DirectReference dirRef = new DirectReference();
    dirRef.setURI("#X509TokenRef");
    secTR.setReference(dirRef);
    kihb.addSecurityTokenReference(secTR);
    //sh.insertHeaderBlock(kihb);
    // Insert the Signature block (<ds:Signature>)
    SignatureHeaderBlock shb = new SignatureHeaderBlock(header.getOwnerDocument(), XMLSignature.ALGO_ID_SIGNATURE_RSA);
    Transforms transforms = new Transforms(header.getOwnerDocument());
    transforms.addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS);
    shb.addSignedInfoReference("#MyId", transforms, Constants.ALGO_ID_DIGEST_SHA1);
    shb.addChildElement(kihb.getAsSoapElement());
    sh.insertHeaderBlock(shb);
    // Digest all References (#MyId) in the SignedInfo, calculate the signature value
    // and set it in the SignatureValue Element
    shb.sign(privateKey);
    // Add the signature data to the header element
    header.addChildElement(sh.getAsSoapElement());
    // Save the signed SOAP message
    FileOutputStream fos = new FileOutputStream(new File(signatureFileName));
    message.writeTo(fos);
    message.writeTo(System.out);
    } catch (Exception exc) {
    exc.printStackTrace();
    System.out.println("An error has occurred : " + exc.toString());
    PS: Classes MySecurityUtils and MyFileUtils are not included since they have nothing interesting.
    The sample input sopa message is:
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
    <Intestazione>
    </Intestazione>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    and the output signed sample message is:
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header>
    <wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
    <ds:SignedInfo>
    <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
    <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
    <ds:Reference URI="#MyId">
    <ds:Transforms>
    <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
    </ds:Transforms>
    <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
    <ds:DigestValue>2jmj7l5rSw0yVb/vlWAYkK/YBwk=</ds:DigestValue>
    </ds:Reference>
    </ds:SignedInfo>
    <ds:SignatureValue>
    YdKNSPWnx630AYeZ6AXVco1b0RMo8C3WWbziq7C009gg4nhknEZmH0ds78y328SgAlAAVR6Swwok
    HE3OWgL8TZ1Ks0IimmmDd8/XIb2KlfiqnUNtTjGjUn9FLQEv/CMbmrCr7EO9rf/N+0cyAyGzrKo5
    ieEQhtZy9uZAKh2mrmM=
    </ds:SignatureValue>
    <ds:KeyInfo>
    <wsse:SecurityTokenReference>
    <wsse:Reference URI="#X509TokenRef"/>
    </wsse:SecurityTokenReference>
    </ds:KeyInfo></ds:Signature><wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="X509TokenRef">MIIDITCCAsugAwIBAgIQIdu5EMFuQntM5IBOMeFcETANBgkqhkiG9w0BAQUFADCBqTEWMBQGA1UE
    ChMNVmVyaVNpZ24sIEluYzFHMEUGA1UECxM+d3d3LnZlcmlzaWduLmNvbS9yZXBvc2l0b3J5L1Rl
    c3RDUFMgSW5jb3JwLiBCeSBSZWYuIExpYWIuIExURC4xRjBEBgNVBAsTPUZvciBWZXJpU2lnbiBh
    dXRob3JpemVkIHRlc3Rpbmcgb25seS4gTm8gYXNzdXJhbmNlcyAoQylWUzE5OTcwHhcNMDQwODA1
    MDAwMDAwWhcNMDQwODE5MjM1OTU5WjBhMQswCQYDVQQGEwJJVDENMAsGA1UECBMEUk9NQTENMAsG
    A1UEBxQEcm9tYTEOMAwGA1UEChQFaXNzcGExDjAMBgNVBAsUBWNoaWVmMRQwEgYDVQQDFAt3d3cu
    dGVzdC5pdDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAtIsomDk9VthgMorPmG0dAwqLtTBi
    U69liwopwrnAbtzIiO56R9yh4tXvG9+QWtEFRcDHVwWi9YdaHQFCvjymnNYDUHkpJsWp11nIAfOA
    k+d9v1YDje4S6oba7tsIJSEkUu7LQ888Q3cGt/KUaEu6b0lZJ5zY9slK0onUPeTB3e8CAwEAAaOB
    0TCBzjAJBgNVHRMEAjAAMAsGA1UdDwQEAwIFoDBCBgNVHR8EOzA5MDegNaAzhjFodHRwOi8vY3Js
    LnZlcmlzaWduLmNvbS9TZWN1cmVTZXJ2ZXJUZXN0aW5nQ0EuY3JsMFEGA1UdIARKMEgwRgYKYIZI
    AYb4RQEHFTA4MDYGCCsGAQUFBwIBFipodHRwOi8vd3d3LnZlcmlzaWduLmNvbS9yZXBvc2l0b3J5
    L1Rlc3RDUFMwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMA0GCSqGSIb3DQEBBQUAA0EA
    Y66OqTOpHcpNUPlD4A38s8bPIIjrf+C+Wv08lUj+DGN5pm+gBWdbWEGaQmqU8fPPtGrQnHz2NAUr
    ZmLaEw/qKw==</wsse:BinarySecurityToken></wsse:Security></SOAP-ENV:Header>
    <SOAP-ENV:Body xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="MyId">
    <aTag>
    <aChild>a value</aChild>
    </aTag>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    NOTE: Check the value of <ds:SignatureValue> and <ds:DigestValue>: they never change even if I change the body of the source message.

    Quoting Farrukh's reply to this question on java.net -
    I can share some examples of how I have used JWSDP 1.4 and XML DSIG API to sign and verify a "standalone" soap message with and without mime attachments.
    Please see the following Utility class written for the freebXML Registry project [1] for an example of how to do what you seek:
    http://cvs.sourceforge.net/viewcvs.py/ebxmlrr/omar/src/java/org/freebxml/omar/common/security/SecurityUtil.java?view=markup
    See methods signSOAPMessage(...), signPayload(...), verifySOAPMessage(...) and verifyPayloadSignature(...)
    What you are trying to do is definitely doable and has been done with JWSDP 1.4. In my experience XML DSIG API met my needs very well.
    Best of luck.
    [1] freebXML Registry Project:
    http://ebxmlrr.sourceforge.net
    ---------------------------------------------------------------------------------

  • 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

  • How to Call web service operation by creating plain SOAP message in client?

    Hi
    Thank you for reading my post.
    I have some questions about using web methods of a web service which i would be very gratfull if you could answer.
    I should implement a web service that should receive a file with some other parameters from client and another web service which should receive some parameters and return a file.
    I used a mechanism like the following one to handle the condition and it just works. But I have a problem, I need to create dynamic invocation and I must create soap message and send it to webservice (no IDE generated code)
    What i need is one or two tips or a sample that shows how we can send and receive files by web services.
    I want to know how we can create the SOAP message ourself and then send it to the web service endpoint and it call the web method and ....
    Imagine the following web method, How i can invoke it by creating soap message myself and sending it to end point.
    @WebMethod
    public String saveFile(@WebParam(name = "fileName") String fileName, @WebParam(name = "fileContent") byte[] fileContent) {
    // TODO implement operation
    return "Something";
    Another question is :
    Does this mechanism that i used to transfer files is OK?
    Is it optimized or there are some other ways to do this job.
    I should say that i put one week on handlers to use soap attachments and i get no result.
    So, Please let me know if you know or have some sample that show me how to do the above job.
    Thanks.

    Hi
    From NW04s SP8 you can create webservice systems from within VC , and you will have the option of adding a user and password to authenticate. You can find it at Tools>>Define web service system. You will see a check box url requires user and password.
    If for some reason you can not do it in VC then you should create the system in the portal and fill out the usermapping screens.
    Jarrod Williams

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

  • PI 7.0 SOAP message reply HTTP 500 and after the fault message

    Hello Everybody,
    I have the scenario RFC -> XI -> SOAP in synchronous mode.
    I use for the mapping XSLT because I have to put some dynamic data comming from the RFC in the header of envelope.
    At level of adapter receiver SOAP , I flag the "do not use envelop"
    In normal, that works .
    When the is an fonctionnal error in SOAP service, it sends me back an error HTTP 500 and afterwards the fault message in a soap envelop format. In that case, how can I pass over this error to treat the envelop because in adapter, it is stopped and it returns a short dump to the RFC.
    Is there somebody who can help me with this problem ?
    Thanks in adavance for your answers .
    Regards.
    Eric.

    Hi,
    In case of a SOAP error while processing the request, the SOAP HTTP server MUST issue an HTTP 500 "Internal Server Error" response and include a SOAP message in the response containing a SOAP Fault element
    Thanks,
    RamuV

  • Attachments deleted during message mapping in PI 7.1

    We have upgraded our SAP XI 3.0 SP 22 system to SAP PI 7.1 SP06. In XI 3.0 we created some message mappings that mapped an XML payload with attachments to another message type. The attachments would still exist after the mapping step. In SAP PI 7.1 we now see that attachements are deleted from the message. We cannot see why this is happening. We have tried to set the 3 new option in the operation mappings without any results. The attachements are still being deleted.
    Active Options in operation mappings:
        Use SAPXMLToolkit = true
        Do Not Resolve XOP includes = false
        Read Attachements = false
    In the SXMB_MONI we can see that the attachements are deleted after the Request Message Mapping step. It is a simple proxy-to-proxy scenario with interface and message mapping.
    <Trace level="1" type="B" name="CL_MAPPING_XMS_PLSRV3-ENTER_PLSRV">
      <Trace level="2" type="T">......attachment XI_Context not found</Trace>
      <Trace level="3" type="T">Mapping already defined in interface determination</Trace>
      <Trace level="3" type="T">Object ID of Interface Mapping 46842937562139BCA3F2AC1F36E729FE</Trace>
      <Trace level="3" type="T">Version ID of Interface Mapping 5D945F00B00611DDB04FF8CF0A5B0156</Trace>
      <Trace level="1" type="T">Interface Mapping urn:kadaster-nl:SERV:ZA:KAD:DOVO im_mail_to_dms</Trace>
      <Trace level="3" type="T">Mapping Steps 1 JAVA com/sap/xi/tf/_mm_mail_to_dms_</Trace>
      <Trace level="3" type="T">MTOM Attachments are Transferred to the Payload</Trace>
      <Trace level="3" type="T">Dynamic Configuration Is Empty</Trace>
      <Trace level="2" type="T">Mode 0</Trace>
      <Trace level="3" type="T">Search com/sap/xi/tf/_mm_mail_to_dms_.class (urn:kadaster-nl:SERV:ZA:KAD:DOVO, -1) in swcv 5d945f00-b006-11dd-b04f-f8cf0a5b0156.</Trace>
      <Trace level="2" type="T">Loaded class com.sap.xi.tf._mm_mail_to_dms_</Trace>
      <Trace level="3" type="T">Search com/sap/xi/tf/_mm_mail_to_dms_$MT$InnerLibsList.class (urn:kadaster-nl:SERV:ZA:KAD:DOVO, -1) in swcv 5d945f00-b006-11dd-b04f-f8cf0a5b0156.</Trace>
      <Trace level="2" type="T">Loaded class com.sap.xi.tf._mm_mail_to_dms_$MT$InnerLibsList</Trace>
      <Trace level="3" type="T">Search com/sap/xi/tf/_mm_mail_to_dms_$MT$InnerParamsList.class (urn:kadaster-nl:SERV:ZA:KAD:DOVO, -1) in swcv 5d945f00-b006-11dd-b04f-f8cf0a5b0156.</Trace>
      <Trace level="2" type="T">Loaded class com.sap.xi.tf._mm_mail_to_dms_$MT$InnerParamsList</Trace>
      <Trace level="2" type="T">Call method execute of the application Java mapping com.sap.xi.tf._mm_mail_to_dms_</Trace>
      <Trace level="1" type="T">*** START APPLICATION TRACE ***</Trace>
      <Trace level="3" type="T">Document start</Trace>
      <Trace level="3" type="T">Start tag [ns1:OpvoerenDocumentRequest]</Trace>
      <Trace level="3" type="T">Add raw attribute [ xmlns:ns1="urn:kadaster-nl:SERVICES:DMS:Opvoeren:ZI_KAD_DMS_MAIN"]</Trace>
      <Trace level="3" type="T">Start tag [DocumentInfoRecord]</Trace>
      <Trace level="3" type="T">Start tag [Type]</Trace>
      <Trace level="3" type="T">Put value [302]</Trace>
      <Trace level="3" type="T">Close tag [Type]</Trace>
      <Trace level="3" type="T">Start tag [Omschrijving]</Trace>
      <Trace level="3" type="T">Put value [Apeldoorn]</Trace>
      <Trace level="3" type="T">Close tag [Omschrijving]</Trace>
      <Trace level="3" type="T">Close tag [DocumentInfoRecord]</Trace>
      <Trace level="3" type="T">Close tag [ns1:OpvoerenDocumentRequest]</Trace>
      <Trace level="3" type="T">Document end</Trace>
      <Trace level="1" type="T">*** END APPLICATION TRACE ***</Trace>
      <Trace level="2" type="T">Java mapping com/sap/xi/tf/_mm_mail_to_dms_ completed. (executeStep() of com.sap.xi.tf._mm_mail_to_dms_).</Trace>
      <Trace level="3" type="T">Dynamic Configuration Is Empty</Trace>
      <Trace level="3" type="T">Attached will be Deleted cid:payload-001708D1A20E1DEDAD96471B4CCBC447(@)sap.com</Trace>
      <Trace level="3" type="T">Attached will be Deleted cid:payload-001708D1A20E1DEDAD96471B4C758447(@)sap.com</Trace>
      <Trace level="1" type="T">ContentType application/xml</Trace>
    Regards,
    Jeroen

    Hi Michal,
    Already tried this option too. However this option would only transfer the attachments to
    the mapping runtime in JAVA. We only map the actual payload in a graphical message
    mapping, so for our purpose, the other attachments could stay untouched and remain
    in the abap part for further pipeline processing.
    You can find the result of the Read attachment option during runtime here:
    <!--  ************************************
      -->
    - <Trace level="1" type="B" name="CL_MAPPING_XMS_PLSRV3-ENTER_PLSRV">
      <Trace level="2" type="T">......attachment XI_Context not found</Trace>
      <Trace level="3" type="T">Mapping already defined in interface determination</Trace>
      <Trace level="3" type="T">Object ID of Interface Mapping 46842937562139BCA3F2AC1F36E729FE</Trace>
      <Trace level="3" type="T">Version ID of Interface Mapping 5D945F00B00611DDB04FF8CF0A5B0156</Trace>
      <Trace level="1" type="T">Interface Mapping urn:kadaster-nl:SERV:ZA:KAD:DOVO im_mail_to_dms</Trace>
      <Trace level="3" type="T">Mapping Steps 1 JAVA com/sap/xi/tf/_mm_mail_to_dms_</Trace>
      <Trace level="3" type="T">MTOM Attachments are Transferred to the Payload</Trace>
      <Trace level="3" type="T">Dynamic Configuration Is Empty</Trace>
      <Trace level="2" type="T">Mode 0</Trace>
      <Trace level="3" type="T">Search com/sap/xi/tf/_mm_mail_to_dms_.class (urn:kadaster-nl:SERV:ZA:KAD:DOVO, -1) in swcv 5d945f00-b006-11dd-b04f-f8cf0a5b0156.</Trace>
      <Trace level="2" type="T">Loaded class com.sap.xi.tf._mm_mail_to_dms_</Trace>
      <Trace level="3" type="T">Search com/sap/xi/tf/_mm_mail_to_dms_$MT$InnerLibsList.class (urn:kadaster-nl:SERV:ZA:KAD:DOVO, -1) in swcv 5d945f00-b006-11dd-b04f-f8cf0a5b0156.</Trace>
      <Trace level="2" type="T">Loaded class com.sap.xi.tf._mm_mail_to_dms_$MT$InnerLibsList</Trace>
      <Trace level="3" type="T">Search com/sap/xi/tf/_mm_mail_to_dms_$MT$InnerParamsList.class (urn:kadaster-nl:SERV:ZA:KAD:DOVO, -1) in swcv 5d945f00-b006-11dd-b04f-f8cf0a5b0156.</Trace>
      <Trace level="2" type="T">Loaded class com.sap.xi.tf._mm_mail_to_dms_$MT$InnerParamsList</Trace>
      <Trace level="2" type="T">Call method execute of the application Java mapping com.sap.xi.tf._mm_mail_to_dms_</Trace>
      <Trace level="1" type="T">*** START APPLICATION TRACE ***</Trace>
      <Trace level="3" type="T">Document start</Trace>
      <Trace level="3" type="T">Start tag [ns1:OpvoerenDocumentRequest]</Trace>
      <Trace level="3" type="T">Add raw attribute [ xmlns:ns1="urn:kadaster-nl:SERVICES:DMS:Opvoeren:ZI_KAD_DMS_MAIN"]</Trace>
      <Trace level="3" type="T">Start tag [DocumentInfoRecord]</Trace>
      <Trace level="3" type="T">Start tag [Type]</Trace>
      <Trace level="3" type="T">Put value [302]</Trace>
      <Trace level="3" type="T">Close tag [Type]</Trace>
      <Trace level="3" type="T">Start tag [Omschrijving]</Trace>
      <Trace level="3" type="T">Put value [Apeldoorn]</Trace>
      <Trace level="3" type="T">Close tag [Omschrijving]</Trace>
      <Trace level="3" type="T">Close tag [DocumentInfoRecord]</Trace>
      <Trace level="3" type="T">Close tag [ns1:OpvoerenDocumentRequest]</Trace>
      <Trace level="3" type="T">Document end</Trace>
      <Trace level="1" type="T">*** END APPLICATION TRACE ***</Trace>
      <Trace level="2" type="T">Java mapping com/sap/xi/tf/_mm_mail_to_dms_ completed. (executeStep() of com.sap.xi.tf._mm_mail_to_dms_).</Trace>
      <Trace level="3" type="T">Dynamic Configuration Is Empty</Trace>
      <Trace level="3" type="T">Attached will be Deleted cid:payload-001708D1A20E1DDDAD97A993DAB6CB91(@)sap.com</Trace>
      <Trace level="3" type="T">Attached will be Deleted cid:payload-001708D1A20E1DDDAD97A993DB0E4B91(@)sap.com</Trace>
      <Trace level="1" type="T">ContentType application/xml</Trace>
      </Trace>
      </Trace>
      </Trace>
    Thanks

  • Using PI 7.0 to handle moving a PDF document into a SOAP Message & sending

    Here is our situation.  We have the business writing all invoices for a day out of SAP to disk formatted as a PDF document; meaning, if the file is FTP'd from the disk of SAP to an NT server inside our firewall it is recognised as a PDF by Windows and Adobe.
    After we read the PDF, I need to add it as the payload to a SOAP message that will be sent to the web service of a partner out side our firewall.  They will extract the PDF from the SOAP Message and print the invoices... stuff the envelopes ... and post them. 
    I have been trying to use the file adapter to "pick up" the PDF and the SOAP adapter to send... Obviously, it is not working and I need some assistance.  I am new to XI, so any advice will be greatly appreciated.
    Thanks,
    Rich

    1.If the partner webservice supports SOAP attachments then you can send the required attachments from FileAdapter by selecting "Additional Files" check box in the File Sender channel.
    Check this link: [http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm|http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm]
    2.Else if this not the case i.e., you want to send PDF file stream as part of payload then you need to convert the PDF file stream to BASE64 format then map to one of the field of Webservice structure and then post using SOAP Adapter.
    Remember the webservice field length should be enough to carry the BASE64 string otherwise the target application will fail to process the data or it will process data by truncating. Also there should be extra funtionality in target webservice for converting BASE64 format to binary format(PDF file).
    But in general the webservices will support attachements. So you can go ahead with Case1.
    Thanks,
    - Gujjeti.

Maybe you are looking for

  • How to restore a remote site after a crash?

    I have read the site management FAQ and it mentions to restore your files you can go to your remote site and load back to your local site. Could anyone offer some help to my situation? I suffered a hard drive failure, I'm running windows xp, dwcs4 an

  • DW-CS3 Version of Word Word-Art

    I mocked-up a web-page layour in Word XP that I now want to re-produce in DW-CS3. The Design includes left and right columns that contain a vertical stacking of individuals' names rendered using Word's Word-Art. Is there a similar capability to Word-

  • HT5918 Display Port Monitors with MacPro 2013

    As of now, I am using 5 monitors on my MP 2006 and intend to move on to the new MP 2013. After reading this note ( http://support.apple.com/kb/HT6008 ) I have some questions. This article states that we can connect up to 6 monitors with mini-display

  • ClassCastException, and we *are* using "-Djbo.server.in_oc4j=true "

    Hi, We have several applications using the same BC4J objects running on the same AppSer (Oracle9iAS Containers for J2EE 9.0.2.0.0, running on Ibm AIX 4.3.3). Each time we deploy a specific application, all OTHER applications get ClassCastExceptions,

  • Runing a database outside of an IDE

    Hello, I am wondering if anyone could help me; I am creating a java database application in netbeans 6.1 (with JDK 6). I can get the application along with the database to compile and run fine as long as I have started a connection to the database se