i have a flow ftp --> datamapper --> logger --> database endpoint
the ftp waits for an xml file.
the datamapper has a mapping of an xml file, the schema was generated from a sample xml file using generate file schema to a map using the generate default, and then clicking create mapping.
now i send the payload to a logger.
when i print the payload in the console, the map looks like this:
: OrderIssueDate is {OrderHeader={OrderNumber={BuyerOrderNumber=11111}, OrderIssueDate=Fri Jun 28 00:00:00 EDT 2013,...
edit
What is the mule expression to extract the BuyerOrderNumber from that arraylist.
I have tried to use xpath, and it doesnt seem to work.
I have tried #[xpath('/OrderHeader/OrderNumber//BuyerOrderNumber') but that doesn't work because it is a map, but looking at the docs from mulesoft, it says xpath can be used directly on the payload to retrieve values.
I have tried #[payload[ 'BuyerOrderNumber' ] ]. but how can i get the nested level buyerordernumber. Thanks.
configuration.xml:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc" xmlns:data-mapper="http://www.mulesoft.org/schema/mule/ee/data-mapper" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:ftp="http://www.mulesoft.org/schema/mule/ee/ftp" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/jdbc http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.xsd
http://www.mulesoft.org/schema/mule/ee/data-mapper http://www.mulesoft.org/schema/mule/ee/data-mapper/current/mule-data-mapper.xsd
http://www.mulesoft.org/schema/mule/ee/ftp http://www.mulesoft.org/schema/mule/ee/ftp/current/mule-ftp-ee.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
<jdbc-ee:mssql-data-source name="Source" user="" password="" url="jdbc:sqlserver://path" transactionIsolation="UNSPECIFIED" doc:name=""/>
<jdbc-ee:connector name="Database" dataSource-ref="MS_SQL_Data_Source" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database"/>
<data-mapper:config name="new_mapping_grf" transformationGraphPath="new_mapping.grf" doc:name="DataMapper"/>
<flow name="FlowFlow" doc:name="FlowFlow">
<ftp:inbound-endpoint host="192.168.200.2" port="21" user="username" password="pass" responseTimeout="10000" doc:name="FTP" pollingFrequency="10000"/>
<data-mapper:transform config-ref="new_mapping_grf" doc:name="DataMapper"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
<jdbc-ee:outbound-endpoint exchange-pattern="one-way" queryKey="INSERT" queryTimeout="-1" connector-ref="Database" doc:name="Database">
<jdbc-ee:query key="INSERT" value="INSERT INTO [dbo].[Order_Header]
([Create_Date])
VALUES
( #[message.payload.Order.OrderHeader.OrderIssueDate]
)"/>
</jdbc-ee:outbound-endpoint>
</flow>
</mule>
logger payload output:
org.mule.api.processor.LoggerMessageProcessor: [{OrderHeader={OrderNumber={BuyerOrderNumber=11111}, OrderIssueDate=Fri Jun 28 00:00:00 EDT 2013}}}]
To retrieve the
OrderIssueDate
field, use: