Using the JAX Web Service Storefront APIs

It's simple to use KonaKart's JAXWS Storefront interfaces because the JAXWS "engine client" implements the same KKEngIf interface as all the other engine clients. Therefore, all you have to do to use the JAXWS version of the APIs is to instantiate com.konakart.jws.KKJAXWSEng and use the interfaces defined on KKEngIf just as if you were using the POJO version and calling the methods on KKEng directly.

The JAXWS APIs are only available in the Business and Enterprise Editions of KonaKart.

Although it is easier to use the JAXWS client engine that is already available in the KonaKart jars, if your IDE can create client stubs from WSDL then you can use that to create your JAXWS client. Wherever possible, we recommend you use the JAXWS client stubs in the KonaKart jars provided rather than generate new ones from the WSDL.

If you really need to use the WSDL approach to generate your client artefacts the WSDL can be found here:

The file konakart_jaxws_client.properties is used to define the location of the JAXWS web service. Therefore if the location is not the default URL (http://localhost:8780/konakart/KKJAXWSKKEng) you will need to modify this file as appropriate.

Enable the JAX Web Storefront Services

By default the JAXWS Storefront APIs are disabled after the installation process. The purpose of this is to make the KonaKart engines more secure by default and let the customer open up interfaces (in this case the JAXWS interface) when the implications are fully understood. The process for enabling the JAXWS APIs is very simple and can be achieved by running an ant target called enableJAXWS in the KonaKart/custom directory as shown below. (An equivalent ANT task called enable_JSON is provided to enable JSON).


C:\KonaKart\custom>bin\kkant enable_JAXWS
Buildfile: C:\KonaKart\custom\build.xml

enable_JAXWS:

enable_JAXWS_warning:

enable_JAXWS_enterprise:
     [echo] Fix konakart web.xml to start-up JAXWS

BUILD SUCCESSFUL
Total time: 0 seconds

The ant target modifies the web.xml present in the WEB-INF directory of the KonaKart storefront application.

There are a number of sections in the konakart webapp's web.xml file to modify to enable the JAXWS server. The first is the JAXWS Listener:


<!-- JAX Web Services --> 
<listener>
    <listener-class>
        com.sun.xml.ws.transport.http.servlet.WSServletContextListener
    </listener-class>
</listener>
<!-- End of JAX Web Services -->

Next, you need to enable the KonaKart JAXWS servlet:


<!-- JAX Web Services --> 
<servlet>
    <servlet-name>KKJAXWSKKEng</servlet-name>
    <servlet-class>
        com.sun.xml.ws.transport.http.servlet.WSServlet
    </servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<!-- End of JAX Web Services -->

For configuring the JAXWS service dynamically you need to enable the JAXWS Storefront Controller servlet:


<!-- Servlet for JAXWS Storefront Controller 

Uncomment the section below if you want to use the JAXWS Storefront Controller Servlet

When sending these commands the password must match the one defined in the 
"password" servlet parameter below.  Remember to change this password!

Only enable the JAXWS Storefront Controller if you need to and if you do, change the 
password.

JAXWS Storefront Controller commands:
    ?cmd=enableJAXWS&pwd=password
        Enables the JAXWS Storefront server
    ?cmd=disableJAXWS&pwd=password
        Disables the JAXWS Storefront server
    ?cmd=excludeInterfaces&pwd=password&Interfaces=Comma separated list of KKEngIf interfaces
        Sets the excludedInterfaces
    ?cmd=includeInterfaces&pwd=password&Interfaces=Comma separated list of KKEngIf interfaces
        Sets the includedInterfaces
    
JAXWS Storefront Controller parameters:
    jaxwsEnabled        = Enable (true) or Disable (false) the JAXWS Storefront Server
    excludedInterfaces  = Comma separated list of KKEngIf interfaces that
                          are not allowed.  If not specified or left empty, 
                          no interfaces are excluded.
    includedInterfaces  = Comma separated list of KKEngIf interfaces that
                          are allowed. If not specified or left empty, all
                          interfaces are allowed.
-->

<!-- JAXWS Storefront Controller --> 
<servlet>
    <servlet-name>KonaKart_JAXWS_Storefront_Controller</servlet-name>
    <servlet-class>
        com.konakart.jws.KKJAXWSStorefrontController
    </servlet-class>
    <init-param>
        <param-name>password</param-name>
        <param-value>jack</param-value>
    </init-param>
    <init-param>
        <param-name>jaxwsEnabled</param-name>
        <param-value>true</param-value>
    </init-param>
    <init-param>
        <param-name>includedInterfaces</param-name>
        <param-value></param-value>
    </init-param>
    <init-param>
        <param-name>excludedInterfaces</param-name>
        <param-value></param-value>
    </init-param>
    <load-on-startup>29</load-on-startup>
</servlet>
<!-- End of JAXWS Storefront Controller -->

Note the password parameter on the Controller servlet. You should change this as soon as possible to ensure your controller is secure.

Note the availability of the two JAXWS servlet parameters: "excludedInterfaces" and "includedInterfaces". These can be used to fine tune the JAXWS services that you make available from your system. It is recommended that you only make available those interfaces that are required by authorised client applications. In both cases (excludedInterfaces and includedInterfaces) you simply specify a comma separated list of KKEngIf interfaces that are to be allowed or disallowed. For a list of KKEngIf interfaces available in your version of KonaKart you will find a list in the comments in the server-config.wsdd file in your konakart/WEB-INF/ directory after a standard installation (provided from version 6.3.0.0). See the web.xml for the konakart webapp for more details.

Finally the JAXWS servlet mappings must be uncommented:


<!-- JAX Web Services --> 
<servlet-mapping>
    <servlet-name>KKJAXWSKKEng</servlet-name>
    <url-pattern>/KKJAXWSKKEng</url-pattern>
</servlet-mapping>
<!-- End of JAX Web Services -->

<!--
    Uncomment the section below if you want to use the JAXWS Storefront Service 
-->
<!-- JAXWS Storefront Controller --> 
<servlet-mapping>
    <servlet-name>KonaKart_JAXWS_Storefront_Controller</servlet-name>
    <url-pattern>/konakartjaxwscontroller</url-pattern>
</servlet-mapping>
<!-- End of JAXWS Storefront Controller -->