Creating JAX-RPC Web service clients in HCL Commerce Developer

You can create a JAX-RPC Web service client with HCL Commerce with the following high-level tasks: create a new EJB project and session bean, generate the Web service client proxy code into the project, customize the bean to make the Web service requests, and create a helper class to simplify calling the new session bean.


  1. Start HCL Commerce Developer.
  2. Create the EJB project and client proxy:
    1. Right click WSDL > Web Services > Generate Client.
    2. Click Next and accept the default value.
    3. Under Client-Side Environment Selection, change the Client type to EJB, enter the name of your EJB project and ensure WC is selected as the EAR project.
    4. Click Finish.
  3. Modify the default session bean to call the Web service:
    1. Modify the DefaultSession interface to extend the generated Web service interface. That is, the PortType interface.
    2. Create a new class that implements the generated Web service interface.
      For example:
      public SOAPElement startTransaction(InitialRequest initialRequest) throws RemoteException, ValidationErrorFault {
      		UsPortType service = new UsPortTypeProxy();
      		return service.startTransaction(initialRequest);		
    3. Modify the bean class to extend from the newly created class.
  4. Create a helper class to simplify calling the session bean:
    1. Create a new class in ExtensionsLogic.
    2. Add a helper method that simplifies calling the session bean.
      For example:
      private DefaultSession getClient() {
      	try {
      		Context ctx = new InitialContext();
      		DefaultSessionHome = (DefaultSessionHome) ctx.lookup("ejb/ejbs/DefaultSessionHome");
      		DefaultSession service = home.create();
      		return service;
      	} catch (Exception e) {
      	return null;
    HCL Commerce commands can create the above helper class and call getClient().serviceName(). Security settings can be specified on the deployment descriptor of the EJB project that contains the new session bean.