Multipart message has "text/plain" content type.

Hi all,
I am developing an application which can send and receive email messages including attachments.Because i dont have easy access to real mail servers at the moment, i am using my laptop to test everything("localhost"). my code so far have been able to send,receive and display text messages. it can also send email messages with attachments. The problem comes when i want to retrieve the attachment messages from the "multipart" message. message.isMimeType("multipart/*") returns false and getContentType() method on the message returns "text/plain". as a result my code can not start retreiving the attachments.
I saved the email message after Transport.Sent(mymsg). Content of the file looks like bellow.
From: user1@localhost
To: user2@localhost, user1@localhost
Message-ID: <22643639.0.1212046661890.JavaMail.user1@localhost>
Subject: test
MIME-Version: 1.0
Thu May 29 10:37:41 EAT 2008: Thu May 29 10:37:41 EAT 2008
Date: Thu, 29 May 2008 10:37:42 +0300 (EAT)
------=_Part_1_30831739.1212046661890
This is text body part.
------=_Part_1_30831739.1212046661890
Content-Disposition: attachment; filename=testfile1.txt
content of testfile1.txt
------=_Part_1_30831739.1212046661890
Content-Disposition: attachment; filename=card1.pub
content of card1.pub
------=_Part_1_30831739.1212046661890
I can also see the received messages in the inbox( JAMES mail server is in my local machine). when opened using notpad, content of these messages is same as the content of the sent messages.
I am a biginner to java mail(using 1.4.1). so any kind of help would be appreciated. can this problem be linked to using my local machine as mail server or what? I have uninstalled AVG antivirus thinking that it can be interfering. but to no vail. am really stuck at the moment.
Regards

Are you sure you're using JavaMail 1.4.1? It looks like you're running into
an issue that existed back in JavaMail 1.2. How are you saving the message
to the file?
Try call msg.saveChanges() before sending the message.
Also, try using the demo programs that come with JavaMail to see if they're
working correctly, e.g., msgmultisendsample.java.

Similar Messages

  • Portal Doesn't Display page with text/plain content type

    Hi,
    I created a WSRP portlet with text/plain content type and added it to my page, but I get the following error message:
    Error: Could not get markup. The cookie or session is invalid or there is a runtime exception.
    when I add the portlet to my page.
    It works when I use text/html content, but text/plain doesn't work.
    Any ideas how I can get my portlet to display in the portal?
    Thanks in advance,
    GB

    IE6 cannot display text/plain (support.microsoft.com/kb/329661).
    Does the server know what to do (i.e. how to render) with text/plain?

  • JEditorPane with text/html content-type still displaying as plain-text?

    Hello all,
    I recently started work on a very basic HTTP GET program that gets the HTML source of a page and, using a JEditorPane, displays the page as normal (i.e. like a browser would).
    Anywhoo, the HTTP GET is fine, and the source is loaded into a String called "html". Then I do this:
    displayArea.createEditorKitForContentType("text/html");
                        displayArea.setText(html);However the content appears in the editor pane as plain-text (i.e. the HTML code appears as-is, not in a 'compiled' form).
    Any ideas why this is?
    Thanks,
    Tristan

    Thanks for the replies, however the setContentType didn't work either. When I changed the code to what you suggested, nothing got inserted into the editor pane at all (i.e. no HTML - nor plain-text?). More of the code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    import java.net.Socket;
    import java.util.Scanner;
    public class ClassName extends JFrame implements ActionListener
         public JTextField urlIn, pageIn;
         public JButton go;
         public JScrollPane scrollPane;
         public JEditorPane displayArea;
         public JPanel topPanel;
         public String url, page, html;
         public int index;
         public ClassName()
              setSize(1230,680);
              setLayout(new BorderLayout());
              JPanel topPanel = new JPanel();
              topPanel.setLayout(new FlowLayout());
              urlIn = new JTextField(18);
              pageIn = new JTextField(18);
              JButton go = new JButton("Go!");
              topPanel.add(urlIn);
              topPanel.add(pageIn);
              topPanel.add(go);
              add(topPanel, BorderLayout.NORTH);
              displayArea = new JEditorPane();
              displayArea.setEditable(false);
              add(displayArea, BorderLayout.CENTER);
              go.addActionListener(this);
              urlIn.addActionListener(this);
              setVisible(true);
         public static void main(String args[])
              new ClassName();
         public void actionPerformed(ActionEvent e)
              if( e.getActionCommand() == "Go!" )
                   url = urlIn.getText();
                   page = pageIn.getText();
                   if (url != null && page != null )
                        try
                             final int HTTP_PORT = 80;
                             Socket s = new Socket(url, HTTP_PORT);
                             InputStream inStream = s.getInputStream();
                             OutputStream outStream = s.getOutputStream();
                             Scanner in = new Scanner (inStream);
                             PrintWriter out = new PrintWriter(outStream);
                             out.print("GET " + page + " HTTP/1.0\n\n");
                             out.flush();
                             while( in.hasNextLine() )
                                  String input = in.nextLine();
                                  html = html + input;
                             s.close();
                        catch (Exception exception)
                             System.out.println("Error: " + exception);
                        displayArea.setContentType("text/html");
                        displayArea.setText(html);
                        urlIn.setText("");
                        pageIn.setText("");
                 else
                      System.out.println("Please enter something!");
    }Am baffled as to what the problem is? :-(
    Thanks,
    Tristan

  • Client found response content type of 'text/plain', but expected 'text/xml'

    Hi All
    We have developed a J2EE- JAX-RPC web service using Weblogic's 'ServiceGenTask'.
    Invoking web service via java client and SOAP UI works like charm but fails when the
    service invoked via .NET client.
    Below is the .NET sample code and the Stack Trace:
    .NET CODE:
    System.Net.ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate {      return true;  });
    testwebservice.ESI est1 = new testwebservice.ESI();
    esi_detail = est1.getDetails("someuserid", "password"<Details> <Id>" + txt_eino.Text +"</Id> </Details>");
    Stack Trace:
    System.InvalidOperationException was unhandled by user code
    Message=Client found response content type of 'text/plain', but expected 'text/xml'.
    The request failed with the error message:
    HTTP/1.1 100 Continue
    <env:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><env:Header/><env:Body env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><m:getCertificateDetailsForWSUResponse xmlns:m="http://mynamespace"><result xsi:type="xsd:string"><CertificateStatus>valid</CertificateStatus>
    </m:getCertificateDetailsForWSUResponse></env:Body></env:Envelope>
    Source=System.Web.Services
    StackTrace:
    at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
    at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
    at shcilestamp.EstampIndia.getCertificateDetailsForWSU(String string, String string0, String string1) in c:\Users\Revenue\AppData\Local\Temp\Temporary ASP.NET Files\sra\6fd93bb3\8d227466\App_WebReferences.iojpamot.0.cs:line 105
    at default_1.btn_verify_estamp_Click(Object sender, EventArgs e) in c:\Users\Revenue\Desktop\OFFICE\sra\default.aspx.cs:line 1006
    at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
    at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
    at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
    at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
    at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    InnerException:
    Note: The same client code is able to access the service deployed in our DR site without any fault.
    However it fails to invoke service deployed in Production site.
    Is this anything to do with the Content-type settings at the web/app server layer?
    Any help will be appreciated.
    Thanks & Best Regards
    Avinash

    Make sure you're using the Reverse Proxy Plugin for Web Server, not the Application Server Connector (they are VERY similar, but not the same). The RPP knows how to handle 100 Continue, the Connector does not.
    Or use Web Server 7 and its built-in reverse proxy feature.

  • SAAJ0537: Invalid Content-Type. Could be an error message instead of a SOAP

    Hi,
    At present i am using JCAPS version 5.1.1
    com.sun.xml.messaging.saaj.SOAPExceptionImpl: Invalid Content-
    Type:text/html. Is this an error message instead of a SOAP response?
    I got above error message while invoking the webservice.
    My intention is to get HttpRequest from user and based on the input from user, a web service should be invoked. For this i am using BusinessProcess[einsight]
    In my BusinessProcess, i have HttpServer processRequest service,
    to receive HTTP requests and then i am passing the value of parameter received from http[As String] to next partner which is responsible for invoking a webservice.[Used a wsdl in client mode]
    I am able to get http request successfully , but i got error while invoking web service.
    Please let me know, what to do for rectifying error.

    Although this is an aged topic, this is plaguing our development efforts currently. I have successfully created a webservice that can be executed externally using the generated wsdl but I am unable to get a JCD to execute the WS without getting the following error:
    [#|2007-10-09T19:51:02.700-0700|SEVERE|IS5.1.2|javax.xml.messaging.saaj.soap|_ThreadID=32606; ThreadName=Worker: 34758;|SAAJ0537: Invalid Content-Type. Could be an error message instead of a SOAP message|#]
    [#|2007-10-09T19:51:02.701-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
    com.sun.xml.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?|#]
    [#|2007-10-09T19:51:02.701-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at com.sun.xml.messaging.saaj.soap.MessageImpl.identifyContentType(MessageImpl.java:296)|#]
    [#|2007-10-09T19:51:02.701-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at com.sun.xml.messaging.saaj.soap.MessageImpl.<init>(MessageImpl.java:146)|#]
    [#|2007-10-09T19:51:02.701-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl.createMessage(SOAPMessageFactory1_1Impl.java:32)|#]
    [#|2007-10-09T19:51:02.701-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at com.sun.xml.rpc.client.http.HttpClientTransport.readResponse(HttpClientTransport.java:169)|#]
    [#|2007-10-09T19:51:02.701-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at com.sun.xml.rpc.client.http.HttpClientTransport.invoke(HttpClientTransport.java:83)|#]
    [#|2007-10-09T19:51:02.701-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:69)|#]
    [#|2007-10-09T19:51:02.701-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at tp6.ExecutePortType_Stub.opGetControl(ExecutePortType_Stub.java:66)|#]
    [#|2007-10-09T19:51:02.702-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at tp6.ExecutePortType_opGetControl.invoke(ExecutePortType_opGetControl.java:188)|#]
    [#|2007-10-09T19:51:02.702-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at com.stc.wsclient.runtime.impl.WSDLOtdDelegateImpl.invoke(WSDLOtdDelegateImpl.java:78)|#]
    [#|2007-10-09T19:51:02.702-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at urn_stc_egate_jce_AI_WebServices_GetControl_jcdGetControl.OpGetControl.invoke(urn_stc_egate_jce_AI_WebServices_GetControl_jcdGetControl.OpGetControl:113)|#]
    [#|2007-10-09T19:51:02.702-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at AIWebServicesTEST_GetControl_WS.jcdTEST_GetControl_WS.start(jcdTEST_GetControl_WS.java:21)|#]
    [#|2007-10-09T19:51:02.702-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at TEST_GetControl_WS.cmTEST_GetControl_WS_jcdTEST_GetControl_WS1.jcdTEST_GetControl_WS_Runtime_Handler.handleRequest(jcdTEST_GetControl_WS_Runtime_Handler.java:369)|#]
    [#|2007-10-09T19:51:02.702-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at sun.reflect.GeneratedMethodAccessor4463.invoke(Unknown Source)|#]
    [#|2007-10-09T19:51:02.702-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)|#]
    [#|2007-10-09T19:51:02.702-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at java.lang.reflect.Method.invoke(Method.java:615)|#]
    [#|2007-10-09T19:51:02.702-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:140)|#]
    [#|2007-10-09T19:51:02.702-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:135)|#]
    [#|2007-10-09T19:51:02.702-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at $Proxy108.handleRequest(Unknown Source)|#]
    [#|2007-10-09T19:51:02.702-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at STC_MDB__eaJCAP_Scheduler_cmTEST_GetControl_WS_jc1527518542.sendMessage(STC_MDB__eaJCAP_Scheduler_cmTEST_GetControl_WS_jc1527518542.java:213)|#]
    [#|2007-10-09T19:51:02.703-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at STC_MDB__eaJCAP_Scheduler_cmTEST_GetControl_WS_jc1527518542.onContents(STC_MDB__eaJCAP_Scheduler_cmTEST_GetControl_WS_jc1527518542.java:100)|#]
    [#|2007-10-09T19:51:02.703-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at sun.reflect.GeneratedMethodAccessor4462.invoke(Unknown Source)|#]
    [#|2007-10-09T19:51:02.703-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)|#]
    [#|2007-10-09T19:51:02.703-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at java.lang.reflect.Method.invoke(Method.java:615)|#]
    [#|2007-10-09T19:51:02.703-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at com.sun.enterprise.security.SecurityUtil$2.run(SecurityUtil.java:146)|#]
    [#|2007-10-09T19:51:02.703-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at java.security.AccessController.doPrivileged(AccessController.java:275)|#]
    [#|2007-10-09T19:51:02.703-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at com.sun.enterprise.security.application.EJBSecurityManager.doAsPrivileged(EJBSecurityManager.java:940)|#]
    [#|2007-10-09T19:51:02.703-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:151)|#]
    [#|2007-10-09T19:51:02.703-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at com.sun.ejb.containers.MessageBeanContainer.deliverMessage(MessageBeanContainer.java:948)|#]
    [#|2007-10-09T19:51:02.703-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at com.sun.ejb.containers.MessageBeanListenerImpl.deliverMessage(MessageBeanListenerImpl.java:42)|#]
    [#|2007-10-09T19:51:02.703-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at com.sun.enterprise.connectors.inflow.MessageEndpointInvocationHandler.invoke(MessageEndpointInvocationHandler.java:136)|#]
    [#|2007-10-09T19:51:02.703-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at $Proxy111.onContents(Unknown Source)|#]
    [#|2007-10-09T19:51:02.703-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at com.stc.schedulerotd.scheduleradapter.FileReaderWork.run(FileReaderWork.java:77)|#]
    [#|2007-10-09T19:51:02.703-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at com.sun.enterprise.connectors.work.OneWork.doWork(OneWork.java:54)|#]
    [#|2007-10-09T19:51:02.703-0700|WARNING|IS5.1.2|javax.enterprise.system.stream.err|_ThreadID=32606; ThreadName=Worker: 34758;|
         at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:382)|#]
    [#|2007-10-09T19:51:02.704-0700|SEVERE|IS5.1.2|javax.xml.messaging.saaj.soap|_ThreadID=32606; ThreadName=Worker: 34758;|SAAJ0535: Unable to internalize message|#]
    [#|2007-10-09T19:51:02.704-0700|INFO|IS5.1.2|STC.eGate.CMap.Collabs.TEST_GetControl_WS.cmTEST_GetControl_WS_jcdTEST_GetControl_WS1.AIWebServicesTEST_GetControl_WS.jcdTEST_GetControl_WS|_ThreadID=32606; ThreadName=Worker: 34758;|+++EXCEPTION = HTTP transport error: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to internalize message; nested exception is:
         HTTP transport error: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to internalize message|#]
    [#|2007-10-09T19:51:02.704-0700|INFO|IS5.1.2|STC.eGate.CMap.Collabs.TEST_GetControl_WS.cmTEST_GetControl_WS_jcdTEST_GetControl_WS1.AIWebServicesTEST_GetControl_WS.jcdTEST_GetControl_WS|_ThreadID=32606; ThreadName=Worker: 34758;|+++STACK     = [Ljava.lang.StackTraceElement;@31de31de|#]
    [#|2007-10-09T19:51:02.705-0700|INFO|IS5.1.2|com.stc.codegen.OTDImpl.runtime.ejb.OTDService|_ThreadID=32606; ThreadName=Worker: 34758;|terminate each service|#]
    Is anybody else having this same error and how was it resolved? Both my client and server settings seems to be in sync. My only iffy piece is the servlet context. For both client and server external components, host, port, servlet context match. What am I missing??

  • Content type is text\xml - 400 Bad Request, Content Type - Blank - success

    Hi,
    I have a send port subscribing to a message from the Message Box and sending the message to a service.
    The content type is text\xml, and it fails with a 400-Bad Request.
    If the send port picks up the message from a folder , Content Type is Blank, the service returns a response.
    How do I make the message picked up from the Message Box ( with Content Type text\xml)  work. Can I change the Content Type of the message at the Send Port (WCF-Custom, Basic HTTP Binding).
    Regards,
    Sharmishtha Sarkar

    You issue is not with Content Type text\xml  On the wire web request is passed as text\xml as content type and  issues is neither with send port folder .
    I would say you need to check your send port binding and  SOAP Action header inside your Send Handler . Best way to import the binding generated while consuming service through BizTalk WCF Service Consuming Wizard.
    I suspect you are sending wrong message to web service and thus due to data contract conflict you are getting exception from the service .
    There are various articles which can guide you how to consume web service in BizTalk .Some of them are listed below .
    How to Use the BizTalk WCF Service Consuming Wizard to Consume a WCF Service
    BizTalk and WCF: Part I, Operation Patterns
    Consuming WCF Service in BizTalk 2010 Orchestration
    Thanks
    Abhishek

  • Incorrect display of MIME Multipart message

    I have non critical, yet annoying problems.
    My problem is similar to:
    https://support.mozilla.org/en-US/questions/992656?esab=a&as=aaq
    I have a single sender who email's do not display the proper Mime attachment inline. What I have found is that the order of the mime parts seems to be important. In my case, the "HTML" content is listed first in the message, and the "text" content is second. In this case, the "text" is the body part that is displayed.
    I have access to the source message. I simply reversed the order of the body parts in the source message, then the HTML version is displayed.
    I did installed the addon https://support.mozilla.org/en-US/kb/viewing-all-body-parts
    I am able to see both parts when I set the correct settings.
    My questions seem to be, (why) does Thunderbird care what order the body parts are in? If I choose view "original html", shouldn't thunderbird display the HTML if it exists?
    I can post the source message if you think it will help. However as I said, simply re-order the body parts, I get the HTML when it is the 2nd / last body part.

    It is standard practice for the body parts to be Text then HTML.
    I think the RFC explains the situation fairly well
    http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html
    To quote
    As a very simple example, the following multipart message has two parts, both of them plain text, one of them explicitly typed and one of them implicitly typed:
    From: Nathaniel Borenstein <[email protected]>
    To: Ned Freed <[email protected]>
    Subject: Sample message
    MIME-Version: 1.0
    Content-type: multipart/mixed; boundary="simple
    boundary"
    This is the preamble. It is to be ignored, though it
    is a handy place for mail composers to include an
    explanatory note to non-MIME compliant readers.
    --simple boundary
    This is implicitly typed plain ASCII text.
    It does NOT end with a linebreak.
    --simple boundary
    Content-type: text/plain; charset=us-ascii
    This is explicitly typed plain ASCII text.
    It DOES end with a linebreak.
    --simple boundary--
    This is the epilogue. It is also to be ignored.
    The use of a Content-Type of multipart in a body part within another multipart entity is explicitly allowed. In such cases, for obvious reasons, care must be taken to ensure that each nested multipart entity must use a different boundary delimiter. See Appendix C for an example of nested multipart entities.
    The use of the multipart Content-Type with only a single body part may be useful in certain contexts, and is explicitly permitted.

  • Multipart message from Mac with particolat structure

    My application try to parse a mail but throws an exception like:
    "Missing start boundary" on a message with a internal structure very strange.
    My message is a multipart/mixed message sended from Microsoft-Outlook-Express-Macintosh-Edition/5.0.3
    Content-type: multipart/mixed;
    boundary="MS_Mac_OE_3150300861_727761_MIME_Part"
    This message is in MIME format. Since your mail reader does not understandthis format, some or all of this message may not be legible.
    --MS_Mac_OE_3150300861_727761_MIME_Part
    Content-type: multipart/alternative;
    boundary="MS_Mac_OE_3150300861_727762_MIME_Part"
    --MS_Mac_OE_3150300861_727762_MIME_Part
    Content-type: text/plain; charset="ISO-8859-1"
    Content-transfer-encoding: quoted-printable
    --=20
    TEXT
    --MS_Mac_OE_3150300861_727762_MIME_Part
    Content-type: text/html; charset="ISO-8859-1"
    Content-transfer-encoding: quoted-printable
    <HTML>
    <HEAD>
    <TITLE>Comunicato 17 LND</title>
    </head>
    <BODY>
    <BR>
    <BR>
    <B>-- <BR>
    TEXT<BR>
    </body>
    </html>
    MS_Mac_OE_3150300861_727762_MIME_Part
    --MS_Mac_OE_3150300861_727761_MIME_Part
    Content-type: application/pdf; name="Comunicato17LND.pdf";
    x-mac-creator="4341524F";
    x-mac-type="50444620"
    Content-disposition: attachment
    Content-transfer-encoding: base64
    JVBERi0xLjINJeLjz9MNCjEgMCBvYmoNPDwNL0NyZWF0aW9uRGF0ZSAoRDoyMDAzMTAyOTE5
    MzIzNyswMScwMCcpDS9Nb2REYXRlIChEOjIwMDMxMDI5MTkzMjM3KzAxJzAwJykNL1Byb2R1
    Y2VyIChBY3JvYmF0IERpc3RpbGxlciA1LjAuNSBcKE1hY2ludG9zaFwpKQ0vQXV0aG9yIChT
    MS_Mac_OE_3150300861_727761_MIME_Part
    The problem I think is on boundary, this is the same for message (multipart/mixed) and for first part (multipart/alternative).
    In other mails the boundary change on all multipart parts.
    Thank you for help

    I think that this message don't respect RFC 2046 standard.

  • Setting attachment content-type manually?

    Hello,
    I am trying to write code that will allow a user to specify the content-type of an attachment when s/he adds it to an email. The following code, which appears to let Java figure out the content-type from the file extension, works just fine:
    Multipart multipart = new MimeMultipart();
    // Part one is the text
    BodyPart bodyPart = new MimeBodyPart();
    bodyPart.setText("Some text");
    multipart.addBodyPart(bodyPart);
    // Part two is the attachment
    bodyPart = new MimeBodyPart();
    DataSource sourceFile = new FileDataSource(FileName);
    bodyPart.setDataHandler(new DataHandler(sourceFile));
    multipart.addBodyPart(bodyPart);
    message.setContent(multipart);
    I attached a .exe file, passed the DataSource into the DataHandler constructor, and it sent the email as expected, with a Content-Type of application/octet-stream. However, if I do the following instead:
    bodyPart.setContent(fileDataSource, "application/octet-stream");
    -or-
    bodyPart.setDataHandler(new DataHandler(fileDataSource, "application/octet-stream");
    I get the dreaded javax.activation.UnsupportedDataTypeException: no object DCH for MIME type application/octet-stream. Why do I get this exception when using setContent, but not when I use the DataHandler? It seems it has the same Content-Type either way.
    -Aaron

    Well, I figured out the answer myself by digging into the source code.
    When you create a DataHandler by using the (Object, String) constructor, it expects an Object that is not a DataSource, or so it would seem. So I abducted the BinaryArrayDataSource from the demo classes and instantiated one of it, specifying my desired content type and passing in the FileInputStream from the file that I was creating my FileDataSource from, and it worked like a champ.
    So, the moral is, use DataSources whenever possible!
    -Aaron

  • Unable to make multipart messages

    I have some code to make multipart mime message (both related and altenative). The code works fine when run in a standalone application, but does not work when run from inside my jsp pages.
    When running in jsp, I can create the message, but whe it sends, it only sends the header lines (including the start boundry). I can see the same thing if I invoke "message.writeTo(System.out)." When I check the message programatically, it does have the correct content objects. Has anyone seen this before?
    The code is as follows:
    Message msg = new MimeMessage(session);
    MimeMultipart content = new MimeMultipart("alternative");
    // Add the Text
    MimeBodyPart part = new MimeBodyPart();
    part.setContent(textBody, "text/plain");
    content.addBodyPart(part);
    // Add the HTML
    part = new MimeBodyPart();
    part.setDataHandler(new javax.activation.DataHandler(new ByteArrayDataSource(html, "text/html")));
    content.addBodyPart(part);
    // Add the content to the message
    msg.setContent(content);

    I use a different constructor with a DataHandler
    in an Application not JSP, it has been working fine,
    maybee this may help.
    MimeBodyPart mbp2 = new MimeBodyPart();
    String sAttachment = new String(oAttachment.fbytAttachment);
    mbp2.setDataHandler(new DataHandler(sAttachment, "text/html"));
    mbp2.setFileName(sFileName);
    mbp2.setHeader("Content-Transfer-Encoding","base64");
    mp.addBodyPart(mbp2);
    // add the Multipart to the message
    oMimeMessage.setContent(mp);
    From,
    Phill

  • Error in soap - Invalid content type

    Hi all
    In soap lookup, i am getting a error that the content type is invalid.
    This is the string from which i have derived the xmlPayload.
    <i><ConversionRate xmlns="http://www.webserviceX.NET/"> <FromCurrency>INR</FromCurrency><ToCurrency>USD</ToCurrency></ConversionRate></i>
    My error message is
    <i>invalid content type for SOAP: TEXT/PLAIN: java.io.IOException: invalid content type for SOAP: TEXT/PLAIN'. Cause Exception: 'invalid content type for SOAP: TEXT/PLAIN'.</i>
    Can someone please suggest me what could have gone wrong?

    url -http://www.webservicex.net/CurrencyConvertor.asmx
    action- http://www.webservicex.net/ConversionRate
    I have enabled Keep headers, Keep attachments, Use query string.
    <b>my code:</b>
    AbstractTrace trace=null;
    try{
    trace=container.getTrace();
    Channel soapChannel=LookupService.getChannel("soaplookup_buss","soap_ib");
    trace.addDebugMessage("channel created");
    SystemAccessor accessor=LookupService.getSystemAccessor(soapChannel);
    trace.addDebugMessage("accessor created");
    String message="<ConversionRate xmlns=\"http://www.webserviceX.NET/\"><FromCurrency>TRY</FromCurrency><ToCurrency>AFA </ToCurrency></ConversionRate>";
    InputStream inputStream = new ByteArrayInputStream(message.getBytes());
    XmlPayload reqPayload = LookupService.getXmlPayload(inputStream);
    Payload resPayload=accessor.call(reqPayload);
    return "success";
    catch(Exception e){
    trace.addDebugMessage("exception occured"+e);
    return "exception occured";

  • The Content-type: header

    When I send a new message, Mail sets the Content-type header to
    Content-Type: text/plain;
    charset=US-ASCII;
    delsp=yes;
    format=flowed
    Most of the time it does the same for replies that I send. Sometimes however on a reply it instead sets
    Content-Type: text/plain; charset=ISO-2022-JP; delsp=yes; format=flowed
    About 2% of my replies have the second example of content-type, and I can see no common factor between them. My message format is set to plain text, and I don't "use the same format as the original message".
    Does anyone know why Mail sometimes does this?
    Thanks.
    AK

    Tom and I exchanged several emails on this topic. It would appear that the problem (mail setting the content-type to ISO-2022-JP) is caused when certain characters in the quoted text of a reply are encoded; mail decides it needs to specify ISO-2022-JP. Characters identified as causing the problem are smart quotes and apostrophes. If you look at the apostrophe in the raw text it appears as =1B$B!G=1B(B and the smart quotes as =1B$B!H=1B(B and =1B$B!I=1B(B
    AK

  • SAAJ0532: Absent Content-Type

    I am using SAAJ in J2EE 1.4 Beta2 to call a web service from a java client. There following is a snap shot of the client code,
    SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
    SOAPConnection connection = soapConnectionFactory.createConnection();
    java.net.URL endpoint = new URL("http://localhost:3456/ws_attachment/ImageService");
    SOAPMessage response = connection.call(message, endpoint);
    I got the following error. Note that message object has the content-type set correctly.
    Thanks.
    Siming
    Aug 22, 2003 5:23:55 PM com.sun.xml.messaging.saaj.soap.MessageImpl <init>
    SEVERE: SAAJ0532: Absent Content-Type
    com.sun.xml.messaging.saaj.SOAPExceptionImpl: Absent Content-Type
    at com.sun.xml.messaging.saaj.soap.MessageImpl.<init>(MessageImpl.java:1
    29)
    at com.sun.xml.messaging.saaj.soap.ver1_1.Message1_1Impl.<init>(Message1
    _1Impl.java:45)
    at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl.crea
    teMessage(SOAPMessageFactory1_1Impl.java:32)
    at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOA
    PConnection.java:361)
    at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection$PriviledgedP
    ost.run(HttpSOAPConnection.java:156)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOA
    PConnection.java:126)
    at testwebservice.attachment.saaj.Client.main(Client.java:57)
    java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptio
    nImpl: Absent Content-Type
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOA
    PConnection.java:126)
    at testwebservice.attachment.saaj.Client.main(Client.java:57)
    Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Absent Content-Type
    at com.sun.xml.messaging.saaj.soap.MessageImpl.<init>(MessageImpl.java:1
    29)
    at
    com.sun.xml.messaging.saaj.soap.ver1_1.Message1_1Impl.<init>(Message1
    _1Impl.java:45)
    at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl.crea
    teMessage(SOAPMessageFactory1_1Impl.java:32)
    at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOA
    PConnection.java:361)
    at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection$PriviledgedP
    ost.run(HttpSOAPConnection.java:156)

    Hi friends,
    I have written a servlet to process request and write the XML response.
    I set the content-type of the servlet as "TEXT/XML".
    After running the client program I am getting the following exception.
    SEVERE: SAAJ0532: Absent Content-Type
    com.sun.xml.messaging.saaj.SOAPExceptionImpl: Absent Content-Type
    at com.sun.xml.messaging.saaj.soap.MessageImpl.<init>(MessageImpl.java:129)
    at com.sun.xml.messaging.saaj.soap.ver1_1.Message1_1Impl.<init>(Message1_1Impl.java:45)
    at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl.createMessage(SOAPMessageFactory1_1Impl.java:32)
    at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:361)
    at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection$PriviledgedPost.run(HttpSOAPConnection.java:156)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:126)
    at com.griffin.server.manager.processor.cardmarte.CardmarteConnector.call(CardmarteConnector.java:298)
    at com.griffin.server.manager.processor.cardmarte.CardmarteConnector.balanceInquiry(CardmarteConnector.java:199)
    at com.griffin.server.manager.CardManager.executeObtainBalance(CardManager.java:595)
    at com.griffin.server.manager.CardManager.obtainBalance(CardManager.java:534)
    at com.griffin.server.api.http.GetBalanceActor.execute(GetBalanceActor.java:128)
    at com.griffin.server.api.http.RequestActorBase.go(RequestActorBase.java:130)
    at com.griffin.server.api.http.HttpApiController.delegateRequest(HttpApiController.java:239)
    at com.griffin.server.api.http.HttpApiController.doCommon(HttpApiController.java:193)
    at com.griffin.server.api.http.HttpApiController.doPost(HttpApiController.java:159)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
    Please help....
    thanks in advance.

  • Field values are not erased when I change content types.

    On an SP2010 site I created 2 Site Columns  TextColumn1 and  TextColumn2 (both Single Line of text).
    I added Two Content Types ContentType1 and ContentType2 (both derived from Item).
    I created a list and enabled content types. I Added ContentType1 and ContentType2 to the list.
    I configured the devfault view to show TextColumn1 and  TextColumn2.
    I added an Item of ContentType1 and for TextColumn1  added the value 'c1'
    I edited the item and changed the content Type to ContentType2 and entered a value of c2 for TextColumn2.
    The default view still shows the value of 'c1' for TextColumn1 even though the item is of content type ContentType2 which does not have this field defined.
    How do I correct this?

    If I'm understanding your question correctly, this is expected behavior. The item still has both the content types applied to it. The columns are included in the view. So Any values in those columns for that item will be displayed.
    You could create views for each content type.
    You could also look into changing the default content type.
    Not sure if this helps because I'm not sure I understood the problem.

  • Invalid Content-Type with SAAJ

    I get the following exception when trying to send a SOAPMessage with an attachment. Sorry for the length of this post. Lots of info.
    com.sun.xml.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:application/x-www-form-urlencoded. Is this an error m
    essage instead of a SOAP response?
    The HTTP request looks like the following, I abbreviated the attachment content.
    POST /edlf/design/service/ManagerServices/import HTTP/1.1
    Accept: text/xml
    User-Agent: Java/1.5.0_10
    Host: localhost:9080
    Connection: keep-alive
    Content-type: application/x-www-form-urlencoded
    Content-Length: 17537
    ------=_Part_0_24087760.1169577467505
    Content-Type: text/xml; charset=utf-8
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
    <ImportFileRequest>
    <File name="test.dlf"/>
    </ImportFileRequest>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    ------=_Part_0_24087760.1169577467505
    Content-Type: application/octet-stream
    lMqAAMxQMQBQSwMEFAAAAAgAPFtWNrcaY4xxAQAANwYAADMAAABMaXZlRG9jcy9Db250ZW50L0N1
    c3RvbWVyLzEvRG9jdW1lbnQvMS9QYWdlLzEvMS5iaW6VVL1OAzEMdig/LbQsLEggcV1ZbmGv1Lkj
    ooIJJKoCC0J06MDAyIxY4QGYeYATj8LEgtQBCTawcUIck8sdn2QlduwvsePEAMAZyjrKPYoBxhrK
    awOgBR47XYDPba/LuRHjO8at4niXsy0THPuLAAcr8AdfFjG71K9Qd7yEl3nmpANL3jp2uU5273fd
    YwmBaf3UxEP6aH+qxEjow6VZn2fOSql5awRG6VRwF1wURToYwsI3d0fTSdY/n6YC/ochSsceU95/
    WX66GgbC+3UcVGOSQ5x3sZHMQvVZtF9rM+zPeNqznr6lMnzU8JHQecW6IdbvdXgJrn6as+OUwenl
    hBzI0LYbPeN4Ija9QHkETo7Wxig5BhU4zlmfp1/6N5Tc3hGVO2zPduBXDeIfCF0nciz0LOl3BBtg
    ------=_Part_0_24087760.1169577467505--
    My code snippet for producing the above is:
    BASE64Encoder encoder = new BASE64Encoder();
    String encString = "";
    encString = encoder.encode(content);
    ByteArrayDataSource bds = new ByteArrayDataSource(encString, "application/octet-stream", fileName);
    DataHandler dh = new DataHandler(bds);
    URL url = new URL(serviceEndPt + "ManagerServices/import");
    HttpURLConnection connection = (HttpURLConnection)url.openConnection();
    connection.setDoOutput(true);
    connection.setDoInput(true);
    connection.setRequestMethod("POST");
    connection.setRequestProperty("Accept", "text/xml");
    OutputStream out = connection.getOutputStream();
    MessageFactory mf = MessageFactory.newInstance();
    SOAPMessage msg = mf.createMessage();
    SOAPPart sp = msg.getSOAPPart();
    SOAPEnvelope envelope = sp.getEnvelope();
    SOAPBody body = envelope.getBody();
    SOAPBodyElement root = body.addBodyElement(envelope.createName("ImportFileRequest"));
    SOAPElement fileEl = root.addChildElement(envelope.createName("File"));
    Name attName = envelope.createName("name");
    fileEl.addAttribute(attName, fileName);
    root.addChildElement(fileEl);
    AttachmentPart ap = msg.createAttachmentPart();
    ap.setDataHandler(dh);
    msg.addAttachmentPart(ap);
    msg.writeTo(out);

    The error does not seem to appears in WLS stack. Place a sniffer tool between your client and service to capture more info.
    Jong

Maybe you are looking for

  • PL/SQL XML Parser - problem running example

    Oracle 8.1.5 database on NT When i try running the example with command: SQL*Plus> exec domsample ('//SERVER_03/ORACLE/xml_tmp','family.xml', 'err.txt'); I get the following error: ERROR at line 1: ORA-20100: Error occurred while parsing: //ORACLE/xm

  • Comparing MacBook Pro screen with Intel iMac

    I'm wondering if anyone here that has a MacBook Pro has had a chance to compare its quality to another mac's screen. I've been working on trying to colour-calibrate my MacBook Pro using SuperCal, and I've noticed that the colour on the MacBook Pro is

  • Security Exception with applets

    Hello, How do I overcome the securityexception I face with applets? My appletviewer works fine when I try to read data from a local text file. But the browser doesn't seem to. It says access to the text file is denied!!!

  • Can't deploy - error ora-12514

    Hi, I've got problem. During deploying some errors occured: ORA-12514, TNS:listener does not currently know of service requested in connect descriptor </NAMESPACE> RUNTIME_SERVICES_DEBUG [WhValidationGenerationTransaction] DeploymentSpecificati onImp

  • Mass change of external Contact domains?

    We have a large number of external contacts in our GAL.  One of the companies is having a name and email domain change. The email addresses are staying the same except for the email domain. For instance [email protected] is now [email protected] How