Deploying the client library

The client library for an HCL Commerce service can be deployed in one of four possible environments:

  • A generated web service client proxy binding.
  • A local EJB binding.
  • A web service binding in a J2SE application.
  • A service binding using the HCL Commerce JCA Messaging subsystem.
Note: HCL Commerce has some dependencies on the Eclipse Modeling Framework (EMF). If you are deploying the client library on a WebSphere Application Server machine that does not contain HCL Commerce, you must include the following additions to the classpath:
  • WebSphere Application Server Version 7 runtime
  • com.ibm.ws.webservices.thinclient_7.0.0.jar

Before you begin

Procedure

To deploy the client library:

  1. Start HCL Commerce Developer..
  2. Package the client library:
    • If you are packaging your own client application, you must include the following JAR files in the class path of your client application:
      • MyServiceModule-Client.jar, where MyServiceModule is the name of your service module
      • MyServiceModule-DataObjects.jar
      • workspace_dir\WC\Foundation-Core.jar
      • workspace_dir\WC\Foundation-DataObjects.jar
      • workspace_dir\WC\Performance-Profiler.jar
  3. Copy workspace_dir\WC\xml\config\com.ibm.commerce.foundation\wc-config-mapping-registry.xml and SDO.properties to any \config directory in the client application class path. (The file must be in a directory called config).
    Note: The wc-config-mapping-registry.xml file is part of the client library configuration, and registers component configurations in the Foundation configuration mapping registry.

    See the wc-config-mapping-registry.xml file for a sample configuration.

  4. In the class path of the client application, create an empty folder that is called config\component-id, where component-id is the identifier for your component.
    For example, com.myco.commerce.myservicemodule.
  5. Copy an existing wc-component-client.xml file into your newcomponent-id folder. The existing wc-component-client.xml are in the workspace_dir\WC\xml\config\com.ibm.commerce.component-id directory, where component-id is the name of the component, such as catalog or content. You must edit the copied file for use with your component service.
  6. Select one of the following binding methods, which are based on the authentication mechanism you chose:
    OptionDescription
    Generated web service client proxy binding:
    1. Open Window > Preferences > Web Services > WebSphere > JAX-RPC Code Generation > WSDL2Java. Select the Disable data binding and use SOAPElement option.
    2. Open the Java EE module that uses the client library in the Deployment Descriptor editor.
    3. Click the References tab and add a service reference. Then, select the Next button.

      Adding a service reference

    4. Select the service reference and select the Finish button.

      Selecting the service reference, Finish

      This option generates the client proxy code to communicate with the HCL Commerce service. This client proxy has methods for each service. Each method takes a SOAPElement as input and returns a SOAPElement. This option also generates the deployment configuration and JAX RPC mapping to create the client proxy.
    5. Click the WS Handler tab and create a new handler for the newly created service reference. The handler class should be com.ibm.commerce.foundation.internal.client.services.invocation.impl.JAXRPCWebServiceProxyHandlerImpl. The purpose of this handler is to include authorization information within the SOAP request for guest and register user support.
    6. Open the file that you created in step 4 and use the generated proxy class by changing the invocation binding implementation to com.ibm.commerce.foundation.internal.client.services.invocation.impl.JAXRPCWebServiceProxyInvocationBindingImpl. Add a proxy to this binding element named proxyClass with the value of the generated proxy class. For example:
      <_config:invocationservice>
      <_config:invocationbinding bindingImpl="com.ibm.commerce.foundation.internal.client.services.invocation.imp
      l.JAXRPCWebServiceProxyInvocationBindingImpl">
      <_config:property name="proxyClass" value="com.ibm.www.CatalogServicesPortTypeProxy"/>
      </_config:invocationbinding>
      </_config:invocationservice>
    7. Use the administrative console to manage the URL binding and security setting to associate it with the web service configuration.

      Managing the URL binding and security setting to associate it with the web service configuration

    Local EJB binding

    When the HCL Commerce service and the client of that service are in the same application. For performance reasons, the client should not have to make a web service request to that service. Instead, the client and component communication should be local to the application to avoid unnecessary service requests.

    1. Open the wc-component-client.xml file that you created in step 4 and change the invocation binding to use: com.ibm.commerce.foundation.internal.client.services.invocation.impl.LocalEJBInvocationBindingImpl
    2. Add a jndiName property of the binding to point to the global name of the local EJB component. For example:
      
      <_config:InvocationBinding
      bindingImpl="com.ibm.commerce.foundation.internal.client.services.invocation.impl.LocalEJBInvocationBindingImpl">
      <_config:Property name="jndiName"
      value="ejb/com/ibm/commerce/catalog/facade/server/CatalogLocalFacadeHome"/>
      </_config:InvocationBinding>
      
    3. Save the file.
    4. Deploy the changed configuration.
    5. Restart the server.
    Web services binding in a J2SE application

    When the client of the HCL Commerce service is deployed in a J2SE environment, there is no naming service to resolve the reference to the web service. Instead, the URL binding of the web service is defined in the binding configuration of the client.

    1. Open the wc-component-client.xml file that you created in step 4 and change the invocation binding to use: com.ibm.commerce.foundation.internal.client.services.invocation.impl.J2SEWebServiceInvocationBindingImpl
    2. Add a URL property to the binding to specify the URL where the web service can be found. For example:
      
      <_config:InvocationBinding
      bindingImpl="com.ibm.commerce.foundation.internal.client.services.invocation.impl.J2SEWebServiceInvocationBindingImpl">
      <_config:Property name="url"
      value="http://localhost:81/webapp/wcs/component/catalog/services/CatalogServices"/>
      </_config:InvocationBinding>
      
    3. Save the file.
    4. Deploy the changed configuration.
    5. Restart the server.
    Service binding using the HCL Commerce JCA Messaging subsystem

    When the client of the service is deployed in the HCL Commerce application, the JCA infrastructure of the messaging sub system can be used to issue the service request. With this configuration, the existing messaging admin UI can be used to determine the transport and target of the system to receive the message.

    1. Open the wc-component-client.xml file that you created in step 4 and change the invocation binding to use: com.ibm.commerce.foundation.internal.client.services.invocation.impl.JCAInvocationBindingImpl
    2. Save the file.
    3. Deploy the changed configuration.
    4. Create a message type for the component ID used to create an instance of the invocation service object, for example com.myco.commerce.myservicemodule. To do so, add a row into the MSGTYPES table to assign a new msgtype_id. Use a message type ID number above 1000. For example:
      
      insert into MSGTYPES (MSGTYPE_ID, MSGTDIR, NAME, VIEWNAME,
      DESCRIPTION) 
      VALUES (1001, 1, '
      com.myco.commerce.myservicemodule' , '', 'My Service
      Component' );
      
    5. Assign a message type to a transport method for the site or store.
    6. Restart the server.