XML over HTTP
HCL Commerce can receive inbound XML messages over HTTP using the Program Adapter.
The following steps illustrate the overall flow of an XML over HTTP request:
- An external system sends an XML message to HCL Commerce over HTTP via a POST request. For example, http://host_name/webapp/wcs/stores/servlet/.
- The request is mapped to the Program Adapter.
- The Program Adapter passes the XML request to the appropriate message mapper.
- The message mapper converts the XML request into a CommandProperty object and passes it back to the Program Adapter.
- The Program Adapter prepares the command for execution and passes it to the WebController for execution.
- The Program Adapter generates the proper XML response and returns the XML response to the external system that made the request.
When the Program Adapter receives the XML request, it must verify the credentials of the external system that sent the request. Not all XML requests can be processed. Even if the XML request can be mapped to an HCL Commerce command, there must be some verification to ensure that the request should be processed.
Note:
To support the XML/HTTP adapter under the Struts 2.0 implementation, update the
Stores.WAR\WEB-INF\web.xml configuration file by changing
filter-class from
"org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter"
to "com.ibm.commerce.struts.v2.ECActionStrutsServletFilter"
. For
example, change<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
<param-name>config</param-name>
<param-value>struts-default.xml,struts-plugin.xml,struts-stores.xml</param-value>
</init-param>
<init-param>
<param-name>ServletName</param-name>
<param-value>Stores</param-value>
</init-param>
</filter>
to<filter>
<filter-name>struts2</filter-name>
<filter-class>com.ibm.commerce.struts.v2.ECActionStrutsServletFilter</filter-class>
<init-param>
<param-name>config</param-name>
<param-value>struts-default.xml,struts-plugin.xml,struts-stores.xml</param-value>
</init-param>
<init-param>
<param-name>ServletName</param-name>
<param-value>Stores</param-value>
</init-param>
</filter>
Note:
For HCL Commerce version
9.1.11.0 and greater, do the following to support the XML/HTTP adapter under the
Struts 2.0 implementation:
- Ensure that you have the Java file Enablement-Struts2Logic/src/com/ibm/commerce/struts/v2/dispatcher/mapper/ECActionMapper.java within the Enablement-Struts2Logic.jar Java Archive.
- Modify your store Struts configuration.
- Open Stores/src/struts-stores.xml for editing.
- Add following configuration to the top
portion.
<bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="ecActionMapper" class="com.ibm.commerce.struts.v2.dispatcher.mapper.ECActionMapper" /> <constant name="struts.mapper.class" value="ecActionMapper" />
- Save and close the file.