Using the JAX Web Service Admin APIs

Just as with the Storefront JAXWS APIs it's simple to use KonaKart's JAXWS Admin interfaces because the JAXWS "engine client" implements the same KKAdminIf 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.konakartadmin.jws.KKJAXWSAdmin and use the interfaces defined on KKAdminIf just as if you were using the POJO version and calling the methods on KKAdmin directly.

The JAXWS APIs (for both Storefront and Admin) 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 konakartadmin_jaxws_client.properties is used to define the location of the JAXWS Admin web service. Therefore if the location is not the default URL (http://localhost:8796/konakartadmin/KKJAXWSKKAdmin) you will need to modify this file as appropriate.

Enable the JAX Web Admin Services

By default the JAXWS Admin 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 enable_KKAdmin_JAXWS in the KonaKart/custom directory as shown below. (An equivalent ANT task called enable_JAXWS is provided to enable the Storefront JAXWS services).


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

enable_KKAdmin_JAXWS:

enable_KKAdmin_JAXWS_warning:

enable_KKAdmin_JAXWS_enterprise:
     [echo] Fix konakartadmin web.xml to start-up JAXWS Server
     [echo] Fix konakartadmin web.xml to start-up JAXWS Admin Controller

BUILD SUCCESSFUL
Total time: 1 seconds

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

There are a number of sections in the konakartadmin webapp's web.xml file to modify to enable the JAXWS Admin services. 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>KKJAXWSKKAdmin</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 Admin Controller servlet:


<!-- Servlet for JAXWS Admin Controller 

Uncomment the section below if you want to use the JAXWS Admin 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 Admin Controller if you need to and if you do, change the 
password.

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

<!-- JAXWS Admin Controller --> 
<servlet>
	<servlet-name>KonaKartAdmin_JAXWS_Admin_Controller</servlet-name>
	<servlet-class>
		com.konakartadmin.jws.KKJAXWSAdminController
	</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 Admin 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 KKAdminIf interfaces that are to be allowed or disallowed. For a list of KKAdminIf interfaces available in your version of KonaKart you will find a list in the comments in the server-config.wsdd file in your konakartadmin/WEB-INF/ directory after a standard installation (provided from version 6.3.0.0). See the web.xml for the konakartadmin webapp for more details.

Finally the JAXWS servlet mappings must be uncommented:


<!--
	 Uncomment the section below if you want to use the KKAdmin JAXWS Admin Controller
-->
<!-- JAXWS Admin Controller --> 
<servlet-mapping>
	<servlet-name>KonaKartAdmin_JAXWS_Admin_Controller</servlet-name>
	<url-pattern>/konakartadminjaxwsadmin</url-pattern>
</servlet-mapping>
<!-- End of JAXWS Admin Controller -->