Customizing the Sterling DOM integration mediation module to map the custom order user data to the createOrder API request

Introduced in Feature Pack 3 The WebSphere Enterprise Service Bus (WESB) mediation module translates the BOD OAGIS messages that WebSphere Commerce uses into API calls expected by SSFS. In this lesson, you learn how to update the mapping XSL file to map the user data of the WebSphere Commerce BOD to order line instructions of SSFS API calls.

Procedure

  1. Import the Mediation Module into WID:
    1. Select File > Import.
    2. Select General > Existing projects into Workspace.
    3. Select the Mediation Module project archive file. The project can be either a JAR or folder. The mediation module project can be found in WCDE_installdir/components/sterling-integration/wid with the name WCToSSFSMediationModule.
      Note: The Mediation Module has some dependencies from WebSphere Commerce.
      1. Create a new Java project and import the following JAR files into the root of the project:
        • Foundation-Core.jar
        • Foundation-Server.jar
      2. In the Dependencies section of the mediation module project, set the project as a dependant Java project.
  2. Map WebSphere Commerce values to Sterling Commerce values:
    1. Open the following value mapping file:
      • WCToSSFSMediationModule.ear/WCToSSFSMediationModule.jar/ValueMaps.xml
    2. Update the mapping values to match your implementation. For example, if your WebSphere Commerce store ID and name is 10001 and Madisons, and your Sterling Commerce organization code is MadisonsRoot, the file should resemble the following snippet:
      
      <mm:ValueMaps
      	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xmlns:mm="http://WCToSSFSMediationModule"
      	xsi:schemaLocation="http://WCToSSFSMediationModule ValueMaps.xsd ">
      	
      	<!-- Maps WC store IDs to SSFS organization codes -->
      	<mm:Map name="storeIdToOrganizationCode">
      		<mm:Entry key="10001">MadisonsRoot</mm:Entry>
      	</mm:Map>
      	
      	<!-- Maps WC store IDs to SSFS nodes -->
      	<mm:Map name="storeIdToNode">
      		<mm:Entry key="10001">Madisons</mm:Entry>
      	</mm:Map>
      	
      </mm:ValueMaps>
      
  3. Make any necessary changes to the Mediation Module:
    1. Once the mediation module has been imported into your WID workspace:
      1. Modify the following file: WCToSSFSMediationModule\xslt\custom\ProcessOrderToCreateOrderInput.xsl
      2. Locate the <OrderLine> tag and add the following snippet inside it after the </xsl:choose> tag:
        
        <xsl:if test="_wcf:UserData/_wcf:UserDataField[@name='engravingText']!='' or _wcf:UserData/_wcf:UserDataField[@name='engravingSize']!='' or _wcf:UserData/_wcf:UserDataField[@name='engravingFont']!=''">
        	<Instructions>
        		<xsl:if test="_wcf:UserData/_wcf:UserDataField[@name='engravingText']!=''">
        			<Instruction>
        				<xsl:attribute name="InstructionType">engravText</xsl:attribute>
        				<xsl:attribute name="InstructionText">
        						<xsl:value-of select="_wcf:UserData/_wcf:UserDataField[@name='engravingText']"/> 
        				</xsl:attribute>
        			</Instruction>
        		</xsl:if>
        		<xsl:if test="_wcf:UserData/_wcf:UserDataField[@name='engravingSize']!=''">
        			<Instruction>
        				<xsl:attribute name="InstructionType">engravSize</xsl:attribute>
        				<xsl:attribute name="InstructionText">
        						<xsl:value-of select="_wcf:UserData/_wcf:UserDataField[@name='engravingSize']"/> 
        				</xsl:attribute>
        			</Instruction>
        		</xsl:if>
        		<xsl:if test="_wcf:UserData/_wcf:UserDataField[@name='engravingFont']!=''">
        			<Instruction>
        				<xsl:attribute name="InstructionType">engravFont</xsl:attribute>
        				<xsl:attribute name="InstructionText">
        						<xsl:value-of select="_wcf:UserData/_wcf:UserDataField[@name='engravingFont']"/> 
        				</xsl:attribute>																		
        			</Instruction>
        		</xsl:if>
        	</Instructions>
        </xsl:if>
        
      3. Save your changes and close the file.
    2. After you have changed the file, modify the Mediation Module:
      1. Set the WebSphere Commerce Order Services Endpoint URL.

        For the WESB mediation module to communicate correctly with WebSphere Commerce, it must be configured with the proper hostname and port.

        1. Open up the assembly diagram in the WCToSSFSMediationModule.
        2. Open Module components > imports.
        3. Click on the WCOrderServicesImport.
        4. Choose the Binding tab in the properties view.
        5. Enter the correct Address.
      2. Set the WebSphere Commerce Order Services Endpoint URL.

        For the WESB mediation module to communicate correctly with WebSphere Commerce, it must be configured with the proper hostname and port.

        1. Open up the assembly diagram in the WCToSSFSMediationModule.
        2. Open the Properties View.
        3. Click on the WCInventoryServicesImport.
        4. Choose the Binding tab in the properties view.
        5. Enter the correct Address.
      3. Set the WebSphere Commerce Order Services Security Information.
        WebSphere Commerce uses the standard WS-Security to provide security for its web services. The WESB mediation module must be configured to utilize this security correctly.
        1. Launch the WESB integrated solutions console and logon.
        2. Navigate to Services > Policy set > Application policy sets > and select Import > From selected location.
        3. Select the following file: Click OK.
        4. Navigate to Services > Service clients and select OrderServices.
        5. Select OrderServices and select Attach Client Policy Set > WCServicesPolicySet. You can achieve this by selecting the top entry, causing the setting to cascade.
        6. Select OrderServices and select Assign Binding > New Application Specific Binding.
        7. Enter WCServicesBinding as the name of the binding configuration and select Add > WS-Security.
        8. Navigate to Authentication and protection and select request:token_auth.
        9. Click Apply.
        10. Navigate to Callback handler.
        11. Enter the WebSphere Commerce administrator username and password for the Administration Console and click OK.
        12. Save the WESB configuration changes.
      4. Setup the CSV_DIR environment variable:
        1. Launch the WESB integrated solutions console and logon.
        2. Navigate to Environment > WebSphere variables
        3. Select New, set the Name as CSV_DIR and value as a directory to point to.
        4. Click OK.
        5. Save the WESB configuration changes.
      5. Adjust the SSFS Organization Code in the Mediation Flows.

        Most calls to the SSFS APIs require an Organization Code. As this code is global in nature, specify it in the WESB mediation module. To change this code to fit your environment:

        1. Open the WCToSSFSMediationModule component in WID.
        2. For each of the services listed below, adjust the value set in the OrganizationCodeSetter element:
          • ProcessOrder
          • GetInventoryAvailability
          • ProcessInventoryRequirement
      6. Enable/Disable Mediation Flow Tracing

        Trace primitives are used all over the mediation flows to log messages in the server's SystemOut.log. For example, the incoming GetInventoryAvailability BOD and the resulting findInventory input message. In WID, you can enable and disable these traces by opening the mediation flows. The enablement of these traces are also set as promoted properties with aliases in the form of *Trace.enabled. For example, GetInventoryAvailabilityTrace.enabled and FindInventoryInputTrace.enabled. They can be enabled and disabled in WESB using the Administration Console. For more information, see Promoted properties.

  4. Deploy the Mediation Module to WESB:

    Once changes have been made and tested using WID and the WESB test environment, you can export the mediation module as a deployable resource. You can then deploy the ear into a standalone WESB install.

    To export a deployable resource from WID:

    1. Right click on the WCToSSFSMediationModule project and click Export.
    2. Select Integration Modules and Libraries.
    3. Ensure Files for Server Deployment is selected and click Next.
    4. Select the location of the generated EAR file and click Finish.
    To install the generated EAR into a WESB server:
    1. Log into the WESB administration console.
    2. Navigate to Applications > SCA Modules.
    3. Click Install.
    4. Click Browse and select the mediation module EAR.
    5. Select the server or cluster to install the module into and click Next.
    6. When the install completes, click Save.
  5. Configure JMS for WESB:

    As WESB communicates to SSFS via JMS, our environment must be configured to enable this. In our case, we are using the default messaging implementation of our WESB server as our JMS provider. When the WESB mediation module is deployed to the server, most of the necessary configuration is completed automatically for us. After the module is deployed, the only thing we have to do ourselves is create a JMS Queue Connection factory:

    1. Log into the WESB administration console.
    2. Navigate to Resources > JMS > Queue Connection Factories.
    3. Select New.
    4. Select Default Messaging Provider and click Next.
    5. Enter the following required information:
      Name
      WCToSSFSMediationModule.SSFSAPIsImport_QCF
      JNDI Name
      WCToSSFSMediationModule/SSFSAPIsImport_QCF
      Bus Name
      SCA.APPLICATION.CELL_NAME.Bus
      Provider Endpoints
      SERVER_HOSTNAME:7276:BootstrapBasicMessaging, SERVER_HOSTNAME:5557:BootstrapSecureMessaging
    6. Click OK, then click Save.

Results

In this lesson, you updated the mapping XSL file to map the user data of the WebSphere Commerce BOD to order line instructions of SSFS API calls.