Skip to end of metadata
Go to start of metadata

This is very straightforward. You may need to review the StringTemplate docs to fully understand the templates, but they are quite self explanitory. Also, take a look at the .cdrl configurations below. These configs describe how the beans above get populated, and when the StringTemplate scripts get executed.

For transforming the request, we have the TrackingNumberIn.st StringTemplate script. This script will use the "current" TrackingNumber bean instance.

<trackingNumber>
 $trackingNumber$
</trackingNumber>


For transforming the response, we have the HistoryTrans.st and TrackingNumberOut.st StringTemplate scripts. The TrackingNumberOut.st script will use the "current" Heading bean instance.

HistoryTrans.st:

<trackingNumbers>
	$history.trackingNumbers:org/milyn/templating/stringtemplate/sample/TrackingNumberOut()$
</trackingNumbers>

TrackingNumberOut.st:

<trackingNumber>
	<shipperID>$it.shipperID$</shipperID>
	<shipmentNumber>
		$it.shipmentNumber$
	</shipmentNumber>
</trackingNumber>

So, as you may have noticed, the TrackingNumberOut.st is called/included from the HistoryTrans.st script to output the multiple "trackingNumber" elements from the TrackingNumber bean list available from the History bean.

Back

  • No labels