Customizing the Sterling DOM integration mediation module to map the custom order user data to the createOrder API request
Procedure
-
Import the Mediation Module into WID:
- Select File > Import.
- Select General > Existing projects into Workspace.
-
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.
- Create a new Java project and import the following JAR files
into the root of the project:
- Foundation-Core.jar
- Foundation-Server.jar
- In the Dependencies section of the mediation module project, set the project as a dependant Java project.
- Create a new Java project and import the following JAR files
into the root of the project:
-
Map WebSphere Commerce values to Sterling Commerce values:
-
Open the following value mapping file:
- WCToSSFSMediationModule.ear/WCToSSFSMediationModule.jar/ValueMaps.xml
-
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>
-
Open the following value mapping file:
-
Make any necessary changes to the Mediation Module:
-
Once the mediation module has been imported into your WID
workspace:
- Modify the following file: WCToSSFSMediationModule\xslt\custom\ProcessOrderToCreateOrderInput.xsl
- 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>
- Save your changes and close the file.
-
After you have changed the file, modify the Mediation Module:
- 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.
- Open up the assembly diagram in the WCToSSFSMediationModule.
- Open Module components > imports.
- Click on the WCOrderServicesImport.
- Choose the Binding tab in the properties view.
- Enter the correct Address.
- 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.
- Open up the assembly diagram in the WCToSSFSMediationModule.
- Open the Properties View.
- Click on the WCInventoryServicesImport.
- Choose the Binding tab in the properties view.
- Enter the correct Address.
- 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.
- Launch the WESB integrated solutions console and logon.
- Navigate to Services > Policy set > Application policy sets > and select Import > From selected location.
- Select the following file: Click OK.
- Navigate to Services > Service clients and select OrderServices.
- Select OrderServices and select Attach Client Policy Set > WCServicesPolicySet. You can achieve this by selecting the top entry, causing the setting to cascade.
- Select OrderServices and select Assign Binding > New Application Specific Binding.
- Enter WCServicesBinding as the name of the binding configuration and select Add > WS-Security.
- Navigate to Authentication and protection and select request:token_auth.
- Click Apply.
- Navigate to Callback handler.
- Enter the WebSphere Commerce administrator username and password for the Administration Console and click OK.
- Save the WESB configuration changes.
- Setup the CSV_DIR environment variable:
- Launch the WESB integrated solutions console and logon.
- Navigate to Environment > WebSphere variables
- Select New, set the Name as CSV_DIR and value as a directory to point to.
- Click OK.
- Save the WESB configuration changes.
- 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:
- Open the WCToSSFSMediationModule component in WID.
- For each of the services listed below, adjust the value
set in the OrganizationCodeSetter element:
- ProcessOrder
- GetInventoryAvailability
- ProcessInventoryRequirement
- 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.
- Set the WebSphere Commerce Order Services Endpoint URL.
-
Once the mediation module has been imported into your WID
workspace:
-
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:
- Right click on the WCToSSFSMediationModule project and click Export.
- Select Integration Modules and Libraries.
- Ensure Files for Server Deployment is selected and click Next.
- Select the location of the generated EAR file and click Finish.
To install the generated EAR into a WESB server:- Log into the WESB administration console.
- Navigate to Applications > SCA Modules.
- Click Install.
- Click Browse and select the mediation module EAR.
- Select the server or cluster to install the module into and click Next.
- When the install completes, click Save.
For more information, see the WID and WESB documentation: -
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:
- Log into the WESB administration console.
- Navigate to Resources > JMS > Queue Connection Factories.
- Select New.
- Select Default Messaging Provider and click Next.
-
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
- Click OK, then click Save.