The AvaTaxCalc JAVA (for SOAP) Sample is open source designed to assist you with developing your own custom integration to your chosen web store or e-commerce solution. The adapter was built using Apache Axis WSDL2Java to build the stubs which were then enhanced to support a custom Profile SOAP header element and a WS-Security UsernameToken SOAP header element. It uses WSS4J to build the security token.
To run selected samples in the src folder, you will need to modify the avatax4j.properties file with your own account and license key.
Note: The Avalara Admin Account Username and Password can be used in place of avatax4j.account and avatax4j.license properties.See http://developer.avalara.com/api-docs/designing-your-integration for more information.
- All dependent jar files are included in the /lib folder for building and running the included samples.
- You must have JDK 5.0 or later
- avatax4j.wsdd - Axis deployment descriptor (required for WSS4J)
- Sample is compatible with J2SDK 1.4.2 however we are no longer able to provide support for this version.
- You will need to use the cacert file from JDK 5.0. http://www.oracle.com/technetwork/java/javasebusiness/downloads/
- Apache Ant 1.6.x or later http://ant.apache.org/bindownload.cgi
1. If you get a warning message regarding Xalan as follows:
Unable to patch xalan function table.
java.lang.NoSuchFieldException: m_functions
at java.lang.Class.getField(Unknown Source)
at org.apache.xml.security.Init.registerHereFunction(Init.java:429)
at org.apache.xml.security.Init.init(Init.java:124)… (and so on)
You will need to copy the xalan-2.6.0.jar to your JAVA_HOME/lib/endorsed/ directory. You may need to create the endorsed directory.
API |
Method Demonstrated |
avatax4j.properties | Properties file used to configure URL, Account, License Key and the client Profile. It is a best practice recommendation that you save this file outside of the API directory in a read only (-rw-r--r--or 0644 for UNIX / Linux based systems) directory for security reasons. |
IsAuthorizedTest.java | IsAuthorized is a method that allows the user to specify a number of a methods or services to ascertain if they are permitted to use them based on the credentials provided in the request. |
PingTest.java | The Ping method can be used for testing connectivity to the AvaTax web service, verify supplied credentials, and return the service version in use by the AvaTax web service. |
ValidateTest.java | Validate demonstrates the ValidateAddress method that normalizes a provided address. US and Canada only. |
GetTaxRequestTest.java | The GetTaxRequest method calculates retail sales tax on documents such as sales orders, sales invoices, purchase orders, purchase invoices, or credit memos. Note: A document can be committed at this stage by setting the Commit property to true (default is false). |
PostTaxTest.java | The PostTax method can be used to modify the state of a SalesInvoice, ReturnInvoice or PurchaseInvoice document saved to the AvaTax database. Note: A document can be committed at this stage by setting the Commit property to true (default is false). |
CommitTaxTest.java | The CommitTax method can be used to modify the state of a document that is "posted" (only) to the AvaTax database via SalesInvoice, ReturnInvoice or PurchaseInvoice a methods. Note: CommitTax is not a required step to commit a document to AvaTax. Documents can be committed during the GetTax or PostTax document lifecycle. |
GetTaxHistoryTest.java | GetTaxHistory is a method that retrieves details from a previously saved (to the AvaTax database) documents. |
AdjustTaxTest.java | AdjustTax is a method that has the ability to modify elements of an already committed document. Note: Sets the Document Modified flag. |
CancelTaxTest.java | CancelTax is a method that cancels a tax document specified by the DocId, DocCode, and DocType parameters. See CancelTax for more details. |
/lib | Contains the required jar files |
/doc | Contains documentation for the source code located in /src -- Navigate to ..\doc\api\index.html to veiw documentation. |
/src | Contains API Sample Code described above and source code. |
.gitattributes | GitHub attribute file. Not required for sample use. |
.gitignore | GitHub config file. Not required for sample use. |
LICENSE.md | Apache License TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION |
README.md | This document describing how to make use of the sample API code. |
Developer API Documentation is located here: http://developer.avalara.com/api-docs
The Avalara AvaTax API Reference is located here: http://developer.avalara.com/api-docs/avalara-avatax-api-reference
Find out what other developers are talking about on the Avalara Developer Community Forum located here: https://community.avalara.com/avalara/category_sets/developers
Frequently asked questions regarding the Avalara product is located here: https://help.avalara.com/