Tuesday, February 28, 2006

Interfacing the Camtech Server (part 2)

Interfacing the Camtech Server(part 2)
Next step is to use the camtech server from your application. We have now tested the existing Example code and know that it connects to the gateway using the generated private key and the imported certificate. Three steps to use this code from your application.

1. Copy the Example.java (see part 1) to your application.
2. Copy the needed jars (activation.jar, iaik_jce.jar, mail.jar, MerchantServer.jar) from .\MerchantServer\jars to your application. Set classpath if necessary and compile.
3. Copy the jars mentioned in step 2 to the J2EE container. In tomcat that is to the %CATALINA_HOME%\common\lib folder.
4. Set the system property "install.root" in the container. This can be done using command prompt:
SET JAVA_OPTS=-Dinstall.root=E:\Tools\MerchantServer
before running the startup script. More info found here and also check out A tomcat Service Manager for Windows

The tomcat service manager makes it easy to manage tomcat. I recommend to install this to avoid setting up temporarily properties and to get a good overview of the tomcat management.




5. Deploy your .war file to tomcat and test to run the Example code. Check the standard output, should have something like:

----------------------------------------------
The results of the transaction are as follows:
Summary Code: 0
Response Code: 00
Response Text: Approved
RRN: r9bTp96
Authorisation ID Response: DZ0
XID: 2187481
Settlement Date: 0301

--------------------------------------

Problems
If you get this exeption:
Exception: The merchant's private key could not be found"

Common reasons: the merchant id and password combination not being correct. If you are not sure of these values, then please delete and recreate this account, and request another certificate. This response is also generated if the keys or certificate have been corrupted. This scenario will also require you to delete and recreate this account, and request another certificate.

Please note that you will also receive this response if the -Dinstall.root property has not been set correctly when running your code. Please make sure that this property has been included within your Tomcat start up script. i.e. (step 4)

No comments: