Chapter 24. Programming Guide

Table of Contents

Using the Java APIs
Using the SOAP Web Service APIs
Using the JAX Web Service Storefront APIs
Enable the JAX Web Storefront Services
Using the JAX Web Service Admin APIs
Enable the JAX Web Admin Services
Step-by-step guide to using the JAXWS SOAP APIs:
Using the RMI APIs
Using the JSON APIs
Using the JSON APIs to build a JavaScript client
HTML character escaping
Running Your Own SQL
Database Layer Changes from v7.2.0.0
Table and Column Name Changes
KonaKart/Torque Programming Changes
Customizable Source Code
Source Code Location
Building the Customizable Source
Developing the storefront in Eclipse
Developing the Product Creation Wizard in Eclipse
Customization of the KonaKart Engines
KonaKart Customization Framework
Adding a New API call
Modifying an Existing API call
Enabling Engine Customizations
Building with Maven
Pluggable Managers

A guide to programming and customizing KonaKart.

One of the most powerful aspects of KonaKart is the flexibility in the number of different ways it can be customized. This chapter contains descriptions of some of these techniques.

Using the Java APIs

One of the most important features of KonaKart is the availability of a set of open APIs that allow you to control KonaKart as you require as part of your IT solution. You may wish to add a different front-end for your KonaKart shopping cart application or you may wish to integrate KonaKart with other applications in your back office.

When you use the java APIs for whatever purpose you can be confident that they will work with future releases of KonaKart as backwards compatibility will always be maintained (although some API calls may be deprecated, they will not be removed).

A number of simple java sources are provided in every KonaKart download kit (you can find them under the installation directory in a directory called java_api_examples) that demonstrate how you call the direct POJO form of the KonaKart APIs:

To give you a flavor of the examples in the downloadable sources, here is an extract from one of them that demonstrates how you can register a new customer using the KonaKart Admin APIs. (See the example sources for a complete set of java files).


// Instantiate an AdminCustomerRegistration object and set its 
// attributes 

AdminCustomerRegistration acr = new AdminCustomerRegistration();

// Compulsory attributes 

// Gender should be set to "m" or "f" (or "x" if "Other Genders" are enabled)

acr.setGender("m"); 
acr.setFirstName("Peter");
acr.setLastName("Smith");

// If you do not require the birthdate, just set it to the current 
// date. It is compulsory and so needs to be set. 
				
acr.setBirthDate(new Date());
acr.setEmailAddr("peter.smith@konakart.com"); 
acr.setStreetAddress("23 Halden	Close"); 
acr.setCity("Newcastle"); 
acr.setPostcode("ST5 ORT");
acr.setTelephoneNumber("01782 639706"); 
acr.setPassword("secret");

// Optional attributes 

acr.setCompany("DS Data Systems Ltd.");

// Country Id needs to be set with the id of a valid country from
// the Countries table 

acr.setCountryId(222); 
acr.setFaxNumber("01782 639707");

// Newsletter should be set to "0" (don't receive) or "1" (receive)
acr.setNewsletter("1");

acr.setSuburb("May Bank"); 
acr.setState("Staffordshire");

// Optional Custom fields for customer object  

acr.setCustomerCustom1("Number Plate"); 
acr.setCustomerCustom2("Driver's license");
acr.setCustomerCustom3("Passport"); 
acr.setCustomerCustom4("custom 4");
acr.setCustomerCustom5("custom 5");

// Optional Custom fields for address object  

acr.setAddressCustom1("custom 1");
acr.setAddressCustom2("custom 2"); 
acr.setAddressCustom3("custom 3");
acr.setAddressCustom4("custom 4"); 
acr.setAddressCustom5("custom 5");

// Register the customer and get the customer Id 

int custId = eng.registerCustomer(sessionId, acr);

System.out.println("Id of the new customer = " + custId);