Showing posts with label order xml override external table JCAInvocationBindingImpl. Show all posts
Showing posts with label order xml override external table JCAInvocationBindingImpl. Show all posts

Thursday, November 13, 2014

OverRide OOB outbound order XML to write to a table !!

If we need OverRide OOB outbound order XML process to write to a table, please find the below steps:

1. Create an EJB for a custom table XOrderTransfer table.
2. Override wc-component-client.xml as mentioned below
3. Override class as mentioned below.
4. In WC adminconsole, set up a broadcast job for the command "RaiseECEvent"

OverRide XML:
C:\IBM\WCDE_ENT70\workspace\WC\xml\config\com.ibm.commerce.order.external-ext\wc-component-client.xml

<_config:DevelopmentClientConfiguration xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config ../xsd/wc-component-client.xsd">
<_config:invocationservice>

<_config:invocationbinding
bindingImpl="com.custom.commerce.foundation.internal.client.services.invocation.impl.CustomJCAInvocationBindingImpl">
</_config:invocationbinding>

<_config:action name="ProcessOrder" asynchronous="false">
</_config:action>

</_config:invocationservice>
</_config:DevelopmentClientConfiguration>


public class CustomJCAInvocationBindingImpl extends JCAInvocationBindingImpl implements InvocationBinding {

public InvocationServiceObject invoke(Action action, InvocationServiceObject requestDataObject) throws InvocationServiceException {
final String methodName = "invoke";
LOGGER.entering(CLASSNAME, methodName);
String inputXML = new String(requestDataObject.getXML());
//get the orderId from the request data object
ProcessOrderType processOrderType = (ProcessOrderType) requestDataObject.getDataObject();
OrderType currentOrder = (OrderType)processOrderType.getDataArea().getOrder().get(0);
String orderId = currentOrder.getOrderIdentifier().getUniqueID();
Long orderIdLong = new Long(orderId);

//persist the order XML in the XORDERTransfer table.
XOrderTransferAccessBean orderTransferAB = new XOrderTransferAccessBean(orderIdLong, inputXML);
orderTransferAB.setInsertedTime(TimestampHelper.now());
orderTransferAB.setProcessedFlag('0');
orderTransferAB.commitCopyHelper();

//invoke super class's implementation for actual message transfer
InvocationServiceObject invocationServiceObject = super.invoke(action, requestDataObject);

LOGGER.exiting(CLASSNAME, methodName);
return invocationServiceObject;
}