Java Fax - Get Detailed Information About Outbound Faxes

This section demonstrates the FaxQuery method, which provides more advanced querying capabilities than the FaxStatusEx method (for more details, see Side-by-side Comparison of Web Service Methods). This Java Fax code sample can also be found in the ZIP file above (see the green 'Download' box), under the path interfaxJavaSamples > src > GetStatusWithFaxQuery.

In the Java fax API snippet below, FaxQuery is used to retrieve information about one or more outbound (submitted) faxes:


import net.interfax.outbound.FaxItemEx;
import net.interfax.outbound.FaxQuery;
import net.interfax.outbound.FaxQueryResponse;

public class GetStatusWithFaxQuery {

    /******** Begin settings ********/
    static String USERNAME = "";      // Enter your Interfax username here
    static String PASSWORD = "";      // Enter your Interfax password here
    static String QUERY_VERB = "LT";                 // Very flexible, see documentation
    static String QUERY_DATA = "999999999";
    static int MAX_ITEMS = 10;                       // How many transactions to return information for
    /******** End settings ********/
    
    public static void main(String[] anArgs) {
        try {
            net.interfax.outbound.InterFaxSoapStub theBinding = (net.interfax.outbound.InterFaxSoapStub)new net.interfax.outbound.InterFaxLocator().getInterFaxSoap();
            theBinding.setTimeout(60000);

            FaxQuery theParams = new FaxQuery(
                    USERNAME,
                    PASSWORD,
                    QUERY_VERB,
                    QUERY_DATA,
                    -1, // max items
                    -1  // result code
                    );
            FaxQueryResponse response = theBinding.faxQuery(theParams);

            int resultCode = response.getResultCode();
            FaxItemEx[] results = response.getFaxQueryResult();
            System.out.println("Service call completed with status: " + resultCode);
            if(null==results) {
                System.out.println("Null result");
            } else {
                System.out.println("FaxQuery call succeeded.");
                for (int i=0;i

Contact us today

Talk to a member of our team about the benefits InterFAX can bring to your organization's communications processes.

Contact us today