mstsc.exe
java 代码
- package com.easylink.services.sample;
- import java.io.File;
- import testpackage.SendFaxResponse;
- import com.easylink.services.ELSException;
- import com.easylink.services.ELSFaxManager_test;
- /**
- * SendFax - Send a fax to the specified destination fax
- * @author zhu jiyun
- * @version 1.0
- */
- public class SendFax_test {
- public static void main(String[] args) throws Exception {
- try {
- /**
- * the required variable with '*';
- */
- /**
- * Host*
- * Secured production fax endpoint:faxadmin.easylink.com
- */
- String host = "webservicetest.easylink.com"; //Test system secured fax endpoint
- /**
- * port*
- * The port of the destination service. ie 443 unless using a proxy
- */
- String port = "443";
- /**
- * email*
- * The email address of the registered account
- */
- String emailAddress = "tenn911@163.com";
- /**
- * password*
- * Password for the registered account
- */
- String password = "password";
- /**
- * destination*
- * Destination fax number
- */
- String destination = "8641139778161";
- //trustStorePath*
- String trustStorePath = "c:\\testEasyLink\\easysendfax.keystore";
- // AcctCode
- String accountCode = "";
- // UserCode
- String userCode = "";
- // TSI - Fax Machine Identification String
- String TSI = "";
- // alternateDeliveryNotice - Delivery Notification EMAIL
- String alternateDeliveryNotice = "";
- String deliveryNoticeType = "ALL";
- String faxResolution = "Normal";
- // to - Value for the TO field
- String to = "";
- String from = emailAddress;
- //Setup the attachments*
- String filePath = "c:\\testEasyLink\\testEasyLink.txt";
- File[] attachments = getAttachments(filePath);
- ELSFaxManager_test efm = new ELSFaxManager_test();
- efm.setHost(host);
- efm.setPort(Integer.parseInt(port));
- efm.setEmailAddress(emailAddress);
- efm.setPassword(password);
- // Run in secured mode
- efm.setSecured(true);
- efm.setTrustStoreName(trustStorePath);
- SendFaxResponse rs = efm.sendFax(destination,
- accountCode,
- userCode,
- TSI,
- alternateDeliveryNotice,
- deliveryNoticeType,
- faxResolution,
- to,
- from,
- attachments);
- System.out.println("Transaction Id : " + rs.getTransactionId());
- } catch (ELSException e) {
- System.out.println("Exception message "+e.getMessage());
- e.printStackTrace();
- }
- }
- private static File[] getAttachments(String filePath) {
- String[] filePaths = filePath.split(";");
- File[] files = new File[filePaths.length];
- int cntr=0;
- for(int i=0;i
- String fPath = filePaths[i];
- files[cntr++] = new File(fPath);
- }
- return files;
- }
- }