Tutorials > Web services > Define an inbound Web service

< Previous | Next >


Map the WSDL document to the WebSphere Commerce Web services framework

Enable the WebSphere Commerce Web services framework to handle the WSDL document involves two parts. The first part, described in this section, is to configure the WebSphere runtime environment to map the Web service request to the WebSphere Commerce Web services framework. The second part, described in Step 6, is to configure message mapping to process a Web service request.

Use the Web service tools to create and update existing deployment files to generate the mapping. The Web Service wizard creates the files required to create the mapping. The wizard also updates the Web services deployment descriptors to register the new WSDL document.

Ensure that Disable data binding and use SOAPElement has been selected as described in the setup steps in Configure WebSphere Commerce Developer for Web service development.

To create the files using the Web Service wizard:


Procedure

  1. In the Enterprise Explorer view, select WebServicesRouter > WebContent > wsdl > MyCompany > MyCompany-ProductServices.wsdl.

  2. Right click the WSDL file and select Web Services > Generate Java bean Skeleton.

  3. In the Web Service wizard, ensure that the Web service type is Skeleton Java bean Web Service. This should be the default value.

  4. Clear all the check boxes and click Next.

  5. In the Enter a URI to a WSDL, WSIL or HTML document field, ensure /WebServicesRouter/WebContent/wsdl/MyCompany/MyCompany-ProductServices.wsdl is specified and click Next.

  6. On the next page of the wizard, ensure that Service project is set to WebServicesRouter and EAR project to WC.

  7. Click Finish. You will see a warning about overwriting of files. Select Yes to All to avoid being prompted for each file.

    If the WebSphere Commerce service test environment has not been started during this process, it will now be started.

  8. Optional: At the end of this process, some files are created by the tooling but are not required by the Web service. The following can be removed:

    • The WebContent/wsdl/com directory.

    • The WebContent/WEB-INF/wsdl/MyCompany-ProductServices.wsdl file.

  9. To map the service to the WebSphere Commerce Web services framework:

    1. In the Enterprise Explorer view, navigate to WebServicesRouter > WebContent > WEB-INF and open the MyCompany-ProductServices_mapping.xml file.

    2. Search for the following line within the file:

      <service-endpoint-interface>com.mycompany.www.MyCompanyProductServicesPortType</service-endpoint-interface> 
      

    3. Replace the service-endpoint-interface from com.mycompany.www.MyCompanyProductServicesPortType to com.ibm.commerce.webservices.OpenWebServicePortType. This will always be the service endpoint interface of any service that is handled by the WebSphere Commerce Web Services framework.

    4. Update the MyCompany-ProductServices_mapping.xml file and change the <java-method-name> value from getProductInformation to executeService. This will always be the method name of any service that is handled by the WebSphere Commerce Web Services framework.

      The following shows the changes from step 3 and 4 in bold:

       ... 
      

      <service-endpoint-interface-mapping>        
      <service-endpoint-interface> com.ibm.commerce.webservices.OpenWebServicePortType</service-endpoint-interface>
      <wsdl-port-type xmlns:seimwpt="http://www.mycompany.com/schema">seimwpt:MyCompany-ProductServicesPortType</wsdl-port-type>
      <wsdl-binding
      xmlns:seimwb="http://www.mycompany.com/schema">seimwb:ProductServices</wsdl-binding>        
      <service-endpoint-method-mapping>            
      <java-method-name> executeService</java-method-name>            
      <wsdl-operation>GetProductInformation</wsdl-operation> ... 
      

    5. Search for the following line within the file:

      <java-port-name>ProductServices</java-port-name> 
      

    6. Change the <java-port-name> value from ProductServices to com.ibm.commerce.webservices.OpenWebServicePortType.

    7. Save the changes to MyCompany-ProductServices_mapping.xml and close the editor.

    8. In the Enterprise Explorer view, double-click the WebContent/WEB-INF/webservices.xml file to open it in the Web Services Editor.

    9. In the Web Services panel, do the following:

      1. In the Web service descriptions section, select MyCompany-ProductServices.

      2. In the Web service description implementation details section, change the WSDL file field to point to the MyCompany-ProductServices.wsdl that you have created in wsdl/MyCompany/.

    10. In the Port Components panel, do the following:

      1. In the Web service description drop down list, select MyCompany-ProductServices.

      2. Update the Service endpoint interface with a value of com.ibm.commerce.webservices.OpenWebServicePortType to map the WSDL file to the WebSphere Commerce Web services framework.

      3. In the Port component implementation details section, under Service implementation bean, select OpenWebServiceBinding from the list and select the Servlet link radio button .

    11. Go to the Handlers tab.

    12. Select the Web service description and Port Component you just updated.

    13. Select the Add button to add a new handler. A window will open in which you can specify the class name of the handler.

    14. Find the class com.ibm.commerce.webservices.OpenWebServiceHandlerImpl and click OK.

    15. Under SOAP headers of the selected handler add the two following Namespace URIs. For each, set the Local part to "Security"

      • http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd

      • http://docs.oasis-open.org/wss/2004/01/oasis-200401-wsswssecurity-secext-1.0.xsd

    16. Under SOAP roles, click Add. This will create a role with the default value of "SOAP role". Change the value to " " (one space). Note: If the value is empty, the tooling will remove the SOAP role. Setting to a value of an empty space is the same as allowing a services that does not specify a SOAP actor to use this handler.

    17. Save the file and close the Web Services Editor.

    There is an unneeded servlet created in the web.xml for the WebServicesRouter web module.

    1. Open the web.xml file.

    2. In the Servlets and JSPs panel, select the com_mycompany_www_ProductServicesImpl servlet.

    3. Click the Remove button to remove the servlet.

    At the end of this process, the WSDL file should be mapped to the WebSphere Commerce Web services framework for request handling. The following new and changed files need to be updated when deploying the Web services to an existing or new WebSphere Commerce instance.

    • WEB-INF/ibm-webservices-bnd.xmi (updated)

    • WEB-INF/ibm-webservices-ext.xmi (updated)

    • WEB-INF/MyCompany-ProductServices_mapping.xml (new)

    • WEB-INF/webservices.xml (updated)

    • wsdl/MyCompany/MyCompany-ProductServices.wsdl (new)

    • xsd/MyCompany/ProductInformationService.xsd (new)

< Previous | Next >


+

Search Tips   |   Advanced Search