Concept - cXML Order Injection

1 Introduction

Info

This concept is valid for ICM version 7.10.31 and higher.

cXML Order Injection describes the receiving and handling of a cXML order request, generally sent from a procurement system. After receiving a cXML file, it is parsed, a basket is created with certain values from the cXML file, and an order is created.

1.1 References

2 General Concept

This feature is very flexible and will most likely be implemented differently in every project. Therefore, one of the main goals for this implementation was the exchangeability and extensibility of the provided functionality. To achieve this, the handler chain framework has been chosen. This allows projects to easily extend, replace, or remove standard functionality.

Before the handler chain is being executed, ICM receives the cXML via a pipeline call and tries to determine the version of the cXML file evaluating the cXML DOCTYPE tag. If the version cannot be determined, the registered default handler chain will be used, in standard case the CXMLOrderInjectionChainV2. The handler chain manages everything else, like unmarshalling the provided cXML, checking user credentials, creating a basket, mapping different values to the basket, and finally creating the order. In any case, a response will be sent, either including a success message or some information about any problems that occurred, based on the cXML Standard.

3 Handler Chain

There are two main chains implemented in the standard implementation and several handlers. Some of the handlers are version-independent, and some work with version-specific classes. This can be differentiated by the package name. Version-independent handlers can easily be reused in a different chain for a new version.

The first is PreCXMLOrderInjectionChainV2. It handles all kinds of preparation to place the order later. Currently (7.10.31) implemented handlers are:

Name of HandlerDescription

Version-independent

ParseCXMLOrderInjectionHandlerHandler that parses the input stream to an object.no
CheckUserCXMLOrderInjectionHandler

Handler that checks if the user data sent in the cXML Header are valid.

no
MapBasketCXMLOrderInjectionHandlerHandler that maps the cXML OrderRequest to a basket.yes
MapLineItemsCXMLOrderInjectionHandlerHandler that adds items from a cXML order request to a basket.no
MapShippingMethodCXMLOrderInjectionHandler

Handler that adds a shipping method to the basket from cXML.

no
MapOrderAddressesCXMLOrderInjectionHandlerHandler that adds an invoice address and shipping address for the whole order if specified in the cXML.no
MapPaymentCXMLOrderInjectionHandler

Handler that sets the configured payment method at the basket.

yes
PrepareBasketForOrderCreationCXMLOrderInjectionHandlerHandler that prepares a basket for the order creation by validating and calculating.yes

The second chain CreateOrderCXMLOrderInjectionChainV2 creates the actual order and has only one handler:

Name of HandlerDescriptionVersion-independent
CreateOrderCXMLOrderInjectionHandler

Handler that creates an order from a basket, which was created from a cXML order request.

yes

In a development environment the actual loaded handlers can be checked via a pipeline call to InspectHandlerChains-Start, like https://<yourServer>/INTERSHOP/web/WFS/inSPIRED-inTRONICS_Business-Site/en_US/-/USD/InspectHandlerChains-Start.

If there is a failure in any of the handlers, the chain will be rolled back. In standard implementation that means the reverseInvoke() from MapBasketCXMLOrderInjectionHandler will be called, which moves the basket into the basket history.

4 Versioning

The cXML order injection feature released with 7.10.31 is based and tested on cXML Version 1.2.049. In ICM, the implemented cXML feature is referred to as V2.

Other minor cXML versions will most likely work with V2 as well but that has not been tested.

If another feature version is needed, this can be done by implementing a new handler chain for the according version and registering it via Guice. Please refer to Cookbook - cXML Order Injection | Recipe: How To Support Another Version of cXML.

5 Testing

https://punchoutcommerce.com/tools/cxml-order-tester offers a testing tool for your environment.

If your environment is only available internally, you can follow Cookbook - cXML Order Injection | Recipe: How To Test My System.

6 Configurable Unit Mapping

This section describes how certain values can be configured. Since order injection doesn't deal with localized text, this description relates only to the unit mapping configuration.



ICM Version

This concept is valid from ICM version 7.10.35.0.

6.1 Introduction

In the first implementation of cXML Punchout and order injection (ICM 7.10.31), the configuration of data like unit mapping and locale configuration were limited.

The newly introduced UserPreference table allows now to store user specific cXML configuration data, like the unit mapping and locale.

The unit mapping converts procurement system units like box or piece etc. to units used in ICM and vice versa.

For both a global configuration can be stored in properties.

The UserPreference table data allows to customize those values per user aka cXMLUser. (see references documents for details)

6.1.1 Glossary

cXML - is a standard for Punchout similar to OCI. Besides the Punchout to an external B2B store, it also supports an order injection with basket data.

6.2 References

Concept - UserPreference table

Overview - Punchout - is the starting page for all ISH documents related to Punchout with cXML and OCI

Concept - Dependency Injection and ObjectGraphs

6.3 The CXMLPunchoutConfigurationProvider

This provider is used to supply the configurations for the global or user specific locale and the unit mapping. It is used for both, the cXML punchout basket and the cXML order injection.

The provider currently has two methods:

configuration provider methods
Map<String, String> getUnitMappings(UserBO userBO); 
LocaleInformation getPunchoutLocale(UserBO userBO);

They both have a hierarchy from which source the configuration is retrieved. The details are described in the next chapters for locale and unit mapping.

  • In case the hierarchy logic or the source of the configuration must be different in a customized project, it can be replaced.
  • Replaced by implementing your own customCXMLPunchoutConfigurationProviderImpl and use Guice to wire it to the interface.

6.4 Locale for Product Texts

  • The locale configuration is used for localized product texts when transferring the punchout basket.

  • It is possible to create a property with key "intershop.cxml.punchout.locale" to define a "global" configuration.

  • It is also possible to create a preference in table UserPreferences with name "punchout.locale" and group "cxml" to define a user specific configuration.

6.4.1 Hierarchy

The hierarchy or priority for the locale is as follows:

  1. The user specific preference stored with the given user.

  2. The 'global' configuration stored in a property, read via ConfigurationMgr.

  3. The locale stored for the current application.

  4. The system wide lead locale.

6.5 Unit Mapping

  • The unit mapping is used for both, punchout and order injection.

  • It converts units available in the calling Procurement system to units available in ICM and vice versa.

  • It is possible to create a property with key prefix "intershop.cxml.unitmapping" to define "global" mapping configurations.

    • example: intershop.cxml.unitmapping.EA=pcs  or  intershop.cxml.unitmapping.BX=Box  etc.

  • It is also possible to create a preference in table UserPreferences with name "unitmapping" and group "cxml" to define a user specific mapping configuration.

    • Here the configuration data is expected to be stored in one line.

    • The key and values are separated by a ':', the different groups(key-value-pairs) are separated by a '\t' tabulator character.

    • example stringValue: EACH;pcs   BOX;box   DOZ;DOZEN

    • Any configuration which doesn't fit the pattern, will be printed out as a warn log message and ignored for processing!

6.5.1 Hierarchy

The unit mapping actually used in the REST calls, can come from user specific preference configurations, from a global property configurations and a combination of both.

The hierarchy or priority for the unit-mapping is as follows:

  1. The user specific preference stored with the given user.

    • it overwrites/replaces any aleady existing global values and adds not existing user configurations

  2. The 'global' configuration stored in properties, read via ConfigurationMgr.

Examples:

key

user value

global value

value used for mapping

EA

stück

pcs

stück

BOX

box


box

DOZ


dozen

dozen

  • It is possible to use a global configuration and just replace the few specific to the user.

  • To use only user specific configuration, by not creating a global configuration with properties.

  • Or use only global configuration with properties, by not having an user specific data.

Disclaimer

The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Web site, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.

Customer Support
Knowledge Base
Product Resources
Tickets