Tutorials > Portal > Portal > Call the TutorialStore service in a portlet

< Previous | Next >


Add the TutorialStore client library to the MVCPortlet project

In this step of the tutorial, you add the TutorialStore service client library, which adds Web-friendly Java methods to the project so it can act as a client to the TutorialStore service. A JAX-RPC Web service client is then generated from the TutorialStore service to handle sending and receiving requests to the WebSphere Commerce server.


Procedure

  1. Launch WebSphere Commerce Developer. When prompted for the workspace, enter the location of the Rational Application Developer workspace used when configuring WebSphere Portal with WebSphere Commerce using LTPA.

  2. Import the TutorialStore-Client and TutorialStore-DataObjects JAR files into the MVCPortlet project.

    1. Right-click the MVCPortlet\WebContent\WEB-INF\lib folder in the Enterprise Explorer view.

    2. Select Import... > General > File System.

    3. Click Next.

    4. Click Browse and navigate to the temporary location where you unzipped the tutorial sample code.

    5. Select the TutorialStore-Client.jar and TutorialStore-DataObjects.jar files.

    6. Click Finish.

  3. Configure the TutorialStore component client for the MVCPortlet.

    1. Expand the MVCPortlet project to MVCPortlet\Java Resources: src\config.

    2. Right-click the config folder and select New > Other.

    3. Select General > Folder.

    4. Click Next.

    5. Name the folder com.mycompany.commerce.tutorialstore.

    6. Click Finish.

    7. Right-click the newly created folder com.mycompany.commerce.tutorialstore.

    8. Select Import > General > File System.

    9. Click Next.

    10. Click Browse and navigate to the temporary folder where you unzipped the tutorial sample code folder.

    11. Select the wc-component-client.xml and SDO.properties files.

    12. Click Finish.

  4. Import the TutorialStore service module WSDL into the MVCPortlet project.

    1. Right-click MVCPortlet\WebContent\WEB-INF\wsdl.

    2. Select Import > General > File System.

    3. Click Next.

    4. Click Browse and navigate to the temporary location where you unzipped the tutorial sample code.

    5. Select TutorialStoreServices.wsdl.

    6. Click Finish.

  5. Generate the JAX-RPC TutorialStore Web service client from the WSDL file you just imported.

    1. Select Window > Preferences.

    2. Select Web Services.

    3. Select Scenario Defaults from the left column.

    4. Select Java Proxy as the Client Type.

    5. Scroll up until you see Deploy Client.

    6. Select Server Runtime from the left column.

    7. Select WebSphere Application Server v7 as the Server.

    8. Select IBM WebSphere JAX-RPC as the Web service runtime.

    9. Select WebSphere.

    10. Select JAX-RPC Code Generation.

    11. Select WSDL2Java.

    12. Select Disable data binding and use soap element.

    13. Click OK.

    14. Right-click MVCPortlet\WebContent\WEB-INF\WSDL\TutorialStoreServices.wsdl

    15. Select Web Services.

    16. Select Generate Client and click Finish.

    17. Accept any warnings related to Automatic File Overwriting.

  6. Add the JAX-RPC Web service handler to the MVCPortlet application.

    1. Open MVCPortlet\WebContent\WEB-INF\web.xml.

    2. Select the WS Handler tab.

    3. In the Service references drop-down list, select service/TutorialStoreServices.

    4. Click Add.

    5. Enter the following information:

      • Display name: TutorialStore handler

      • Handler name: TutorialStore handler

      • Handler class: com.ibm.commerce.foundation.internal.client.services.invocation.impl.JAXRPCWebServiceProxyHandlerImpl

In this step of the tutorial, you have added and configured the TutorialStore client library to the WebSphere Commerce Portal project. The TutorialStore client library contains methods that simplify the construction of requests and handling of responses to the TutorialStore service running as part of a WebSphere Commerce Server.

< Previous | Next >


+

Search Tips   |   Advanced Search