SlideShare a Scribd company logo
1 of 13
Download to read offline
XML to Object Esb
As we know, there can be multiple types of payload we need
to deal daily, starting from JSON, XML or String, we also
require different type of data transformation in our
application like XML to JSON, JSON to XML or String etc
. In Mule application, we have a various set of transformers
that we can use to obtain our required data format.
Today we will be discussing on transformation of XML to
Object format of data.
So, let us consider, we have the following XML payload as an
input to our application
< user>
<name>John</name>
<lastName>Rich</lastName>
</user>
Mule source
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:metadata=http://www.mulesoft.org/schema/mule/metadata
xmlns:http=http://www.mulesoft.org/schema/mule/http
xmlns:http=http://www.mulesoft.org/schema/mule/http
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc=http://www.mulesoft.org/schema/mule/documentation
xmlns:spring=http://www.springframework.org/schema/beans
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/http
http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/dw
http://www.mulesoft.org/schema/mule/ee/dw/current/dw.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: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="/test"
doc:name="HTTP"/>
<dw:transform-message doc:name="Transform Message">
<dw:input-payload doc:sample="empty.xml"/>
<dw:set-payload><![CDATA[%dw 1.0
%type user = :object { class: "testdatajava.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"/>
<logger message="#[message]" level="INFO" doc:name="Logger"/>
</flow>
</mule>
In the transform code I created the Object type in the header
“ %type user = :object { class: "testdatajava.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
Transformer
User.java
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;
}
}
Mule Flow

More Related Content

What's hot

Mule esb data weave multi input data
Mule esb data weave multi input dataMule esb data weave multi input data
Mule esb data weave multi input dataAnilKumar Etagowni
 
Mule xml transformation
Mule xml transformationMule xml transformation
Mule xml transformationD.Rajesh Kumar
 
WebServices Basic Overview
WebServices Basic OverviewWebServices Basic Overview
WebServices Basic OverviewKhan625
 
Introduction to WebServices
Introduction to WebServicesIntroduction to WebServices
Introduction to WebServicesKhasim Cise
 
Introduction to WebServices
Introduction to WebServicesIntroduction to WebServices
Introduction to WebServicesAbdulImrankhan7
 
React with WordPress : Headless CMS
React with WordPress : Headless CMSReact with WordPress : Headless CMS
React with WordPress : Headless CMSImran Sayed
 
Build Modern Web Applications with React and WordPress
Build Modern Web Applications with React and WordPressBuild Modern Web Applications with React and WordPress
Build Modern Web Applications with React and WordPressImran Sayed
 
Creating dynamic json in Mule
Creating dynamic json in MuleCreating dynamic json in Mule
Creating dynamic json in MuleF K
 
Converting with custom transformer
Converting with custom transformerConverting with custom transformer
Converting with custom transformerirfan1008
 

What's hot (15)

Dataweave
DataweaveDataweave
Dataweave
 
Xslt in mule
Xslt in muleXslt in mule
Xslt in mule
 
Mule esb data weave multi input data
Mule esb data weave multi input dataMule esb data weave multi input data
Mule esb data weave multi input data
 
Mule xml transformation
Mule xml transformationMule xml transformation
Mule xml transformation
 
WebServices Basic Overview
WebServices Basic OverviewWebServices Basic Overview
WebServices Basic Overview
 
Introduction to WebServices
Introduction to WebServicesIntroduction to WebServices
Introduction to WebServices
 
Introduction to WebServices
Introduction to WebServicesIntroduction to WebServices
Introduction to WebServices
 
Mule esb :Data Weave
Mule esb :Data WeaveMule esb :Data Weave
Mule esb :Data Weave
 
Parameters as a part of body
Parameters as a part of bodyParameters as a part of body
Parameters as a part of body
 
React with WordPress : Headless CMS
React with WordPress : Headless CMSReact with WordPress : Headless CMS
React with WordPress : Headless CMS
 
Build Modern Web Applications with React and WordPress
Build Modern Web Applications with React and WordPressBuild Modern Web Applications with React and WordPress
Build Modern Web Applications with React and WordPress
 
Mule Webservices
Mule WebservicesMule Webservices
Mule Webservices
 
Creating dynamic json in Mule
Creating dynamic json in MuleCreating dynamic json in Mule
Creating dynamic json in Mule
 
xslt in mule
xslt in mulexslt in mule
xslt in mule
 
Converting with custom transformer
Converting with custom transformerConverting with custom transformer
Converting with custom transformer
 

Viewers also liked

Etude PwC/CSFI "Banking Banana Skins" sur les risques dans le secteur bancair...
Etude PwC/CSFI "Banking Banana Skins" sur les risques dans le secteur bancair...Etude PwC/CSFI "Banking Banana Skins" sur les risques dans le secteur bancair...
Etude PwC/CSFI "Banking Banana Skins" sur les risques dans le secteur bancair...PwC France
 
Internship Presentation
Internship PresentationInternship Presentation
Internship PresentationRivu Khoda
 
Is27001 la formation-iso-iec-27001-lead-auditor
Is27001 la formation-iso-iec-27001-lead-auditorIs27001 la formation-iso-iec-27001-lead-auditor
Is27001 la formation-iso-iec-27001-lead-auditorCERTyou Formation
 
Ranah afektif dalam pai
Ranah afektif  dalam paiRanah afektif  dalam pai
Ranah afektif dalam paisadirun
 
Payment Gateway by iPay88
Payment Gateway by iPay88Payment Gateway by iPay88
Payment Gateway by iPay88sitecmy
 
Lmcp 1532 pemanasan global
Lmcp 1532 pemanasan globalLmcp 1532 pemanasan global
Lmcp 1532 pemanasan globalraqib17
 
Day 1 Session 3: Cytron @ Selangor Smart City Intl Conference 2016
Day 1 Session 3: Cytron @ Selangor Smart City Intl Conference 2016Day 1 Session 3: Cytron @ Selangor Smart City Intl Conference 2016
Day 1 Session 3: Cytron @ Selangor Smart City Intl Conference 2016sitecmy
 
ENC Times-January 10,2017
ENC Times-January 10,2017ENC Times-January 10,2017
ENC Times-January 10,2017ENC
 

Viewers also liked (10)

Etude PwC/CSFI "Banking Banana Skins" sur les risques dans le secteur bancair...
Etude PwC/CSFI "Banking Banana Skins" sur les risques dans le secteur bancair...Etude PwC/CSFI "Banking Banana Skins" sur les risques dans le secteur bancair...
Etude PwC/CSFI "Banking Banana Skins" sur les risques dans le secteur bancair...
 
Internship Presentation
Internship PresentationInternship Presentation
Internship Presentation
 
Is27001 la formation-iso-iec-27001-lead-auditor
Is27001 la formation-iso-iec-27001-lead-auditorIs27001 la formation-iso-iec-27001-lead-auditor
Is27001 la formation-iso-iec-27001-lead-auditor
 
Belge1
Belge1Belge1
Belge1
 
Ranah afektif dalam pai
Ranah afektif  dalam paiRanah afektif  dalam pai
Ranah afektif dalam pai
 
Auto diagnostic-1
Auto diagnostic-1Auto diagnostic-1
Auto diagnostic-1
 
Payment Gateway by iPay88
Payment Gateway by iPay88Payment Gateway by iPay88
Payment Gateway by iPay88
 
Lmcp 1532 pemanasan global
Lmcp 1532 pemanasan globalLmcp 1532 pemanasan global
Lmcp 1532 pemanasan global
 
Day 1 Session 3: Cytron @ Selangor Smart City Intl Conference 2016
Day 1 Session 3: Cytron @ Selangor Smart City Intl Conference 2016Day 1 Session 3: Cytron @ Selangor Smart City Intl Conference 2016
Day 1 Session 3: Cytron @ Selangor Smart City Intl Conference 2016
 
ENC Times-January 10,2017
ENC Times-January 10,2017ENC Times-January 10,2017
ENC Times-January 10,2017
 

Similar to Xml toobjectesbtransform

Transformation xmltoobjectesb
Transformation xmltoobjectesbTransformation xmltoobjectesb
Transformation xmltoobjectesbGermano Barba
 
Xml to xml transformation
Xml to xml transformationXml to xml transformation
Xml to xml transformationSon Nguyen
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in muleDomenico Schiavone
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mulejaveed_mhd
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in muleMohammed625
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in muleDavide Rapacciuolo
 
Using xslt in mule
Using xslt in mule Using xslt in mule
Using xslt in mule javeed_mhd
 
Using xslt in mule
Using xslt in mule Using xslt in mule
Using xslt in mule Rajkattamuri
 
Using xslt in mule
Using  xslt in muleUsing  xslt in mule
Using xslt in muleKhan625
 
Using xslt in mule
Using xslt in mule Using xslt in mule
Using xslt in mule mdfkhan625
 
Xslt with mule
Xslt with muleXslt with mule
Xslt with muleSon Nguyen
 
Xslt in mule
Xslt in muleXslt in mule
Xslt in muleirfan1008
 
Transformation jsontojsonesb
Transformation jsontojsonesbTransformation jsontojsonesb
Transformation jsontojsonesbGermano Barba
 

Similar to Xml toobjectesbtransform (20)

Transformation xmltoobjectesb
Transformation xmltoobjectesbTransformation xmltoobjectesb
Transformation xmltoobjectesb
 
Xml to xml transformation
Xml to xml transformationXml to xml transformation
Xml to xml transformation
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
 
Xml transform
Xml transformXml transform
Xml transform
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
 
Using xslt in mule
Using xslt in mule Using xslt in mule
Using xslt in mule
 
Using xslt in mule
Using xslt in mule Using xslt in mule
Using xslt in mule
 
Using xslt in mule
Using  xslt in muleUsing  xslt in mule
Using xslt in mule
 
Using xslt in mule
Using xslt in mule Using xslt in mule
Using xslt in mule
 
Using xslt in mule
Using xslt in mule Using xslt in mule
Using xslt in mule
 
Xslt in mule
Xslt in muleXslt in mule
Xslt in mule
 
Xslt in mule
Xslt in muleXslt in mule
Xslt in mule
 
Xslt in mule
Xslt in muleXslt in mule
Xslt in mule
 
Xslt with mule
Xslt with muleXslt with mule
Xslt with mule
 
Xslt in mule
Xslt in muleXslt in mule
Xslt in mule
 
Transformation jsontojsonesb
Transformation jsontojsonesbTransformation jsontojsonesb
Transformation jsontojsonesb
 
Transformation jsontojsonesb
Transformation jsontojsonesbTransformation jsontojsonesb
Transformation jsontojsonesb
 
Using XSLT in Mule
Using XSLT in MuleUsing XSLT in Mule
Using XSLT in Mule
 

More from Domenico Schiavone

More from Domenico Schiavone (10)

Ws through raml
Ws through ramlWs through raml
Ws through raml
 
Simple service rest
Simple service restSimple service rest
Simple service rest
 
Symple io flow
Symple io flowSymple io flow
Symple io flow
 
Json to xml esb transformation
Json to xml esb transformationJson to xml esb transformation
Json to xml esb transformation
 
File tostring conversion
File tostring conversionFile tostring conversion
File tostring conversion
 
Payload and logger
Payload and loggerPayload and logger
Payload and logger
 
Csv to xml transformation
Csv to xml transformationCsv to xml transformation
Csv to xml transformation
 
Json to json esb transformation
Json to json esb transformationJson to json esb transformation
Json to json esb transformation
 
Simple interact between http and java components
Simple interact between http and java componentsSimple interact between http and java components
Simple interact between http and java components
 
Mule esb httpflow
Mule esb   httpflowMule esb   httpflow
Mule esb httpflow
 

Recently uploaded

tourism-management-srs_compress-software-engineering.pdf
tourism-management-srs_compress-software-engineering.pdftourism-management-srs_compress-software-engineering.pdf
tourism-management-srs_compress-software-engineering.pdfchess188chess188
 
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.elesangwon
 
Introduction to Artificial Intelligence: Intelligent Agents, State Space Sear...
Introduction to Artificial Intelligence: Intelligent Agents, State Space Sear...Introduction to Artificial Intelligence: Intelligent Agents, State Space Sear...
Introduction to Artificial Intelligence: Intelligent Agents, State Space Sear...shreenathji26
 
KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosVictor Morales
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Communityprachaibot
 
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSHigh Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSsandhya757531
 
priority interrupt computer organization
priority interrupt computer organizationpriority interrupt computer organization
priority interrupt computer organizationchnrketan
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Coursebim.edu.pl
 
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...IJAEMSJORNAL
 
STATE TRANSITION DIAGRAM in psoc subject
STATE TRANSITION DIAGRAM in psoc subjectSTATE TRANSITION DIAGRAM in psoc subject
STATE TRANSITION DIAGRAM in psoc subjectGayathriM270621
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTSneha Padhiar
 
Theory of Machine Notes / Lecture Material .pdf
Theory of Machine Notes / Lecture Material .pdfTheory of Machine Notes / Lecture Material .pdf
Theory of Machine Notes / Lecture Material .pdfShreyas Pandit
 
ADM100 Running Book for sap basis domain study
ADM100 Running Book for sap basis domain studyADM100 Running Book for sap basis domain study
ADM100 Running Book for sap basis domain studydhruvamdhruvil123
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionSneha Padhiar
 
Indian Tradition, Culture & Societies.pdf
Indian Tradition, Culture & Societies.pdfIndian Tradition, Culture & Societies.pdf
Indian Tradition, Culture & Societies.pdfalokitpathak01
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHSneha Padhiar
 
Module-1-Building Acoustics(Introduction)(Unit-1).pdf
Module-1-Building Acoustics(Introduction)(Unit-1).pdfModule-1-Building Acoustics(Introduction)(Unit-1).pdf
Module-1-Building Acoustics(Introduction)(Unit-1).pdfManish Kumar
 
AntColonyOptimizationManetNetworkAODV.pptx
AntColonyOptimizationManetNetworkAODV.pptxAntColonyOptimizationManetNetworkAODV.pptx
AntColonyOptimizationManetNetworkAODV.pptxLina Kadam
 

Recently uploaded (20)

tourism-management-srs_compress-software-engineering.pdf
tourism-management-srs_compress-software-engineering.pdftourism-management-srs_compress-software-engineering.pdf
tourism-management-srs_compress-software-engineering.pdf
 
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
 
Introduction to Artificial Intelligence: Intelligent Agents, State Space Sear...
Introduction to Artificial Intelligence: Intelligent Agents, State Space Sear...Introduction to Artificial Intelligence: Intelligent Agents, State Space Sear...
Introduction to Artificial Intelligence: Intelligent Agents, State Space Sear...
 
KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitos
 
Versatile Engineering Construction Firms
Versatile Engineering Construction FirmsVersatile Engineering Construction Firms
Versatile Engineering Construction Firms
 
Designing pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptxDesigning pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptx
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Community
 
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSHigh Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
 
priority interrupt computer organization
priority interrupt computer organizationpriority interrupt computer organization
priority interrupt computer organization
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Course
 
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...
 
STATE TRANSITION DIAGRAM in psoc subject
STATE TRANSITION DIAGRAM in psoc subjectSTATE TRANSITION DIAGRAM in psoc subject
STATE TRANSITION DIAGRAM in psoc subject
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
 
Theory of Machine Notes / Lecture Material .pdf
Theory of Machine Notes / Lecture Material .pdfTheory of Machine Notes / Lecture Material .pdf
Theory of Machine Notes / Lecture Material .pdf
 
ADM100 Running Book for sap basis domain study
ADM100 Running Book for sap basis domain studyADM100 Running Book for sap basis domain study
ADM100 Running Book for sap basis domain study
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based question
 
Indian Tradition, Culture & Societies.pdf
Indian Tradition, Culture & Societies.pdfIndian Tradition, Culture & Societies.pdf
Indian Tradition, Culture & Societies.pdf
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
 
Module-1-Building Acoustics(Introduction)(Unit-1).pdf
Module-1-Building Acoustics(Introduction)(Unit-1).pdfModule-1-Building Acoustics(Introduction)(Unit-1).pdf
Module-1-Building Acoustics(Introduction)(Unit-1).pdf
 
AntColonyOptimizationManetNetworkAODV.pptx
AntColonyOptimizationManetNetworkAODV.pptxAntColonyOptimizationManetNetworkAODV.pptx
AntColonyOptimizationManetNetworkAODV.pptx
 

Xml toobjectesbtransform