0
私は以下のコードに示すようにファックスを送信するためのグローバルAPIを持っていますが、現在は単一のファイルを添付ファイルとして送信できますそして、ファイル名は、ここで1つのファックスで複数のファイルを送信する
C:\\INVOICES\\2017\\NOV\\Omni-PBS OU\\Non-Auto\\Non-Auto (with late fee)\\2210098.pdf///C:\\INVOICES\\2017\\NOV\\Automatic Invoice Payment Authorization Form - MTBC.pdf///C:\\INVOICES\\2017\\NOV\\Important Announcement - MTBC.pdf
データベースで利用できるように、この順序であるファックス
package oracle.apps.print;
import com.softlinx.replixfax.*;
import javax.xml.ws.*;
import org.apache.commons.codec.binary.Base64;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Path;
import java.io.File;
public class Fax {
public String Fax(String Filepath,String faxno,String flg) {
try {
ReplixFaxService service = new ReplixFaxService();
ReplixFaxPort port = service.getReplixFaxPort();
((BindingProvider) port).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "user");
if (flg.toString().equals("N")) {
((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,"https://api.rpxfax.com/softlinx/replixfax/wsapi");
} else {
((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,"https://api.rpxtest.com:8083/softlinx/replixfax/wsapi");
}
Authentication auth = new Authentication();
auth.setLogin("user");
String password="pwd";
auth.setPassword(org.apache.commons.codec.binary.Base64.encodeBase64String(password.getBytes()));
auth.setRealm("MTBC");
auth.setPasswordSecurity("base64");
SendFaxInput sendFaxInput = new SendFaxInput();
sendFaxInput.setAuthentication(auth);
FaxRecipient recipient = new FaxRecipient();
recipient.setFaxNumber(faxno.toString());
Attachment attachment = new Attachment();
File f = new File(Filepath.toString());
attachment.setFileName(f.getName());
Path path = Paths.get(Filepath.toString());
byte[] data = Files.readAllBytes(path);
attachment.setAttachmentContent(data);
sendFaxInput.getFaxRecipient().add(recipient);
sendFaxInput.getAttachment().add(attachment);
SendFaxOutput result = port.sendFax(sendFaxInput);
System.out.println("Status Code= " + result.getRequestStatus().getStatusCode());
if(result.getFaxInfo() != null){
System.out.println("Fax ID = " + result.getFaxInfo().get(0).getFaxId());
}
return result.getRequestStatus().getStatusCode();
//return "a";
} catch (Exception ex) {
System.out.println("Exception: " + ex.getMessage());
return ex.getMessage();
}
}
}
を送信するための完全なコードは、私が
0でファイルを添付していますですAttachment attachment = new Attachment();
File f = new File(Filepath.toString());
attachment.setFileName(f.getName());
Path path = Paths.get(Filepath.toString());
byte[] data = Files.readAllBytes(path);
attachment.setAttachmentContent(data);
sendFaxInput.getFaxRecipient().add(recipient);
sendFaxInput.getAttachment().add(attachment);
私は複数の添付ファイルの形に私の上記のファイルの文字列を解析することができ、 は私が助け
String[] f_paths = Filepath.split("///");
for (int i = 0; i < f_paths.length; i++) {
Attachment attachment = new Attachment();
File f = new File(f_paths[i].toString());
attachment.setFileName(f.getName());
Path path = Paths.get(f_paths[i].toString());
byte[] data = Files.readAllBytes(path);
attachment.setAttachmentContent(data);
sendFaxInput.getAttachment().add(attachment);
}
だけ分割のためのコードを追加すること自分でこれを解決してきた添付ファイル