SlideShare a Scribd company logo
Mule ESB: DataWeave
xml input to Java Object example
This tutorial explains how to develop a
DataWeave transformation from XML to Java
Object.
Pre-requisite:
• Anypoint Studio 5.2.0
• Mule ESB Runtime 3.7.1
• xml input files.
Input XML File
<user>
<name>Annie</name>
<lastName>Point</lastName>
</user>
Mule Flow
Mule Source
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081"
doc:name="HTTP Listener Configuration"/>
<flow name="testweaveFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/"
metadata:id="cab0526f-779e-427c-9a33-be44f9b12696" doc:name="HTTP"/>
<dw:transform-message doc:name="Transform Message">
<dw:input-payload doc:sample="json.json"/>
<dw:set-payload><![CDATA[%dw 1.0
%type user = :object { class: "testweave.User" }
%output application/java
---
{
firstName: payload.user.name,
lastName: payload.user.lastName
} as :user]]></dw:set-payload>
</dw:transform-message>
<byte-array-to-string-transformer doc:name="Byte Array to String"/>
</flow>
In the transform code I created the Object type in the
header
“ %type user = :object { class: "testweave.User"} ”
And the payload of the transform is converted to User
Object using the transform logic as below.
{
firstName: payload.user.name,
lastName: payload.user.lastName
} as :user
DataWeave
User.java
package testweave;
public class User {
private String firstName;
private String lastName;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
@Override
public String toString() {
// TODO Auto-generated method stub
return this.firstName+" "+this.lastName;
}
}

More Related Content

What's hot

Message properties component in mule
Message properties component in muleMessage properties component in mule
Message properties component in mule
Khan625
 
Message properties component in Mule
Message properties component in MuleMessage properties component in Mule
Message properties component in Mule
Khan625
 
Mule property placeholder
Mule property placeholderMule property placeholder
Mule property placeholder
Sashidhar Rao GDS
 
Mule ESB SMTP Connector Integration
Mule ESB SMTP Connector  IntegrationMule ESB SMTP Connector  Integration
Mule ESB SMTP Connector Integration
AnilKumar Etagowni
 
Dropbox connector Mule ESB Integration
Dropbox connector Mule ESB IntegrationDropbox connector Mule ESB Integration
Dropbox connector Mule ESB Integration
AnilKumar Etagowni
 
Mule Message Properties Component
Mule Message Properties ComponentMule Message Properties Component
Mule Message Properties Component
Durga Prasad Kakarla
 
Quartz component in mule
Quartz component in muleQuartz component in mule
Quartz component in mule
javeed_mhd
 
Filter expression in mule
Filter expression in muleFilter expression in mule
Filter expression in mule
Rajkattamuri
 
xslt in mule
xslt in mulexslt in mule
xslt in mule
Praneethchampion
 
Mule esb :Data Weave
Mule esb :Data WeaveMule esb :Data Weave
Mule esb :Data Weave
AnilKumar Etagowni
 
Choice component in mule
Choice component in mule Choice component in mule
Choice component in mule
Rajkattamuri
 

What's hot (11)

Message properties component in mule
Message properties component in muleMessage properties component in mule
Message properties component in mule
 
Message properties component in Mule
Message properties component in MuleMessage properties component in Mule
Message properties component in Mule
 
Mule property placeholder
Mule property placeholderMule property placeholder
Mule property placeholder
 
Mule ESB SMTP Connector Integration
Mule ESB SMTP Connector  IntegrationMule ESB SMTP Connector  Integration
Mule ESB SMTP Connector Integration
 
Dropbox connector Mule ESB Integration
Dropbox connector Mule ESB IntegrationDropbox connector Mule ESB Integration
Dropbox connector Mule ESB Integration
 
Mule Message Properties Component
Mule Message Properties ComponentMule Message Properties Component
Mule Message Properties Component
 
Quartz component in mule
Quartz component in muleQuartz component in mule
Quartz component in mule
 
Filter expression in mule
Filter expression in muleFilter expression in mule
Filter expression in mule
 
xslt in mule
xslt in mulexslt in mule
xslt in mule
 
Mule esb :Data Weave
Mule esb :Data WeaveMule esb :Data Weave
Mule esb :Data Weave
 
Choice component in mule
Choice component in mule Choice component in mule
Choice component in mule
 

Viewers also liked

Mule google connectors
Mule google connectorsMule google connectors
Mule google connectors
princeirfancivil
 
Mule security jaas
Mule security jaasMule security jaas
Mule security jaas
irfan1008
 
Mule splitters
Mule splittersMule splitters
Mule splitters
Ravinder Singh
 
Soap in mule
Soap in muleSoap in mule
Soap in mule
D.Rajesh Kumar
 
Mule anypoint exchange
Mule anypoint exchangeMule anypoint exchange
Mule anypoint exchange
Phaniu
 
Mule with facebook
Mule with facebookMule with facebook
Mule with facebook
D.Rajesh Kumar
 
Mule esb-microsoft
Mule esb-microsoftMule esb-microsoft
Mule esb-microsoft
D.Rajesh Kumar
 
Using xslt in mule
Using  xslt in muleUsing  xslt in mule
Using xslt in mule
Khan625
 
Database component in mule demo
Database component in mule demoDatabase component in mule demo
Database component in mule demo
Sudha Ch
 
Mule soa
Mule soaMule soa
Mule soa
princeirfancivil
 
Mule compatible technologies
Mule compatible technologiesMule compatible technologies
Mule compatible technologies
D.Rajesh Kumar
 
Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mule
Phaniu
 
Mule soa
Mule soaMule soa
Mule soa
Phaniu
 
Mule with velocity
Mule with velocityMule with velocity
Mule with velocity
Khan625
 
Mule with rabbit mq
Mule with rabbit mqMule with rabbit mq
Mule with rabbit mq
Khan625
 
Mule for each scope headerc ollection
Mule for each scope headerc ollectionMule for each scope headerc ollection
Mule for each scope headerc ollection
Phaniu
 
Mule
MuleMule
Mule
irfan1008
 
Mule for each scope headerc ollection
Mule for each scope headerc ollectionMule for each scope headerc ollection
Mule for each scope headerc ollection
Phaniu
 
Mule soap
Mule soapMule soap
Mule soap
irfan1008
 
Http mule
Http muleHttp mule
Http mule
Karnam Karthik
 

Viewers also liked (20)

Mule google connectors
Mule google connectorsMule google connectors
Mule google connectors
 
Mule security jaas
Mule security jaasMule security jaas
Mule security jaas
 
Mule splitters
Mule splittersMule splitters
Mule splitters
 
Soap in mule
Soap in muleSoap in mule
Soap in mule
 
Mule anypoint exchange
Mule anypoint exchangeMule anypoint exchange
Mule anypoint exchange
 
Mule with facebook
Mule with facebookMule with facebook
Mule with facebook
 
Mule esb-microsoft
Mule esb-microsoftMule esb-microsoft
Mule esb-microsoft
 
Using xslt in mule
Using  xslt in muleUsing  xslt in mule
Using xslt in mule
 
Database component in mule demo
Database component in mule demoDatabase component in mule demo
Database component in mule demo
 
Mule soa
Mule soaMule soa
Mule soa
 
Mule compatible technologies
Mule compatible technologiesMule compatible technologies
Mule compatible technologies
 
Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mule
 
Mule soa
Mule soaMule soa
Mule soa
 
Mule with velocity
Mule with velocityMule with velocity
Mule with velocity
 
Mule with rabbit mq
Mule with rabbit mqMule with rabbit mq
Mule with rabbit mq
 
Mule for each scope headerc ollection
Mule for each scope headerc ollectionMule for each scope headerc ollection
Mule for each scope headerc ollection
 
Mule
MuleMule
Mule
 
Mule for each scope headerc ollection
Mule for each scope headerc ollectionMule for each scope headerc ollection
Mule for each scope headerc ollection
 
Mule soap
Mule soapMule soap
Mule soap
 
Http mule
Http muleHttp mule
Http mule
 

Similar to Mule esb

Mule xml java
Mule xml javaMule xml java
Mule xml java
VirtusaPolaris
 
Mule xml java
Mule xml javaMule xml java
Mule xml java
Nagendra Kumar
 
Mulexml java
Mulexml javaMulexml java
Mulexml java
Vishnukanth Rachineni
 
Mule XML java sample
Mule XML java sampleMule XML java sample
Mule XML java sample
Vishnukanth Rachineni
 
Mulesoft xml to Java Conversion
Mulesoft xml to Java ConversionMulesoft xml to Java Conversion
Mulesoft xml to Java Conversion
v srikanth
 
Mule xml parsing
Mule xml parsingMule xml parsing
Mule xml parsing
Santhosh Ramagiri
 
Mule xml parsing
Mule xml parsingMule xml parsing
Mule xml parsing
Muralidhar Gumma
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
F K
 
Caching invalidating with managed store
Caching invalidating with managed storeCaching invalidating with managed store
Caching invalidating with managed store
Praneethchampion
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
Khasim Saheb
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
Mohammed246
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
javeed_mhd
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
mdfkhan625
 
Caching invalidating with managed store
Caching invalidating with managed storeCaching invalidating with managed store
Caching invalidating with managed store
AbdulImrankhan7
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
Sunil Komarapu
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
irfan1008
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
Sunil Komarapu
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
Hasan Syed
 
Caching & validating
Caching & validatingCaching & validating
Caching & validating
Son Nguyen
 
Mule smtp connector
Mule smtp connectorMule smtp connector
Mule smtp connector
Krishnakanth Goud
 

Similar to Mule esb (20)

Mule xml java
Mule xml javaMule xml java
Mule xml java
 
Mule xml java
Mule xml javaMule xml java
Mule xml java
 
Mulexml java
Mulexml javaMulexml java
Mulexml java
 
Mule XML java sample
Mule XML java sampleMule XML java sample
Mule XML java sample
 
Mulesoft xml to Java Conversion
Mulesoft xml to Java ConversionMulesoft xml to Java Conversion
Mulesoft xml to Java Conversion
 
Mule xml parsing
Mule xml parsingMule xml parsing
Mule xml parsing
 
Mule xml parsing
Mule xml parsingMule xml parsing
Mule xml parsing
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
 
Caching invalidating with managed store
Caching invalidating with managed storeCaching invalidating with managed store
Caching invalidating with managed store
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
 
Caching invalidating with managed store
Caching invalidating with managed storeCaching invalidating with managed store
Caching invalidating with managed store
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
 
Caching & validating
Caching & validatingCaching & validating
Caching & validating
 
Mule smtp connector
Mule smtp connectorMule smtp connector
Mule smtp connector
 

More from Khan625

Mapping and listing in mule
Mapping and listing in muleMapping and listing in mule
Mapping and listing in mule
Khan625
 
Jenkins Build System
Jenkins Build SystemJenkins Build System
Jenkins Build System
Khan625
 
Building and Managing Projects with Maven
Building and Managing Projects with MavenBuilding and Managing Projects with Maven
Building and Managing Projects with Maven
Khan625
 
Web services soap
Web services soapWeb services soap
Web services soap
Khan625
 
Web services wsdl
Web services wsdlWeb services wsdl
Web services wsdl
Khan625
 
Web services uddi
Web services uddiWeb services uddi
Web services uddi
Khan625
 
Web services with soap
Web services with soapWeb services with soap
Web services with soap
Khan625
 
Maven
Maven Maven
Maven
Khan625
 
WebServices Basic Overview
WebServices Basic OverviewWebServices Basic Overview
WebServices Basic Overview
Khan625
 
Java Basics
Java BasicsJava Basics
Java Basics
Khan625
 
Mmc rest api user groups
Mmc rest api user groupsMmc rest api user groups
Mmc rest api user groups
Khan625
 
Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mule
Khan625
 
Data weave
Data weave Data weave
Data weave
Khan625
 
Anypoint data gateway
Anypoint data gatewayAnypoint data gateway
Anypoint data gateway
Khan625
 
Mule with drools
Mule with droolsMule with drools
Mule with drools
Khan625
 
Idempotent filter with simple file
Idempotent filter with simple fileIdempotent filter with simple file
Idempotent filter with simple file
Khan625
 
Mule with quartz
Mule with quartzMule with quartz
Mule with quartz
Khan625
 
Scatter gather flow control
Scatter gather flow controlScatter gather flow control
Scatter gather flow control
Khan625
 
Simple groovy example in mule
Simple groovy example in muleSimple groovy example in mule
Simple groovy example in mule
Khan625
 
Simple web service vm
Simple web service vmSimple web service vm
Simple web service vm
Khan625
 

More from Khan625 (20)

Mapping and listing in mule
Mapping and listing in muleMapping and listing in mule
Mapping and listing in mule
 
Jenkins Build System
Jenkins Build SystemJenkins Build System
Jenkins Build System
 
Building and Managing Projects with Maven
Building and Managing Projects with MavenBuilding and Managing Projects with Maven
Building and Managing Projects with Maven
 
Web services soap
Web services soapWeb services soap
Web services soap
 
Web services wsdl
Web services wsdlWeb services wsdl
Web services wsdl
 
Web services uddi
Web services uddiWeb services uddi
Web services uddi
 
Web services with soap
Web services with soapWeb services with soap
Web services with soap
 
Maven
Maven Maven
Maven
 
WebServices Basic Overview
WebServices Basic OverviewWebServices Basic Overview
WebServices Basic Overview
 
Java Basics
Java BasicsJava Basics
Java Basics
 
Mmc rest api user groups
Mmc rest api user groupsMmc rest api user groups
Mmc rest api user groups
 
Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mule
 
Data weave
Data weave Data weave
Data weave
 
Anypoint data gateway
Anypoint data gatewayAnypoint data gateway
Anypoint data gateway
 
Mule with drools
Mule with droolsMule with drools
Mule with drools
 
Idempotent filter with simple file
Idempotent filter with simple fileIdempotent filter with simple file
Idempotent filter with simple file
 
Mule with quartz
Mule with quartzMule with quartz
Mule with quartz
 
Scatter gather flow control
Scatter gather flow controlScatter gather flow control
Scatter gather flow control
 
Simple groovy example in mule
Simple groovy example in muleSimple groovy example in mule
Simple groovy example in mule
 
Simple web service vm
Simple web service vmSimple web service vm
Simple web service vm
 

Recently uploaded

Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 

Recently uploaded (20)

Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 

Mule esb

  • 1. Mule ESB: DataWeave xml input to Java Object example
  • 2. This tutorial explains how to develop a DataWeave transformation from XML to Java Object. Pre-requisite: • Anypoint Studio 5.2.0 • Mule ESB Runtime 3.7.1 • xml input files. Input XML File <user> <name>Annie</name> <lastName>Point</lastName> </user>
  • 4. Mule Source <http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/> <flow name="testweaveFlow"> <http:listener config-ref="HTTP_Listener_Configuration" path="/" metadata:id="cab0526f-779e-427c-9a33-be44f9b12696" doc:name="HTTP"/> <dw:transform-message doc:name="Transform Message"> <dw:input-payload doc:sample="json.json"/> <dw:set-payload><![CDATA[%dw 1.0 %type user = :object { class: "testweave.User" } %output application/java --- { firstName: payload.user.name, lastName: payload.user.lastName } as :user]]></dw:set-payload> </dw:transform-message> <byte-array-to-string-transformer doc:name="Byte Array to String"/> </flow>
  • 5. In the transform code I created the Object type in the header “ %type user = :object { class: "testweave.User"} ” And the payload of the transform is converted to User Object using the transform logic as below. { firstName: payload.user.name, lastName: payload.user.lastName } as :user
  • 7. User.java package testweave; public class User { private String firstName; private String lastName; public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } @Override public String toString() { // TODO Auto-generated method stub return this.firstName+" "+this.lastName; } }