Setting mime headers for MessageFactory.createMessage(...)

Hi-,
I am trying to read the attached SOAP1.1 w/ attc. message from a plain file with a piece of simple Java code. The 'MessageFactory.createMessage(MimeHeaders headers, java.io.InputStream in)' is not very informative as to what goes in for headers, so I tried all of the below commented headers - no luck, only exceptions. Any explanation as to what I am doing wrong? I am using JWSDP1.5 with J2SE5.0.
=============JAVA CODE=================
public class SOAPTest {
static public void main(String[] args) throws SOAPException, IOException
MimeHeaders headers = new MimeHeaders();
//headers.addHeader("Content-Type","multipart/related");
//headers.addHeader("Content-Location","");
//headers.addHeader("Content-Type","text/xml; charset=UTF-8");
//headers.addHeader("Content-Type","text/xml");
//headers.addHeader("Content-Transfer-Encoding","8Bit");
//headers.addHeader("Content-Transfer-Encoding","Binary");
//headers.addHeader("Content-Type","application/pdf");
MessageFactory factory = MessageFactory.newInstance();
InputStream sample = new FileInputStream(args[0]);
SOAPMessage message = factory.createMessage(headers,sample);
System.out.println("Soap Header\n:"+message.getSOAPHeader());
sample.close();
=============SOAP message w/ ATTC.=================
MIME-Version: 1.0
Content-Type: multipart/related; boundary=4444741.1049296259836.MIMEBoundary; type="text/xml"
Content-Description: Acknowledgement - P20030811030857.0504
--4444741.1049296259836.MIMEBoundary
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-Location: Envelope1120
<?xml version="1.0" encoding="UTF-8"?>
<SOAP:Envelope xmlns="http://www.irs.gov/efile" xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ 2004v1.0/Common/SOAP.xsd http://www.irs.gov/efile 2004v1.0/Common/efileMessage.xsd" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" xmlns:efile="http://www.irs.gov/efile">
<SOAP:Header>
<efile:AcknowledgementHeader transmissionVersion="1.0">
<AcknowledgementTimestamp>2003-10-20T16:15:33+05:00</AcknowledgementTimestamp>
</efile:AcknowledgementHeader>
</SOAP:Header>
<SOAP:Body>
<efile:AcknowledgementManifest count="2">
<Reference contentLocation="TID01"/>
<Reference contentLocation="Return0001"/>
</efile:AcknowledgementManifest>
</SOAP:Body>
</SOAP:Envelope>
--4444741.1049296259836.MIMEBoundary
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-Location: TID01
<?xml version="1.0" encoding="UTF-8"?>
<TransmissionAcknowledgement xmlns="http://www.irs.gov/efile" xmlns:efile="http://www.irs.gov/efile" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.irs.gov/efile 2004v1.0/Common/efileMessage.xsd" transmissionVersion="1.0"><TransmissionId>TID01</TransmissionId><TransmissionTimestamp>2003-10-20T15:25:36+05:00</TransmissionTimestamp><TransmissionStatus>A</TransmissionStatus><GTXKey>P20030811030857.0504</GTXKey></TransmissionAcknowledgement>
--4444741.1049296259836.MIMEBoundary
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-Location: Return0001
<?xml version="1.0" encoding="UTF-8"?>
<ReturnAcknowledgement xmlns="http://www.irs.gov/efile" xmlns:efile="http://www.irs.gov/efile" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.irs.gov/efile 2004v1.0/Common/efileMessage.xsd" returnVersion="2004v1.0" validatingSchemaVersion="2004v1.0"><ReturnId>01000020032881234567</ReturnId><FilerEIN>010000000</FilerEIN><ReturnType>1120</ReturnType><TaxYear>2004</TaxYear><ReturnStatus>A</ReturnStatus><CompletedValidation>yes</CompletedValidation><PaymentIndicator>Payment Request Received</PaymentIndicator></ReturnAcknowledgement>
--4444741.1049296259836.MIMEBoundary--

Never mind. I fixed it - it turned out that the first MIME headers are the "protocol specific" stuff. Once I transfered them to the MessageFactory, all worked out well.

Similar Messages

  • 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

  • How to set MIME type for JNLP in Windows2000 IIS

    Hi!
    I try to set up my windows 2000 IIS's MIME type for JNLP to test java web start, but I have no idea how to set
    the MIME type. Can anybody help me???
    Best wishes

    In IIS v4 which comes with the Windows NT4 option pack, you right click the web page you are working with, select properties, then go to the HTTP Headers tab. At the bottom there's a button labelled File Types in the MIME Map section.
    After you've clicked that, you can add the two mime types you need;
    Associated Extension MIME Type
    .jar application/x-java-jar-file
    .jnlp application/x-java-jnlp-file
    I'm assuming that it is the same in W2k/IIS5.

  • SAAJ adding mime headers for server authrorization

    I need to pass login information to server when sending SOAP request. Do I use MimeHeaders to carry username/passwrod pair?
    SOAPMessage message = factory.createMessage();
                   String authorization = Base64.encode("username:password".getBytes());
                   MimeHeaders mimeheaders = message.getMimeHeaders();
                   mimeheaders.addHeader("Authorization", "Basic " + authorization);

    Ok, problem partially solved. I'm using IBM's web service implementation. Mime headers are not set using addHeaders() or message.getMimeHeaders().setHeader() methods. I try same with pure Axis and it worked fine. I think IBM has bug here.

  • How to set Mime Type for Static Files

    Hi All,
    I am working on Apex 3.2.1.00.10.
    When I am trying to upload (create) a ".js" file into Static Files under Shared Components of an application; it is saving as "*text/plain*" for Mime Type. But I need Mime type to be set as "*application/x-javascript*".
    Please help me to change the Mime type of .js file.
    Or is there any way to upload the file directly as "*application/x-javascript*" as its Mime Type.
    Thanks in advance.
    Umesh

    In IIS v4 which comes with the Windows NT4 option pack, you right click the web page you are working with, select properties, then go to the HTTP Headers tab. At the bottom there's a button labelled File Types in the MIME Map section.
    After you've clicked that, you can add the two mime types you need;
    Associated Extension MIME Type
    .jar application/x-java-jar-file
    .jnlp application/x-java-jnlp-file
    I'm assuming that it is the same in W2k/IIS5.

  • How to set mime types for applet in iAS sp3?

     

    Hi,
    Please refer to Adding Mime types and let me know if that address to solve your problem.
    Regards
    Ganesh .R
    Developer Technical Support
    Sun Microsystems
    http://www.sun.com/developers/support

  • HTTP Headers for SOAP

    Hello,
    I need to set some custom HTTP Header when i send the SOAP message to an endpoint.
    I tried this..but doesn't solve my requirement.
    SOAPMessage soapmsg = messageFactory.createMessage();
    MimeHeaders mime = soapmsg.getMimeHeaders();
    mime.addHeader("SOAPAction", "xxxx");
    mime.addHeader("Sender", "yyy");
    SOAPMessage reply = connection.call(soapmsg, destination);
    Can anyone please guide me how to set HTTP headers for SOAP?
    Thanks,

    Hello,
    I need to set some custom HTTP Header when i send the SOAP message to an endpoint.
    I tried this..but doesn't solve my requirement.
    SOAPMessage soapmsg = messageFactory.createMessage();
    MimeHeaders mime = soapmsg.getMimeHeaders();
    mime.addHeader("SOAPAction", "xxxx");
    mime.addHeader("Sender", "yyy");
    SOAPMessage reply = connection.call(soapmsg, destination);
    Can anyone please guide me how to set HTTP headers for SOAP?
    Thanks,

  • Setting proper format for  the documents

    Hi,
    I want to set the proper format before saving the documents in Ifs. The Documents are uploaded to Ifs using the Java API.Can any one help me on this?
    Thanks,
    Prasanth

    Hi,
    Thanks rich. I am using the following code to set the proper format.
    // create the definition
    DocumentDefinition ddef = new DocumentDefinition(lsession);
    ddef.setName(docname);
    ifsSession.setAdministrationMode(true);
    FormatDefinition newFormatDef = new FormatDefinition(lsession); //create a new FormatDefinition
    Format format = (Format)ifsSession.createSystemObject(newFormatDef); //create a new Format using the FormatDefinition
    format.setMimeType(mimetype); // set Mime type for the Format
    newDocDef.setFormat(format); //set the format for the DocumentDefinition
    lsession.setAdministrationMode(false); //set the session back to normal mode;
    // create the document using the definition
    Document newdoc = (Document) lsession.createPublicObject(ddef);
    Is there anything wrong with this one? when i save the document with this code,its stored in non-indexed media.
    I tried the code you posted .its working for pdf documents (they are going to indexed Media ) but not for word documents.
    Thanks,
    Prasanth

  • Set Background color for headers in excel

    DECLARE
       v_fh     UTL_FILE.file_type;
       v_dir    VARCHAR2 (30)      := 'my dir';
       v_file   VARCHAR2 (30)      := 'test.xls';
       PROCEDURE run_query (p_sql IN VARCHAR2)
       IS
          v_v_val   VARCHAR2 (4000);
          v_n_val   NUMBER;
          v_d_val   DATE;
          v_ret     NUMBER;
          c         NUMBER;
          d         NUMBER;
          col_cnt   INTEGER;
          f         BOOLEAN;
          rec_tab   DBMS_SQL.desc_tab;
          col_num   NUMBER;
       BEGIN
          c := DBMS_SQL.open_cursor;
          -- parse the SQL statement
          DBMS_SQL.parse (c, p_sql, DBMS_SQL.native);
          -- start execution of the SQL statement
          d := DBMS_SQL.EXECUTE (c);
          -- get a description of the returned columns
          DBMS_SQL.describe_columns (c, col_cnt, rec_tab);
          -- bind variables to columns
          FOR j IN 1 .. col_cnt
          LOOP
             CASE rec_tab (j).col_type
                WHEN 1
                THEN
                   DBMS_SQL.define_column (c, j, v_v_val, 4000);
                WHEN 2
                THEN
                   DBMS_SQL.define_column (c, j, v_n_val);
                WHEN 12
                THEN
                   DBMS_SQL.define_column (c, j, v_d_val);
                ELSE
                   DBMS_SQL.define_column (c, j, v_v_val, 4000);
             END CASE;
          END LOOP;
          -- Output the column headers
          UTL_FILE.put_line (v_fh, '<ss:Row>');
          FOR j IN 1 .. col_cnt
          LOOP
             UTL_FILE.put_line (v_fh, '<ss:Cell>');
             UTL_FILE.put_line (v_fh,
                                   '<ss:Data ss:Type="String">'
                                || rec_tab (j).col_name
                                || '</ss:Data>'
             UTL_FILE.put_line (v_fh, '</ss:Cell>');
          END LOOP;
          UTL_FILE.put_line (v_fh, '</ss:Row>');
          -- Output the data
          LOOP
             v_ret := DBMS_SQL.fetch_rows (c);
             EXIT WHEN v_ret = 0;
             UTL_FILE.put_line (v_fh, '<ss:Row>');
             FOR j IN 1 .. col_cnt
             LOOP
                CASE rec_tab (j).col_type
                   WHEN 1
                   THEN
                      DBMS_SQL.COLUMN_VALUE (c, j, v_v_val);
                      UTL_FILE.put_line (v_fh, '<ss:Cell>');
                      UTL_FILE.put_line (v_fh,
                                            '<ss:Data ss:Type="String">'
                                         || v_v_val
                                         || '</ss:Data>'
                      UTL_FILE.put_line (v_fh, '</ss:Cell>');
                   WHEN 2
                   THEN
                      DBMS_SQL.COLUMN_VALUE (c, j, v_n_val);
                      UTL_FILE.put_line (v_fh, '<ss:Cell>');
                      UTL_FILE.put_line (v_fh,
                                            '<ss:Data ss:Type="Number">'
                                         || TO_CHAR (v_n_val)
                                         || '</ss:Data>'
                      UTL_FILE.put_line (v_fh, '</ss:Cell>');
                   WHEN 12
                   THEN
                      DBMS_SQL.COLUMN_VALUE (c, j, v_d_val);
                      UTL_FILE.put_line (v_fh,
                                         '<ss:Cell ss:StyleID="OracleDate">'
                      UTL_FILE.put_line (v_fh,
                                            '<ss:Data ss:Type="DateTime">'
                                         || TO_CHAR (v_d_val,
                                                     'YYYY-MM-DD"T"HH24:MI:SS'
                                         || '</ss:Data>'
                      UTL_FILE.put_line (v_fh, '</ss:Cell>');
                   ELSE
                      DBMS_SQL.COLUMN_VALUE (c, j, v_v_val);
                      UTL_FILE.put_line (v_fh, '<ss:Cell>');
                      UTL_FILE.put_line (v_fh,
                                            '<ss:Data ss:Type="String">'
                                         || v_v_val
                                         || '</ss:Data>'
                      UTL_FILE.put_line (v_fh, '</ss:Cell>');
                END CASE;
             END LOOP;
             UTL_FILE.put_line (v_fh, '</ss:Row>');
          END LOOP;
          DBMS_SQL.close_cursor (c);
       END;
       PROCEDURE start_workbook
       IS
       BEGIN
          UTL_FILE.put_line (v_fh, '<?xml version="1.0"?>');
          UTL_FILE.put_line
             (v_fh,
              '<ss:Workbook xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">'
       END;
       PROCEDURE end_workbook
       IS
       BEGIN
          UTL_FILE.put_line (v_fh, '</ss:Workbook>');
       END;
       PROCEDURE start_worksheet (p_sheetname IN VARCHAR2)
       IS
       BEGIN
          UTL_FILE.put_line (v_fh,
                             '<ss:Worksheet ss:Name="' || p_sheetname || '">'
          UTL_FILE.put_line (v_fh, '<ss:Table>');
       END;
       PROCEDURE end_worksheet
       IS
       BEGIN
          UTL_FILE.put_line (v_fh, '</ss:Table>');
          UTL_FILE.put_line (v_fh, '</ss:Worksheet>');
       END;
       PROCEDURE set_date_style
       IS
       BEGIN
          UTL_FILE.put_line (v_fh, '<ss:Styles>');
          UTL_FILE.put_line (v_fh, '<ss:Style ss:ID="OracleDate">');
          UTL_FILE.put_line
                           (v_fh,
                            '<ss:NumberFormat ss:Format="dd/mm/yyyy\ hh:mm:ss"/>'
          UTL_FILE.put_line (v_fh, '</ss:Style>');
          UTL_FILE.put_line (v_fh, '</ss:Styles>');
       END;
    BEGIN
       v_fh := UTL_FILE.fopen (v_dir, v_file, 'w', 32767);
       start_workbook;
       set_date_style;
       start_worksheet ('OM');
       run_query ('select PARTY_ID,PARTY_NAME from HZ_PARTIES
        where PARTY_ID<1080');
       end_worksheet;
       start_worksheet ('PO');
       run_query ('SELECT AGENT_ID,TYPE_LOOKUP_CODE FROM PO_HEADERS_ALL
            WHERE PO_HEADER_ID<20');
       end_worksheet;
       end_workbook;
       UTL_FILE.fclose (v_fh);
    END;
    Here i will get two outputs in same excel with different spread sheets,
    now i want to set background color for headers i
    ex:PARTY_ID,PARTY_NAME,AGENT_ID,TYPE_LOOKUP_CODE are the headers,in excel output i want background color as blue.
    Please do need full help,its urgent req.

    Hello,
    open the file in Excel and save it, just to ensure that Excel writes all the additional stuff it thinks is necessary.
    Now change the background colour of the header and save the file again but with a different name.
    Open both files in a text editor and look at the differences. That's what you need to change in your code.
    Alternatively you can use packages like xml_spreadsheet or ExcelDocumentType, both write the same file format that you use in your code and you don't have to reinvent the wheel.
    Regards
    Marcus

  • Set headers for drill-down reports.

    Hi!!!
    The problem we have by now is when printing a report, selected characteristis are showed in header as "multiple values" instead of showing the real values that user have choose.
    Does anybody knows how to set headers for drill-down reports in order to see selected characteristics?
    Thanks in advance...
    Adela Cambiasso.

    Sorry, me again...
    I have found yet they way to show in the header the report parameters, I mean, the selection criterias that user used when execute the report... I was able to show selected characteristics inside de report but not the selection criteria...
    Do you know what I have lost? or what to use for this?
    Thanks again.
    Adela.

  • Exact purpose of MimeHeaders param to MessageFactory.createMessage()

    I'm building a web service intermediary, and I'm trying to make sure I can handle
    SOAP messages with attachments.
    When I first saw the "MimeHeaders" parameter in "MessageFactory.createMessage(MimeHeaders,
    InputStream)", I was a little befuddled. I figured this was related to handling
    attachments, but I find almost zero documentation on what I'm supposed to be doing
    here.
    In my experiments, I tried sending a message with a simple "text/xml" attachment.
    I set the content type of the attachment when creating the attachment. If my
    "createMessage()" call passed "null" for the MimeHeaders parameter, then the resulting
    SOAPMessage ignored the MIME-ness of the message and just stored the SOAP envelope.
    If I instead create a MimeHeaders object and add a "Content-Type" header of "text/xml",
    and pass that object instead of "null" for the MimeHeaders parameter, then it
    appears to record the SOAP envelope along with the attachment. I'm guessing the
    "Content-Type" header that I added in the MimeHeaders object applies to the main
    body of the message, and not the attachment.
    My main problem is that I tried that change with the MimeHeaders object through
    pure guesswork. I can't find anything in the BEA docs that gives me a clue what
    really should be done here.

    Yes, you will want to create MIME headers from the HTTP headers.
    Q1. Are you saying that if the content-type of the HTTP header is "text/xml",
    it wouldn't find the attachments?
    A1. Dunno. I wouldn't though, because that's not how the SwA (or SAAJ) says to
    do it. See the following link: http://www.w3.org/TR/2000/NOTE-SOAP-attachments-20001211#SOAPMultipart
    Q2. If the content-type of the HTTP request is "multipart/related", is there any
    assumption about whether the main SOAPMessage is 1.0/1.1 or 1.2?
    A2. I hope not, because that (determining the SOAP version based on the MIME type)
    is dictated in the SOAP specs themselves. See the following link: http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383526.
    Regards,
    Mike Wooten
    "David Karr" <[email protected]> wrote:
    >
    Ok, that's helpful. However, your description seems to imply that the
    only way
    for the incoming message to be considered to have attachments is to use
    "multipart/related".
    Are you saying that if the top-level content-type is "text/xml", it
    wouldn't
    find the attachments? Also, if the top-level content-type is "multipart/related",
    is there any assumption about whether the main SOAPMessage is 1.0/1.1
    or 1.2?
    So if the intermediary is a servlet, I should just pass the HTTP headers
    into
    the MimeHeaders?
    "Michael Wooten" <[email protected]> wrote:
    Hi David,
    These classes are part of the JAX-RPC API, so you would want to search
    for this
    information on Sun's (or Javasoft's) website. If you can't find it there,
    it may
    be because they (Sun) wants to be able to change the implementationwithout
    breaking
    your code :-) That's actually what makes seperating the interface from
    the implementation,
    powerful.
    That said, the Content-type header, in this MimeHeader object, is used
    to determine
    the MIME type of the InputStream. If it's multipart/related, an attempt
    will be
    made to create a SOAPMessage with attachment parts, from the InputStream.
    The
    format of this multipart/related message is covered in RFC 2387 (http://www.faqs.org/rfcs/rfc2387.html).
    This document says that the Content-type of each part, is in the Header
    fields
    of the part itself. These parts are the AttachmentPart objects thatare
    returned
    (in a java.util.Iterator), when you call the SOAPMessage.getAttachments()
    method.
    If the Content-type header in this MimeHeader is application/soap+xml,
    the InputStream
    is assumed to be a SOAP 1.2 message (http://www.w3.org/TR/2002/CR-soap12-part2-20021219/).
    If it's text/xml, the InputStream is assumed to be a SOAP 1.0/1.1 message.
    Typically, a Web Service intermediary is realized as a Servlet Filter
    or JAX-RPC
    Handler. In the case of the former, you would use the createMessage(MIMEHeaders,InputStream)
    method. The HttpServletRequest contains the headers you use, as well
    as the ServletInputStream.
    In the case of the later, the SOAPMessage has already been created by
    the JAX-RPC
    implementation in WLS :-)
    HTH,
    Mike Wooten
    "David Karr" <[email protected]> wrote:
    I'm building a web service intermediary, and I'm trying to make sure
    I can handle
    SOAP messages with attachments.
    When I first saw the "MimeHeaders" parameter in "MessageFactory.createMessage(MimeHeaders,
    InputStream)", I was a little befuddled. I figured this was related
    to handling
    attachments, but I find almost zero documentation on what I'm supposed
    to be doing
    here.
    In my experiments, I tried sending a message with a simple "text/xml"
    attachment.
    I set the content type of the attachment when creating the attachment.
    If my
    "createMessage()" call passed "null" for the MimeHeaders parameter,then
    the resulting
    SOAPMessage ignored the MIME-ness of the message and just stored the
    SOAP envelope.
    If I instead create a MimeHeaders object and add a "Content-Type" header
    of "text/xml",
    and pass that object instead of "null" for the MimeHeaders parameter,
    then it
    appears to record the SOAP envelope along with the attachment. I'mguessing
    the
    "Content-Type" header that I added in the MimeHeaders object applies
    to the main
    body of the message, and not the attachment.
    My main problem is that I tried that change with the MimeHeaders object
    through
    pure guesswork. I can't find anything in the BEA docs that gives me
    a clue what
    really should be done here.

  • Problems setting email headers with javax.mail.*

    I'm trying desperatly to send HTML emails with javax.mail but I simply can't. No matter what I do, no matter how and where I set the headers it always come out as text.
    Here's a sample code:
    try {
              Properties props = System.getProperties();
              props.put("mail.smtp.host", "smtp.ability.com.br");
              Session session = Session.getDefaultInstance(props, null);
              Message msg = new MimeMessage(session);
              msg.setHeader("Content-Type", "text/html");
              msg.setRecipient( MimeMessage.RecipientType.TO, new InternetAddress("[email protected]") );
              msg.setFrom( new InternetAddress("[email protected]") );
              msg.setSubject("teste");
              msg.setText("<b>testeeeeeeeeeeeee</b>");
              Transport.send( msg );
              } catch( Throwable t ) {
                   System.err.println(t);
              }and here's the resulting email:
    Return-Path: <[email protected]>
    Delivered-To: [email protected]
    Received: (qmail 5895 invoked by uid 510); 21 Dec 2004 16:41:49 -0000
    Received: from [email protected] by relay03.dominal.com
    Received: from unknown (HELO christian) (200.217.110.124)
      by 0 with SMTP; 21 Dec 2004 16:41:48 -0000
    Message-ID: <20590970.1103647309922.JavaMail.christian@christian>
    From: [email protected]
    To: [email protected]
    Subject: teste
    Mime-Version: 1.0
    Content-Type: text/plain; charset=us-ascii
    Content-Transfer-Encoding: 7bit
    <b>testeeeeeeeeeeeee</b>What am I missing here?
    Thanks in advance,
    Christian

    msg.setText("<b>testeeeeeeeeeeeee</b>");R
    eplace that
    bymsg.setContent("<b>testeeeeeeeeeeeee</b>",
    "text/html");
    Thanks DrClap, but that's not exactly the solution I'm looking for, cuz I would have to hard-code that header.
    I have an Email class that I use as a wrapper for the javax.mail API, and I wanna be able to have a setHeader() method that works to enable the users to set the content-type of the text (or HTML) portion of the email, even when there are attachments. How can I achieve this?

  • Incorrect MIME type for XML Data Connection POST requests

    It appears that Xcelsius 2008u2019s XML Data Connection logic does not specify the correct MIME type for the data it sends to the server in its POST request.  Using an HTTP debug proxy, I was able to see that Xcelsius sends XML data in the POST, but is setting a content-type of u201Cx-www-form-urlencodedu201D.  According to the W3C spec:
      http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1
    Data sent with a MIME type of u201Cxxu201D should be encoded as key?value pairs, like this:
      key1=val1&key2=val2&Submit=Submit
    So, what Xcelsius is doing is clearly incorrect.  Worse, if your server process is a Java servlet, you may find that the POSTed data will be gobbled up by the servlet container and you wonu2019t be able to read it using a getInputStream(), or getReader() call because itu2019s already been processed by a call to the getParameter() method.
    The correct mime type for POSTing an XML formatted request from Xcelsius should be "text/xml".
    Wayne

    Hi,
    The Error #2032 your getting is due to the Flash player security.
    To remove this this error you need one crossdomain Xml file in the root directory which actually provides a lot more control over who has access to your data from a SWF. The cross domain policy is attached as crossdomain.xml.
    In the XML file, it is used a wildcard (*). This allows a SWF located on any machine to access your data source. You can certainly use an IP address or domain name to restrict access rather to opening it up completely. I always start with the wildcard to make sure my dashboard works, then start restricting access as necessary.
    Here is a whitepaper with everything you need to know about Flash player security:
    http://www.adobe.com/devnet/flashplayer/articles/flash_player_9_security.pdf
    Please let me know if you need any more clarification.
    Regards,
    Sanjay

  • Vertical headers for columns in JTable

    Hi,
    I'm actually working on JTables and i'd like to set the headers of some columns to appear vertically instead of by default horizontal.
    I've found some tuts or examples to set the header on multiple lines but no one to set the header vertical...
    I want something like that :
    before :
    column1 | column2
    row1 |
    row2 |
    and after setting header columns vertical ( with column1 and column2 the column headers of my JTable )
    c | c
    o | o
    l | l
    u | u
    m | m
    n | n
    1 | 2
    ( and orientation of row headers not changed )
    Thanx for your reply
    Scottish

    Hi,
    Create you own colunm header renderer... it is actualy a cellRenderer. That cellRenderer should extends JLabel or JButton depending on what you want and you must put a paint method in it that draws the vertical text.
    JRG

  • Setting up headers in interactive planning

    Hi All,
    We adding almost 50 new users to our existing DP setup. We have specific requirement to set headers for specific users. Can anyone tell me how can I setup headers for users?
    I tried using user setting and in that navigation Path (Drill down) but it actually drill down to detail all level when I get into interactive planning. That I do not want.
    I just want to add headers in interactive planning for users.
    Regards,
    Harshil Desai

    Hi harshil,
    Check in this table '/SAPAPO/MSDPHEAD'
    it is self explanatory, by reading the contents of this table you will get some idea/clue.
    Also, seek help of ABAP in uploading the user specific setting details to this table.
    Let me know if it works.
    Thanks,
    Regards,
    Sandeep Kumar.S

Maybe you are looking for

  • Nokia N95 Call/SMS barring

    How can I block calls and SMS from a certain number on my Nokia N95?

  • Formatting spry output

    Hi! So far with the great help of altruistic gramps, I managed to create a nice master/detail spry page connecting to a mysql database using linecraft's spry_utility. However, I still have a problem decoding the data coming from the database server.

  • Table field for PO releaser in R/3 (4.7 Enterprise)

    Hi Gurus out there: Do you know if there is a table field for PO releaser in R/3 (4.7 Enterprise)? We use for e.g. the transaction ME29N to release a PO and I haven't been able to find a DB table where the PO releaser is stored. In DB table EKKO I ca

  • Change Condition price of Contract through IDOC

    Hi all,              I am changing  the condition type(PB00) price (KONP-KBETR) of Contract using Inbound Idocs using message type COND_A.The price is updated correctly.              But the change is not getting reflected in the net price (EKPO-NETP

  • Faster selection of elements in list-boxes...

    I've a long listbox and I like to find my values faster by typing the first letter of the search-value and the marker should jump to the first element starting with that letter. How can I do this? The same problem holds with using the scrolling funct