Our X9Ware SDK Examples are designed to show common use cases, but cannot cover the myriad of things that can be performed by our SDK. You can review the SDK API to get a feeling for the large number of classes and methods that are available. It would be impossible to provide code examples for all of the operations and variations that can be performed by the SDK. Our X9Assist application is a real world example of the types of things that can be done by the SDK, since it is built directly on top of the SDK and is an excellent illustration of what can be done. To this end, we have published the actual source code to our X9Utilities product, which is similarly built on top of the SDK. Please take a close look at both our SDK examples and the X9Utilities source code, since together they provide good insight into the overall capabilities. However, if you need to solve a specific issue that is not represented by these examples, please contact us and let us know exactly what you need. In those cases, we may provide you a code snippet that addresses your specific requirement, expand one of our existing SDK examples to demonstrate your need, or perhaps even develop and publish a new SDK example program that fully satisfies the requested capability. Our goal is to ensure that there are adequate examples to allow the SDK to be fully reviewed, and we believe that these actions will be helpful for both prospective and current customers.
Please find an SDK Examples ZIP package (at the bottom on this page) that can be downloaded. Contents are as follows:
- sdkExamples: these samples are working programs and can be reviewed in combination with the SDK JavaDoc that is available as part of our SDK Documentation. We strive to make our examples package as complete as possible. Please provide comments on possible additions and improvements.
- sdkUtilities: this is the complete source code to our X9Utilities product, which is based on the SDK. X9Ware is providing this source code public realizing that a complete SDK based application will be helpful. These are not just theoretical examples, but the actual working source code for X9Utilities that will be updated with each release as it is published. We believe that this source may well be the best example of our SDK, since our design goal for X9Utilities is to reference and leverage functionality that is implemented within our SDK product. Hence the technical approach has been to minimize code within X9Utilities by pushing as much of the implementation as possible into the core SDK. You will see this in the X9Utilities source code, where the design thus allows those core SDK classes to be incorporated in your applications.
- sdkSpringUtilWriter: this is an example of a Spring Boot application which launches X9Utilities within the SDK itself (it runs X9Utilities classes within the SDK jar). This is a good example of how X9Utilities functions can be launched using a simulated command line. Although this is clearly possible, it is suggested that an SDK application program can instead be implemented on a more granular basis by actually invoking the required SDK-based application code.
Regarding the SDK examples package, a good representation of the power of our SDK is demonstrated by the X9DemoWriter example. This is a 500 line “sample” Java program that includes all of the functionality required to build an x9 file with complete control at the record, field, and image level. It shows how an x9 file can be easily created with the specific values that you require populated in individual record types, to be accepted by your financial institution. It also shows how images can be easily inserted into record type 52. It allows credits (of various formats) to be created and positioned where needed for the endpoint processor; it allows addendums and type 68 user records to be attached to items; provides many options on how totals are accumulated and populated (especially for credits); automatically populated all trailer totals; allows deposit ticket images to be drawn dynamically; and it allows the contents of the file headers/trailers to be parameterized and populated from xml (or from your database, internal control files, etc).
Number | Java Example | Description |
---|---|---|
1 | X9DemoWriter | X9DemoWriter is a demo x9 writer which highlights the ability to easily create an x9 file using our x9writer technology, which allows files to be written on a logical basis (independent of the target financial institution). This design becomes especially advantageous when creating files from multiple institutions, since it allow your application program to work on a logical item basis. HeaderXml is used to externally define the contents of the x9 header records (file header, cash letter header, and bundle header). X9Writer is used to manager the actual creation of the records within the x9 file itself. Finally, X9Item is used to create individual items (checks) that are easily added to the x9 file as it is being constructed. As a demonstration of SDK performance, this sample program runs in less then 5 seconds when creating an x9 file with 5,000 items, on a Dell laptop with the images stored on a local SSD. |
2 | X9ConstructX9 | X9ConstructX9 is an alternative to X9DemoWriter. The output x9 file is written on a record by record basis, with (almost) all records formatted explicitly within the program itself. Although this provides complete control over each individual record that is written, this approach is much more complex that our recommendation to based application code on our x9writer functionality, as demonstrated by X9DemoWriter. X9ConstructX9 still takes advantage of several core components of our SDK. First is that it uses the x9factory to populate fields based on the current x9 specification (for example x9.37 DSTU, x9.100-187-2008, etc). This means that you can provide values for logical fields which may not actually exist, based on the x9 specification being used. Second is that it allows the SDK to calculate and populate content of all trailer records (batch trailer, cash letter trailer, and file trailer) subject to content and the x9 specification that is being used. |
3 | X9DemoWriterThreaded | X9DemoWriterThreaded was developed as a sample of running x9writer in a multi-threaded environment, where twenty (20) files are created in parallel. It provides insight into how the SDK can be run across concurrent threads, and also shows the power of the SDK to run in a high volume production environment. As a demonstration of SDK, this sample program runs in less then 30 seconds when creating twenty files with 5,000 items each, on a Dell laptop with the images stored on a local SSD. |
4 | X9Utilities | X9Ware has made this source code public knowing that a complete SDK based application will be helpful. This source represents the actual production version of our X9Utilities product. These are not just theoretical examples, but the actual working source code for X9Utilities that will be updated with each release as they are published. We believe that this source may well be the best example of our SDK, since our design goal for X9Utilities is to reference and leverage functionality that is implemented within the SDK. |
5 | X9DrawImage | X9DrawImage is a demo of creating front and back images dynamically using our drawing tools. Images are created using a template which you can define based on your requirements using a tool of your choosing such as GIMP, Paint, or Photoshop. Templates are stored in our template library in a common image format such as PNG. The SDK drawing tools allow you to add various fields to each created image such as name/address, payee, memo, signature, date, check number, MICR line, and so forth. Once created, the images can be converted to standard x9.100-181 exchange format. |
6 | X9ReadCsvWriteX9 | X9ReadCsvWriteX9 will read a csv file with corresponding images for each item stored in an associated image folder. The data and images are then used to create x9 records which are written to an x9 output file. Sdk methods are used which would allow the csv input records to be examined or modified as the x9 file is created and written. |
7 | X9ReadX9ByRecordType | X9ReadX9ByRecordType will read an x9 file and use type objects to map and retrieve the specific fields as defined at the x9 record type level. Note that the field level classes also support modify, so they can be used to modify individual fields and create a modified x9 file. |
8 | X9ReadX9WriteCsv | X9ReadX9ByRecordType will read an x9 file and use type objects to map and retrieve the specific fields as defined at the x9 record type level. Note that the field level classes also support modify, so they can be used to modify individual fields and create a modified x9 file. |
9 | X9ReadX9WriteX9 | X9ReadX9WriteX9 will read an x9 file and create an output x9 file with associated images. This is a good example of reading an x9 file which is then loaded to resident x9objects. All fields within each record are examined using walk. This example could be easily extended to allow individual fields to be modified as needed. The possibly modified x9 file is written from the resident x9objects array. |
10 | X9ReadX9WriteStream | X9ReadX9WriteStream will read an x9 file and write to an output stream which can then be used as input within your application or can be used as input to X9StreamReader. |
11 | X9MakeX9 | X9MakeX9 is an example of the make process which reads a use case file (which must be in CSV format) and creates an output x9 file. An xml reformatter is loaded which defines the make parameters. This xml file can be created, tested, and maintained using X9Assist. |
12 | X9GenerateX9 | X9GenerateX9 is an example of the generate process which reads a CSV file that contains generate specific columns and creates an output x9 file. The column requirements may vary from release to release and are logged as information. An xml generator is loaded which defines the generate parameters. This xml file can be created, tested, and maintained using X9Assist. |
13 | X9ScrubX9 | X9ScrubX9 is an example of the scrub process which reads an x9 file and creates a scrubbed x9 output file. An xml scrub configuration is loaded which defines the scrub parameters to be applied. This xml file can be created, tested, and maintained using X9Assist. |
14 | X9PrintX9 | X9PrintX9 is an example of the image print process which reads an x9 file and creates an image print stream which is routed to a selected printer. The example includes either interactive print (where a GUI dialog is invoked to select the printer) or silent print (where output is written to a specific printer). An xml print configuration is loaded which defines the print parameters. This xml file can be created, tested, and maintained using X9Assist. |
15 | X9VerifyX9 | X9VerifyX9 is an example of running x9 file validations, using the same tools as applied by our X9Assist desktop tool. All resulting errors will be retrieved and written to the log. |
16 | X9PaidEndorsement | X9PaidEndorsement is an example of adding a paid endorsement stamp to a back side image by using X9DrawTools. The paid endorsement stamp is a series of text lines that are drawn on the image rotated 90 and centered within the image. Placement is based on a right side margin that is specified in inches. The paid endorsement stamp can be a variable number of lines with each having a define font, style, and size. |