Deploy the client library for WebSphere Commerce services

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

Note: WebSphere Commerce has some dependencies on the Eclipse Modeling Framework (EMF). If we are deploying the client library on a WebSphere Application Server machine that does not contain WebSphere Commerce, we must include the following additions to the classpath:


Before beginning


Procedure

To deploy the client library:

  1. Start WebSphere Commerce Developer..

  2. Package the client library:

    • If we are packaging our own client application, we 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 called config\component-id, where component-id is the identifier for our 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. We 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:

    Option Description
    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.

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

      This option 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 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 createdd 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.

    Local EJB binding

    When the WebSphere 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 createdd 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 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 createdd 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 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 createdd 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.


Related concepts
Client library for WebSphere Commerce services


Related tasks
Creating the client library
Extending the client library
Deploying the component facade


Related reference
Client library exceptions