|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.efaxdeveloper.util.inbound.InboundRequest
public class InboundRequest
InboundRequest application interface
Overview
InboundRequest is the application interface betweeneFax Developer™
and a client-side inbound POST request program or process.The following snippet provides an example of how the InboundRequest application interface might be used within a client-side process:
// Establish a PrintWriter for the response PrintWriter out = response.getWriter(); // Begin building the HTML response out.println("<html>"); out.println("<head><title>InboundRequestServlet</title></head>"); out.println("<body bgcolor=\"#ffffff\">"); out.println("<p>The servlet has received a GET. This is the reply.</p>"); // Establish the path to your XSD schema when XML validation is desired String xsdPath = "C:\\samples\\inbound\\Sample.xsd"; try { // Establish a new InboundRequest object with XSD validation InboundRequest req = new InboundRequest(request.getParameter("xml"), xsdPath); // Decode the Base64 encoded document to a specified location. The file // will be stored to your specified path using the fax name retrieved from // the XML POST FaxName parameter. Note that you are providing a directory // path to a location where you would like the physical file to be written. // The following method call is not required. If the following method is not // called, a hard copy of the physical fax will not be generated on your server. req.getDocumentAsFile("C:\\samples\\inbound\\"); // Retrieve the wrapper data for the inbound fax out.println("<br>UserName: " + req.getUserName()); out.println("<br>Password: " + req.getPassword()); out.println("<br>RequestDate: " + req.getRequestDateAsString()); out.println("<br>RequestType: " + req.getRequestType()); out.println("<br>AccountID: " + req.getAccountID()); out.println("<br>NumberDialed: " + req.getNumberDialed()); out.println("<br>DateReceived: " + req.getDateReceivedAsString()); out.println("<br>FaxName: " + req.getFaxName()); out.println("<br>FileType: " + req.getFileType()); out.println("<br>PageCount: " + req.getPageCount()); out.println("<br>CSID: " + req.getCSID()); out.println("<br>ANI: " + req.getANI()); out.println("<br>Status: " + req.getStatus()); out.println("<br>MCFID: " + req.getMCFID()); // When user field name/value pairs have been passed (optional setting) if (req.hasUserFields()) { // Begin processing user name/value pairs out.println("<p><b>UserField name/value pair(s) follow:<br></b>"); // Establish a TreeMap object to hold the user name/value pairs Map<String, String> userFields = new TreeMap<String, String>(req.getUserFields()); // Store the TreeMap contents to an ArrayList object for sorting ArrayList<String> keys = new ArrayList<String>(userFields.keySet()); // Establish an Iterator object for the List object Iterator<String> iterator = keys.iterator(); // Establish a String object to hold the user field name String fieldName = ""; // Establish a String object to hold the user field value String fieldValue = ""; // Spin through the list of user name/value pairs while(iterator.hasNext()) { // Store the field name value fieldName = (String)iterator.next(); // Store the field value fieldValue = (String)userFields.get(fieldName); // Print the user name/value pairs received in the XML out.println("<br>" + fieldName + ": " + fieldValue); } out.println("</p>"); } // When barcode fields have been passed (optional setting) if (req.hasBarcodes()) { // Begin processing barcode fields out.println("<p><b>Barcode value(s) follow:</b><br>"); // Establish a new ArrayList object to hold all Barcode objects. Use // the getBarcodesByPage(int) method to return all Barcode objects // from a specified page. ArrayList<Barcode> barcodes = new ArrayList<Barcode>(req.getBarcodes()); // Establish a null Barcode reference Barcode b = null; // Establish an iterator Object Iterator<Barcode> iterator = barcodes.iterator(); // Process each Barcode object while (iterator.hasNext()) { // Retrieve a Barcode object b = new Barcode(iterator.next()); // Retrieve the Barcode state out.println("<br>Key: " + b.getKey()); out.println("<br>ReadSequence: " + b.getReadSequence()); out.println("<br>ReadDirection: " + b.getReadDirection()); out.println("<br>Symbology: " + b.getSymbology()); out.println("<br>PageNumber: " + b.getPageNumber()); out.println("<br>XStartPointA: " + b.getXStartPointA()); out.println("<br>XStartPointB: " + b.getXStartPointB()); out.println("<br>YStartPointA: " + b.getYStartPointA()); out.println("<br>YStartPointB: " + b.getYStartPointB()); out.println("<br>XEndPointA: " + b.getXEndPointA()); out.println("<br>XEndPointB: " + b.getXEndPointB()); out.println("<br>YEndPointA: " + b.getYEndPointA()); out.println("<br>YEndPointB: " + b.getYEndPointB()); out.println("<br>--------------------------------------------"); } out.println("</p>"); } // The existence of the following string anywhere in your output display // will cause eFax Developer to move the inbound fax into your desired "Good" // folder. Otherwise, eFax Developer will consider the XML POST attempt a // failure and the inbound fax will be moved into your desired "Bad" folder. out.println("<p>Post Successful</p>"); } catch (Exception e) { e.printStackTrace(); out.println("<p>Post Failed!</p>"); } catch (Error err) { err.printStackTrace(); out.println("<p>Post Failed!</p>"); } finally { out.println("</body></html>"); out.flush(); out.close(); }
Barcode
Field Summary | |
---|---|
static java.lang.String |
DF_01
Date format "01/01/2005 12:30:00 PM" returns "01/01/2005 13:30:00" (Default) |
static java.lang.String |
DF_02
Date format "01/01/2005 12:30:00 PM" returns "01/01/2005 13:30" |
static java.lang.String |
DF_03
Date format "01/01/2005 12:30:00 PM" returns "01/01/2005 12:30:00 PM" |
static java.lang.String |
DF_04
Date format "01/01/2005 12:30:00 PM" returns "01/01/2005 12:30 PM" |
static java.lang.String |
DF_05
Date format "01/01/2005 12:30:00 PM" returns "01/01/2005" |
static java.lang.String |
DF_06
Date format "01/01/2005 12:30:00 PM" returns "2005/01/01 13:30:00" |
static java.lang.String |
DF_07
Date format "01/01/2005 12:30:00 PM" returns "2005/01/01 13:30" |
static java.lang.String |
DF_08
Date format "01/01/2005 12:30:00 PM" returns "2005/01/01 12:30:00 PM" |
static java.lang.String |
DF_09
Date format "01/01/2005 12:30:00 PM" returns "2005/01/01 12:30 PM" |
static java.lang.String |
DF_10
Date format "01/01/2005 12:30:00 PM" returns "2005/01/01" |
static java.lang.String |
DF_11
Date format "01/01/2005 12:30:00 PM" returns "January 1, 2005 13:30:00" |
static java.lang.String |
DF_12
Date format "01/01/2005 12:30:00 PM" returns "January 1, 2005 13:30" |
static java.lang.String |
DF_13
Date format "01/01/2005 12:30:00 PM" returns "January 1, 2005 12:30:00 PM" |
static java.lang.String |
DF_14
Date format "01/01/2005 12:30:00 PM" returns "January 1, 2005 12:30 PM" |
static java.lang.String |
DF_15
Date format "01/01/2005 12:30:00 PM" returns "January 1, 2005" |
static java.lang.String |
DF_16
Date format "01/01/2005 12:30:00 PM" returns "Jan 1, 2005 13:30:00" |
static java.lang.String |
DF_17
Date format "01/01/2005 12:30:00 PM" returns "Jan 1, 2005 13:30" |
static java.lang.String |
DF_18
Date format "01/01/2005 12:30:00 PM" returns "Jan 1, 2005 12:30:00 PM" |
static java.lang.String |
DF_19
Date format "01/01/2005 12:30:00 PM" returns "Jan 1, 2005 12:30 PM" |
static java.lang.String |
DF_20
Date format "01/01/2005 12:30:00 PM" returns "Jan 1, 2005" |
Constructor Summary | |
---|---|
InboundRequest(java.io.File xml)
Constructor used to instantiate using a File object without validation. |
|
InboundRequest(java.io.File xml,
java.lang.String xsdPath)
Constructor used to instantiate using a File object with validation. |
|
InboundRequest(java.lang.String xml)
Constructor used to instantiate using an XML string without validation. |
|
InboundRequest(java.lang.String xml,
java.lang.String xsdPath)
Constructor used to instantiate using an XML string with validation. |
Method Summary | |
---|---|
java.lang.String |
getAccountID()
Method to retrieve the AccountID from the XML POST. |
java.lang.String |
getANI()
Method to retrieve the ANI from the XML POST. |
java.util.ArrayList<Barcode> |
getBarcodes()
Method to retrieve an ArrayList of Barcode objects. |
java.util.ArrayList<Barcode> |
getBarcodesByPage(int page)
Method to retrieve an ArrayList of Barcode objects
for a selected page. |
int |
getBarcodesRead()
Method to retrieve the total count of barcodes read. |
java.lang.String |
getCSID()
Method to retrieve the CSID from the XML POST. |
java.util.Date |
getDateReceivedAsDate()
Method to retrieve the DateReceived from the XML POST as a Date object. |
java.lang.String |
getDateReceivedAsString()
Method to retrieve the DateReceived from the XML POST in the default format. |
java.lang.String |
getDateReceivedAsString(java.lang.String format)
Method to retrieve the DateReceived from the XML POST in a desired format. |
java.lang.String |
getDocumentAsBase64()
Method to retrieve the FileContents from the XML POST. |
byte[] |
getDocumentAsBytes()
Method to retrieve the FileContents from the XML POST. |
void |
getDocumentAsFile(java.lang.String documentPath)
Method to retrieve the FileContents from the XML POST. |
java.lang.String |
getFaxName()
Method to retrieve the FaxName from the XML POST. |
java.lang.String |
getFileType()
Method to retrieve the FileType from the XML POST. |
java.lang.String |
getMCFID()
Method to retrieve the MCFID from the XML POST. |
java.lang.String |
getNumberDialed()
Method to retrieve the NumberDialed from the XML POST. |
java.lang.String |
getPageAsBase64(int page)
Method to retrieve the PageContents from the XML POST. |
byte[] |
getPageAsBytes(int page)
Method to retrieve the PageContents from the XML POST. |
void |
getPageAsFile(java.lang.String pagePath,
int page)
Method to retrieve the PageContents from the XML POST. |
int |
getPageCount()
Method to retrieve the PageCount from the XML POST. |
void |
getPagesAsFiles(java.lang.String pagePath)
Method to retrieve the PageContents from the XML POST. |
java.lang.String |
getPassword()
Method to retrieve the optional Password from the XML POST. |
java.util.Date |
getRequestDateAsDate()
Method to retrieve the RequestDate from the XML POST as a Date object. |
java.lang.String |
getRequestDateAsString()
Method to retrieve the RequestDate from the XML POST in the default format. |
java.lang.String |
getRequestDateAsString(java.lang.String format)
Method to retrieve the RequestDate from the XML POST in a desired format. |
java.lang.String |
getRequestType()
Method to retrieve the RequestType from the XML POST. |
java.lang.String |
getStatus()
Method to retrieve the Status from the XML POST. |
java.util.Map<java.lang.String,java.lang.String> |
getUserFields()
Method to retrieve a Map object of user defined field name/value pairs. |
int |
getUserFieldsRead()
Method to retrieve the total count of user defined fields read. |
java.lang.String |
getUserName()
Method to retrieve the optional UserName from the XML POST. |
boolean |
hasBarcodes()
Method to determine whether or not the XML POST contains barcodes. |
boolean |
hasUserFields()
Method to determine whether or not the XML POST contains user defined fields. |
boolean |
isPageSplitting()
Method to determine whether or not the XML POST contains page splits. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DF_01
public static final java.lang.String DF_02
public static final java.lang.String DF_03
public static final java.lang.String DF_04
public static final java.lang.String DF_05
public static final java.lang.String DF_06
public static final java.lang.String DF_07
public static final java.lang.String DF_08
public static final java.lang.String DF_09
public static final java.lang.String DF_10
public static final java.lang.String DF_11
public static final java.lang.String DF_12
public static final java.lang.String DF_13
public static final java.lang.String DF_14
public static final java.lang.String DF_15
public static final java.lang.String DF_16
public static final java.lang.String DF_17
public static final java.lang.String DF_18
public static final java.lang.String DF_19
public static final java.lang.String DF_20
Constructor Detail |
---|
public InboundRequest(java.io.File xml) throws java.lang.Exception
xml
- local File object containing an XML string
java.lang.Exception
InboundRequest(String)
,
InboundRequest(File, String)
,
InboundRequest(String, String)
public InboundRequest(java.io.File xml, java.lang.String xsdPath) throws java.lang.Exception
xml
- local File object containing an XML stringxsdPath
- the XSD schema full path and file name
java.lang.Exception
InboundRequest(File)
,
InboundRequest(String)
,
InboundRequest(String, String)
public InboundRequest(java.lang.String xml) throws java.lang.Exception
xml
- the XML string returned by eFax Developer™
java.lang.Exception
public InboundRequest(java.lang.String xml, java.lang.String xsdPath) throws java.lang.Exception
xml
- the XML string returned by eFax Developer™xsdPath
- the XSD schema full path and file name
java.lang.Exception
InboundRequest(File)
,
InboundRequest(String)
,
InboundRequest(File, String)
Method Detail |
---|
public java.lang.String getAccountID()
The account id contains the eFax Developer™ account client identifier.
public java.lang.String getANI()
The automatic number identification (caller id) contains the calling party's fax number.
public java.util.ArrayList<Barcode> getBarcodes()
Barcode
objects.
Barcode
objectshasBarcodes()
,
getBarcodesRead()
,
getBarcodesByPage(int)
public java.util.ArrayList<Barcode> getBarcodesByPage(int page)
Barcode
objects
for a selected page.
page
- contains the desired page number for barcodes to be returned
Barcode
objectshasBarcodes()
,
getBarcodesRead()
,
getBarcodes()
public int getBarcodesRead()
getBarcodes()
,
getBarcodesByPage(int)
public java.lang.String getCSID()
The station identifier, when supplied by the receiving fax machine upon successful transmission.
public java.util.Date getDateReceivedAsDate() throws java.text.ParseException
The date received contains the date/time at which the fax was initially received in your eFax Developer™ inbox.
java.text.ParseException
getDateReceivedAsString()
,
getDateReceivedAsString(String)
public java.lang.String getDateReceivedAsString()
The date received contains the date/time at which the fax was initially received in your eFax Developer™ inbox.
getDateReceivedAsDate()
,
getDateReceivedAsString(String)
public java.lang.String getDateReceivedAsString(java.lang.String format)
The date received contains the date/time at which the fax was initially received in your eFax Developer™ inbox.
The provided format must meet java.text.SimpleDateFormat specifications. Invalid, null, or empty formats will result in a default "MM/dd/yyyy hh:mm:ss" format being used.
format
- contains the desired string format to be returned
getDateReceivedAsDate()
,
getDateReceivedAsString()
public java.lang.String getDocumentAsBase64() throws java.lang.Exception
The FileContents contains a Base64 encoded representation of the physical document.
This method will return the Base64 string representation as-is.
java.lang.Exception
getDocumentAsBytes()
,
getDocumentAsFile(String)
public byte[] getDocumentAsBytes() throws java.lang.Exception
The FileContents contains a Base64 encoded representation of the physical document.
This method will decode the contents and return a byte array to the calling application.
java.lang.Exception
getDocumentAsBase64()
,
getDocumentAsFile(String)
public void getDocumentAsFile(java.lang.String documentPath) throws java.lang.Exception
The FileContents contains a Base64 encoded representation of the physical document.
This method will decode the file contents to a specified path. The file created will be given the same name passed in the FaxName container.
documentPath
- contains the desired path to where the physical file should be written
java.lang.Exception
getDocumentAsBytes()
,
getDocumentAsBase64()
public java.lang.String getFaxName()
The fax name contains the fax name given by eFax Developer™ or as changed by the client via the online interface.
public java.lang.String getFileType()
The physical file type of the document as stored in eFax Developer™.
The value returned will either be "tif" or "pdf" depending on the account's file type setting when the inbound fax was received.
public java.lang.String getMCFID()
The MCFID contains eFax Developer's inbound fax identifier.
public java.lang.String getNumberDialed()
The actual fax number that was dialed.
The number dialed contains the actual fax number on which the inbound fax was received.
public java.lang.String getPageAsBase64(int page) throws java.lang.Exception
This method is called by clients who have their page splitting option set in eFax Developer™.
All other clients should use the
getDocumentAsBase64()
method instead.
The PageContents contains a Base64 encoded representation of a physical page within a document.
This method will return the Base64 string representation as-is or null if no pages are found.
page
- contains the desired page number to be returned
java.lang.Exception
isPageSplitting()
,
getPageAsBytes(int)
,
getPageAsFile(String, int)
,
getPagesAsFiles(String)
public byte[] getPageAsBytes(int page) throws java.lang.Exception
This method is called by clients who have their page splitting option set in eFax Developer™.
All other clients should use the
getDocumentAsBytes()
method instead.
The PageContents contains a Base64 encoded representation of a physical page within a document.
This method will decode the contents and return a byte array to the calling application.
page
- contains the desired page number to be returned
java.lang.Exception
isPageSplitting()
,
getPageAsBase64(int)
,
getPageAsFile(String, int)
,
getPagesAsFiles(String)
public void getPageAsFile(java.lang.String pagePath, int page) throws java.lang.Exception
This method is called by clients who have their page splitting option set in eFax Developer™.
All other clients should use the
getDocumentAsFile()
method instead.
The PageContents contains a Base64 encoded representation of a physical page within a document.
This method will decode the contents of a designated page to a specified path. The file created will be given the same name passed in the FaxName container suffixed with the actual page number.
pagePath
- contains the desired path to where the physical page files should be writtenpage
- contains the desired page number
java.lang.Exception
isPageSplitting()
,
getPageAsBase64(int)
,
getPageAsBytes(int)
,
getPagesAsFiles(String)
public int getPageCount()
The number of physical pages contained within the fax document.
public void getPagesAsFiles(java.lang.String pagePath) throws java.lang.Exception
This method is called by clients who have their page splitting option set in eFax Developer™.
All other clients should use the
getDocumentAsFile()
method instead.
The PageContents contains a Base64 encoded representation of a physical page within a document.
This method will decode the contents of each page to a specified path. The file(s) created will be given the same name passed in the FaxName container suffixed with the actual page number.
pagePath
- contains the desired path to where the physical page files should be written
java.lang.Exception
isPageSplitting()
,
getPageAsBase64(int)
,
getPageAsBytes(int)
,
getPageAsFile(String, int)
public java.lang.String getPassword()
The password is provided as an additional security measure in the event that client-side processing wishes to validate the XML by account credentials.
public java.util.Date getRequestDateAsDate() throws java.text.ParseException
The request date is the actual date/time at which the XML was generated.
The request date should not be confused with the received date which contains the date/time at which the fax was initially received in your eFax Developer™ inbox.
java.text.ParseException
getRequestDateAsString()
,
getRequestDateAsString(String)
public java.lang.String getRequestDateAsString()
The request date is the actual date/time at which the XML was generated.
The request date should not be confused with the received date which contains the date/time at which the fax was initially received in your eFax Developer™ inbox.
getRequestDateAsDate()
,
getRequestDateAsString(String)
public java.lang.String getRequestDateAsString(java.lang.String format)
The request date is the actual date/time at which the XML was generated.
The request date should not be confused with the received date which contains the date/time at which the fax was initially received in your eFax Developer™ inbox.
The provided format must meet java.text.SimpleDateFormat specifications. Invalid, null, or empty formats will result in a default "MM/dd/yyyy hh:mm:ss" format being used.
format
- contains the desired string format to be returned
getRequestDateAsDate()
,
getRequestDateAsString()
public java.lang.String getRequestType()
The request type indicates how the request was generated.
An initial inbound fax will generate XML with a request type of "New Inbound," while a manual re-post will generate XML with a request type of "Manual Repost."
public java.lang.String getStatus()
The status contains a numeric value indicating the fax status. A "0" value indicates a successful transmission while all other values indicate an error code which can be cross-referenced with a eFax Developer supplied table.
public java.util.Map<java.lang.String,java.lang.String> getUserFields()
hasUserFields()
,
getUserFieldsRead()
public int getUserFieldsRead()
hasUserFields()
,
getUserFields()
public java.lang.String getUserName()
The user name is provided as an additional security measure in the event that client-side processing wishes to validate the XML by account credentials.
public boolean hasBarcodes()
This method will return true if the account is set to analyze the fax image for barcodes.
getBarcodes()
,
getBarcodesByPage(int)
public boolean hasUserFields()
This method will return true if the account is set to return user defined fields.
getUserFieldsRead()
,
getUserFields()
public boolean isPageSplitting()
This method will return true if the client's account is set to return the fax image as individual pages.
getPageAsBase64(int)
,
getPageAsBytes(int)
,
getPageAsFile(String, int)
,
getPagesAsFiles(String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |