Java Fax – Retrieve a List of Inbound Faxes Using GetList

This Java fax sample demonstrates the GetList method, which allows you to retrieve a list of inbound (received) faxes.

Using the Java fax API snippet below, you can display information for a number of submitted faxes.

The GetList sample can also be found as part of the ZIP file above (see the green ‘Download’ box), under the path interfaxJavaSamples > src > GetListOfInboundFaxes.

import net.interfax.inbound.GetList;
import net.interfax.inbound.GetListResponse;
import net.interfax.inbound.ListType;
import net.interfax.inbound.MessageItem;
import net.interfax.outbound.TestConstants;

public class GetListOfInboundFaxes {

    /******** Begin settings ********/
    static String USERNAME = "";      // Enter your Interfax username here
    static String PASSWORD = "";      // Enter your Interfax password here
    static int MAX_ITEMS = 10;        // Maximum number of inbound faxes to return in list
    /******** End settings ********/
    public static void main(String[] anArgs) {
        try {
            net.interfax.inbound.InboundSoapStub theBinding = (net.interfax.inbound.InboundSoapStub) new net.interfax.inbound.InboundLocator().getInboundSoap();

            System.out.println("Retrieving inbound fax list using getList().");

            GetList parameters = new GetList(TestConstants.USERNAME,
                    ListType.AllMessages,    // Select the type of list you wish to return
                    10, // max items
                    new MessageItem[0]

            GetListResponse response = theBinding.getList( parameters );
            System.out.println("GetList() call returned with code: " + response.getGetListResult());
            System.out.println( "Items returned: " + response.getObjMessageItem().length );

        } catch(Exception theE) {