Java Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

Java Examples

Quick Start
Unicode
Bz2
Certificates
CSV
Email
Encryption
FTP
HTML Conversion
HTTP
IMAP
MHT
MIME
POP3
RSA
S/MIME
SFTP
Signatures
SMTP
Socket / SSL
Spider
SSH
SSH Key
SSH Tunnel
Tar
Upload
XML
XMP
Zip

More Examples...
Amazon S3
Email Object
DKIM / DomainKey
NTLM
FileAccess
RSS
Atom
String
Byte Array
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

 

 

 

 

 

 

 

Create EDIFACT MIME

Create an EDIFACT MIME message.

 Chilkat Java Library Downloads for Windows, Linux, and MAC OS X

import com.chilkatsoft.*;

public class ChilkatExample {

  static {
    try {
        System.loadLibrary("chilkat");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load.\n" + e);
      System.exit(1);
    }
  }

  public static void main(String argv[])
  {

    CkMime mime = new CkMime();

    boolean success;
    success = mime.UnlockComponent("Anything for 30-day trial.");
    if (success == false) {
        System.out.println("Failed to unlock");
        return;
    }

    //  Assuming  you have an EDIFACT document loaded into
    //  a string variable, set the MIME body with it:
    String ediBody;
    ediBody = "UNB+IATB:1+6XPPC+LHPPC+940101:0950+1' ...";
    mime.SetBodyFromPlainText(ediBody);

    //  The call to SetBodyFromPlainText automatically set the
    //  content-type to "text/plain".
    //  However, we want:  application/EDIFACT; name=om080923.edi
    mime.put_ContentType("application/EDIFACT");
    mime.put_Name("om080923.edi");

    //  We want the content-disposition to be:
    //  Content-Disposition: attachment; filename="om080923.edi"
    mime.put_Disposition("attachment");
    mime.put_Filename("om080923.edi");

    //  Make sure the content-transfer-encoding is 7bit:
    //  Content-Transfer-Encoding: 7bit
    mime.put_Encoding("7bit");

    //  Note: MIME header fields are case insensitive.

    //  Add a few other header fields:
    mime.AddHeaderField("Message-ID","<CHILKAT-MID-83cf2fbf-10cb-4322-ad79-4c1097fd56f2@Matt>");
    mime.AddHeaderField("From","support@chilkatsoft.com");
    mime.AddHeaderField("To","admin@chilkatsoft.com");
    mime.AddHeaderField("Subject","This is a test");
    mime.AddHeaderField("MIME-VERSION","1.0");
    mime.AddHeaderField("Date","Tue, 23 Sep 2008 07:26:39");

    //  Display the complete MIME:
    System.out.println(mime.getMime());


  }
}

 

© 2000-2010 Chilkat Software, Inc. All Rights Reserved.