Help

Order Processing End-to-End Demonstration

This sample demonstrates using Video Clips the complete creation of a basic order processing scenario in SmartsIntegrator.  Specifically here’s the scenario:

  • Xml orders are received from a customer
  • A copy of each order must be sent to the legacy accounts system in CSV format.
  • For each item in the order, the current stock level must be checked by calling a web service.
  • Any items out of stock will need to be ordered from the supplier, by sending an Xml order to the supplier. This order format is different to the customer order format.

This scenario has been broken down into a number of stages, each with an animated video clip. A Pause button is provided with the video player, so the stages can be paced to requirerment.


(1) Create the CustomerOrder schema  Here we define the schema to be used for receiving Customer Orders, as defined by the following sample Message:

<CustomerOrder xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” CustomerId=”Customer1”CustomerEmail=”test@customer1.com” CustomerName=”Customer1” OrderDate=”2008-04-01T13:01:01.0000000+00:00”>
<OrderLines>
<OrderLine>
      <ProductId>ProductId1</ProductId>
      <Quantity>1</Quantity>
</OrderLine>
<OrderLine>
<ProductId>ProductId2</ProductId>
 
     <Quantity>13</Quantity>
</OrderLine>
<OrderLine>
<ProductId>ProductId3</ProductId>
      <Quantity>1</Quantity>
</OrderLine>
<OrderLine>
<ProductId>ProductId4</ProductId>
<Quantity>3</Quantity>
</OrderLine>
</OrderLines>
</CustomerOrder>


(2) Create the SupplierOrder Schema  Here we define the schema to be used for sending Supplier Orders, as defined by the following sample Message:


<SupplierOrderxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <OrderHeader>
    <CustomerId>Customer2</CustomerId>
    <ItemCount>5</ItemCount>
    <OrderDate>2008-01-01T01:01:01.0000000+00:00</OrderDate>
  </OrderHeader>
  <OrderItems>
    <OrderItem ItemCode="ItemCode1" Quantity="1">OrderItem1</OrderItem>
    <OrderItem ItemCode="ItemCode2" Quantity="24">OrderItem2</OrderItem>
    <OrderItem ItemCode="ItemCode3" Quantity="11">OrderItem3</OrderItem>
    <OrderItem ItemCode="ItemCode4" Quantity="10">OrderItem4</OrderItem>
    <OrderItem ItemCode="ItemCode5" Quantity="2">OrderItem5</OrderItem>
  </OrderItems>
</SupplierOrder>



(3) Create the AccountsOrder Schema  Here we define the CSV file Schema, as defined by the following sample Message:

CustomerId,2008-01-01T01:01:01.0000000+00:00
ProductId1,Quantity1
ProductId2,Quantity2
ProductId3,Quantity3
ProductId4,Quantity4
ProductId5,Quantity5
ProductId6,Quantity6

(4) Create the CustomerOrder to SupplierOrder Map  Here we create a Map to convert from a customer order to a supplier order, translating the product codes. This Map copies over all order quantities literally, though shortly we will write a workflow to subsequently adjust the quantities being ordered according to current stock levels.

(5) Create the CustomerOrder to AccountsOrder Map  Here we create a map to convert from a customer order to the format to be sent to the accounts system.

(6) Create the Order Workflow  Here we create a Workflow to receive the customer order, map it to a supplier order and an account order, iterate the items in the order checking current stock levels and fixing up the supplier order, and then send the supplier and accounts orders.

(7) Test the Order Workflow  Here we run a simple test file through the workflow to test for expected results. We can use the sample XML from stage 1.

(8) Create the Ports, and Bind the Workflow  Here we create a Receive Port to receive the incoming customer order, and we create two Send Ports for the supplier and accounts orders.  Then we bind the Order Workflow to the Ports we created, so it is ready to run.

If you’ve been following along, if you now drop a sample Customer Order file into the receive directory, you should get Supplier and Accounts orders output into the corresponding send directories within a few seconds. If things do not run as expected, check the Server is running, all ports are enabled, and that there are no errors in the Tracking log.