Deploying the client library

The client library for a WebSphere Commerce service can be deployed in one of three possible environments:

Prerequisite:

To deploy the client library:

  1. Start WebSphere Commerce Developer.

  2. Package the client library:

    • If you are packaging your own client application, 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

  3. Copy WCDE_installdir\xml\config\com.ibm.commerce.foundation\wc-config-mapping-registry.xml to any \config directory in the client application class path. (The file must be in a directory called config).

  4. In the class path of the client application, create an empty file called config\ component-id\ wc-component-client.xml file, where component-id is the identifier for your component, for example: com.myco.commerce.myservicemodule.

  5. Select one of the following binding methods, based on the authentication mechanism you have chosen:

    Option Description
    Generated Web service client proxy binding:

    1. Open Preference > Web Services > Code Generation > IBM WebSphere runtime. Select the Disable data binding and use SOAPElement option.

    2. Open the J2EE module that will use the client library in the Deployment Descriptor editor.

    3. Click the Reference tab and add a service reference. Then select the Next button.

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

      This generates the client proxy code to communicate with the WebSphere Commerce service. This client proxy has methods for each service. Each method takes a SOAPElement as input and returns a SOAPElement. This also generates the deployment configuration and JAX RPC mapping to create the client proxy.

    5. Click the Web service 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 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.invcation.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 console to manage the URL binding and security setting to associate it with the Web service configuration.

    Local EJB binding

    When the WebSphere Commerce service and the client of that service are in the same application, then 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 overhead.

    1. Open the wc-component-client.xml file 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
      <wc:InvocationBinding
      bindingImpl="com.ibm.commerce.foundation.internal.client.services.invocation.impl.LocalEJBInvocationBindingImpl">
      <wc:Property name="jndiName"
      value="ejb/com/ibm/commerce/catalog/facade/server/CatalogLocalFacadeHome"/>
      </wc: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 WebSphere 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 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
      <wc:InvocationBinding
      bindingImpl="com.ibm.commerce.foundation.internal.client.services.invocation.impl.J2SEWebServiceInvocationBindingImpl">
      <wc:Property name="url"
      value="http://localhost:81/webapp/wcs/component/catalog/services/CatalogServices"/>
      </wc:InvocationBinding>
      

    3. Save the file.

    4. Deploy the changed configuration.

    5. Restart the server.

    Service binding using the WebSphere Commerce JCA Messaging subsystem

    When the client of the service is deployed in the WebSphere 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 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 new 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.

Related concepts

WebSphere Commerce services
WebSphere Commerce service module
Client library for WebSphere Commerce services

Related tasks

Create the client library
Extending the client library
Deploying the component facade


Related Reference


Client library exceptions