Wednesday, November 6, 2013

Enterprise Manager Composite Sensor - showing XML

It is quite common to use composite sensor to log key value information to EM and later can be used for searching specific instances based on those keys. However, recently while working on complex canonical model we found that once we configure the sensor, the value of sensor shows up as an XML, instead of actual value.

For example, below VIN is string and correct xpath expression is configured for sensor value, but in EM it shows up as XML string with wrapper element.

Sensor Configuration


Sensor Value in EM



We also saw that this behavior is quite random, if we recreate the sensor sometime it goes away, and some time it comes back. Here is the solution we found which worked all the time.

Original sensor.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<sensors xmlns="http://xmlns.oracle.com/bpel/sensor">
    <sensor sensorName="VIN" kind="service" target="undefined" filter="" xmlns:soebm="http://xmlns.springsoa.com/EnterpriseObjects/Core/SalesOrderMessage/V1" xmlns:ns2="http://xmlns.springsoa.com/EnterpriseObjects/Core/SalesOrder/V1" xmlns:ns8="http://xmlns.springsoa.com/EnterpriseObjects/Core/Account/V1">
        <serviceConfig service="client" expression="$in.payload/soebm:ProcessSalesOrder/soebm:Data/ns2:SalesOrder/ns2:Account/ns8:Vin" operation="CaptureSalesOrder" outputDataType="Vin" outputNamespace="http://xmlns.springsoa.com/EnterpriseObjects/Common/CommonTypes/V1"/>
    </sensor>
</sensors>


Changes required in sensor.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<sensors xmlns="http://xmlns.oracle.com/bpel/sensor">
    <sensor sensorName="VIN" kind="service" target="undefined" filter="" xmlns:ns1="http://xmlns.springsoa.com/EnterpriseObjects/Core/Account/V1">
        <serviceConfig service="client" expression="$in.payload/ns1:CreateAccount/ns1:DataArea/ns1:AccountInfo/ns1:Vin" operation="CreateAccount" outputDataType="string" outputNamespace="http://www.w3.org/2001/XMLSchema"/>
    </sensor>
</sensors>

Once deployed, it shows up fine in EM


No comments: