Solved

How can I send fax

Posted on 2006-07-22
4
257 Views
Last Modified: 2011-09-20
My System is in network, where we have network fax/printer/scanner. How can I send fax from my system using java?
0
Comment
Question by:Shabzt
4 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 17159799
0
 
LVL 4

Expert Comment

by:pzepernick
ID: 17160409
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
0
 
LVL 2

Expert Comment

by:RoyalNepal
ID: 17160816
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(len2.toString());

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,15,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("MyUserName","MyPassword","+1-212-4567890", "", 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.toString());

} } }
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 17161489
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
scoresSpecial  challenge 13 40
noX challenge 17 76
topping1 challenge 7 50
Error with Java/Cache JDBC Classpath 2 19
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now