hi,

I try to write a sample which uses rules and ESB to process a customer
order.

For that I have this requirement.

The esb proxy service receives a message like this,

<ns2:CustomerOrderProcessRequest xmlns:ns2="http://brs.carbon.wso2.org";>
    <ns2:Customer>
        <ns2:name>Amila</ns2:name>
        <ns2:rating>0.5</ns2:rating>
        <ns2:maxAmount>50</ns2:maxAmount>
        <ns2:Order>
            <items xmlns="http://pojo.sample.brs/xsd";>
                <price>50.0</price>
                <type>TypeA</type>
            </items>
            <items xmlns="http://pojo.sample.brs/xsd";>
                <price>60.0</price>
                <type>TypeB</type>
            </items>
            <ns1:orderID xmlns:ns1="http://pojo.sample.brs/xsd
">Order1</ns1:orderID>
        </ns2:Order>
        <ns2:Order>
            <items xmlns="http://pojo.sample.brs/xsd";>
                <price>50.0</price>
                <type>TypeA</type>
            </items>
            <items xmlns="http://pojo.sample.brs/xsd";>
                <price>60.0</price>
                <type>TypeA</type>
            </items>
            <ns1:orderID xmlns:ns1="http://pojo.sample.brs/xsd
">Order2</ns1:orderID>
        </ns2:Order>
    </ns2:Customer>
</ns2:CustomerOrderProcessRequest>

Then ESB has to send the following message to rule service.

<ns2:CalculatePriceRequest xmlns:ns2="http://brs.carbon.wso2.org";>
    <ns2:Order>
        <items xmlns="http://pojo.sample.brs/xsd";>
            <price>50.0</price>
            <type>TypeA</type>
        </items>
        <items xmlns="http://pojo.sample.brs/xsd";>
            <price>60.0</price>
            <type>TypeB</type>
        </items>
        <ns1:orderID xmlns:ns1="http://pojo.sample.brs/xsd
">Order1</ns1:orderID>
    </ns2:Order>
    <ns2:Order>
        <items xmlns="http://pojo.sample.brs/xsd";>
            <price>50.0</price>
            <type>TypeA</type>
        </items>
        <items xmlns="http://pojo.sample.brs/xsd";>
            <price>60.0</price>
            <type>TypeA</type>
        </items>
        <ns1:orderID xmlns:ns1="http://pojo.sample.brs/xsd
">Order2</ns1:orderID>
    </ns2:Order>
</ns2:CalculatePriceRequest>

Currently I have the following ESB configuration which passes the received
message as it is.

<proxy name="CustomerOrderService" transports="https http"
startOnLoad="true" trace="disable">
        <target inSequence="CustomerOrderInSequence"
outSequence="CustomerOrderOutSequence"/>
    </proxy>
    <sequence name="CustomerOrderInSequence">
        <send>
            <endpoint
name="endpoint_urn_uuid_EA2F12A5E60B83D785297590854239961202342050">
                <address uri="
http://111.223.141.139:9762/services/PriceCalculatorService"/>
            </endpoint>
        </send>
    </sequence>
    <sequence name="CustomerOrderOutSequence">
        <send/>
    </sequence>

I need to get the orders from the received request and create the out put
message.
One options is to use the XSLT transformations instead of can I use the
enrich mediator?

If I use enrich mediator what are the steps?

I tried to do following steps. But seems to be not working.

1. create a property with empty
<ns2:CalculatePriceRequest xmlns:ns2="http://brs.carbon.wso2.org";>

2. Then copy the orders from the soap body to the element property.
3. Replace this property om element with the soap body.

thanks,
Amila.
_______________________________________________
Carbon-dev mailing list
[email protected]
https://wso2.org/cgi-bin/mailman/listinfo/carbon-dev

Reply via email to