Shabzt
asked on
How can I send fax
My System is in network, where we have network fax/printer/scanner. How can I send fax from my system using java?
http://www.java4less.com/java_fax.htm
I dealt with this a couple years ago. All the pure Java solutions at the time were pretty clunky. I ended up getting a product called Relay Fax. You can attach Relay Fax to a POP mailbox. It will then pickup emails where it uses the body of the email as the cover page and converts any attachments and appends them to the fax. There are keywords you can put into the body of the email for recipient, co name, etc.
I used Java mail to send the email to the email box Relay Fax was using.
The relay fax product can be found here:
http://www.altn.com/products/default.asp/product_id/RelayFax
I imagine you could probably do this with any fax server that can use a pop mailbox.
Paul
I used Java mail to send the email to the email box Relay Fax was using.
The relay fax product can be found here:
http://www.altn.com/products/default.asp/product_id/RelayFax
I imagine you could probably do this with any fax server that can use a pop mailbox.
Paul
class TestFax { public static void main(String[] args) throws Exception {
String str1 = "First test fax.";
String str2 = "Second test fax.";
//Concat the Strings in order to use the Web Service
String testStr = str1.concat(str2);
Integer len1 = new Integer(str1.length());
Integer len2 = new Integer(str2.length());
int testStrLen = testStr.length();
String fileLen = len1.toString().concat(";" ).concat(l en2.toStri ng());
byte[] b = new byte[testStrLen];
for (int i=0;i<testStrLen;i++) {
char c = testStr.charAt(i); b[i] = (byte)c;
}
// Create date object
GregorianCalendar gc = new GregorianCalendar(2003,3,1 5,17,10); // 15 - March - 2003, 17:10
try {
long result; // Create an instance of the Web Service Object
InterFaxSoapStub ifs = new InterFaxSoapStub(new URL("http://ws.interfax.net/DFS.asmx"), new Service(new QName("Sendfax")));
System.out.println("Begin to send fax");
// Invoke SendfaxEx_2 method
result = ifs.SendfaxEx_2("MyUserNam e","MyPass word","+1- 212-456789 0", "", b, "TXT;TXT", fileLen, gc, 0, "CSID", "", "", "Java Test", "dummy@interfax.net", "A4", "Portrait", true, false);
if (result > 0)
// Positive result indicates that the fax was sent successfully.
// The return value is the TransactionID.
System.out.println("Fax was sent successfully. Transaction number: " + result);
else
//Fax sending failure.
System.out.println("Error sending fax!" + result);
}
catch(Exception e) {
System.out.println(e.toStr ing());
} } }
String str1 = "First test fax.";
String str2 = "Second test fax.";
//Concat the Strings in order to use the Web Service
String testStr = str1.concat(str2);
Integer len1 = new Integer(str1.length());
Integer len2 = new Integer(str2.length());
int testStrLen = testStr.length();
String fileLen = len1.toString().concat(";"
byte[] b = new byte[testStrLen];
for (int i=0;i<testStrLen;i++) {
char c = testStr.charAt(i); b[i] = (byte)c;
}
// Create date object
GregorianCalendar gc = new GregorianCalendar(2003,3,1
try {
long result; // Create an instance of the Web Service Object
InterFaxSoapStub ifs = new InterFaxSoapStub(new URL("http://ws.interfax.net/DFS.asmx"), new Service(new QName("Sendfax")));
System.out.println("Begin to send fax");
// Invoke SendfaxEx_2 method
result = ifs.SendfaxEx_2("MyUserNam
if (result > 0)
// Positive result indicates that the fax was sent successfully.
// The return value is the TransactionID.
System.out.println("Fax was sent successfully. Transaction number: " + result);
else
//Fax sending failure.
System.out.println("Error sending fax!" + result);
}
catch(Exception e) {
System.out.println(e.toStr
} } }
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.