import cc.interfax.www.SendCharFax;
import cc.interfax.www.SendCharFaxResponse;
public class SendCharFaxTest {
    public void run() throws Exception {
        cc.interfax.www.InterFaxSoapStub theBinding;
        try {
           theBinding = (cc.interfax.www.InterFaxSoapStub)
                        new cc.interfax.www.InterFaxLocator().getInterFaxSoap();
        }
        catch (javax.xml.rpc.ServiceException jre) {
           if(jre.getLinkedCause()!=null)
                jre.getLinkedCause().printStackTrace();
            throw new RuntimeException("JAX-RPC ServiceException caught: " + jre);
        }
        // Time out after a minute
        theBinding.setTimeout(60000);
        // Send a simple text fax using the InterFax sendCharFax() web service method.
        System.out.println("Sending Fax using sendCharFax()");
        SendCharFax theParams = new SendCharFax(TestConstants.USERNAME,
              TestConstants.PASSWORD,
              TestConstants.FAX_NUMBER,
              "This is a test fax message.",
              "TXT");
        SendCharFaxResponse theResponse = theBinding.sendCharFax(theParams);
        long theReturnCode = theResponse.getSendCharFaxResult();
        System.out.println("sendCharFax() call returned with code: " + theReturnCode);
    }
    public static void main(String[] anArgs) {
        try {
            new SendCharFaxTest().run();
        } catch(Exception theE) {
           System.out.println("Error encountered while running SendCharFaxTest:");
           theE.printStackTrace();
        }
     }
}