SlideShare a Scribd company logo
XML – Java Conversion
XML – Java Conversion in Dataweave Mule
Pre-requisites:
 Anypoint Studio
 Mule ESB Runtime 3.7
 xml input file.
Input XML File
<user>
<name>Max</name>
<lastName>Mule</lastName>
</user>
Mulexml java
<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
Mulexml 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;
}
}
Mulexml java

More Related Content

What's hot (8)

PPTX
Mule xml parsing
Muralidhar Gumma
 
PPTX
Mule xml parsing
Santhosh Ramagiri
 
ODP
Mule ESB SMTP Connector Integration
AnilKumar Etagowni
 
PPTX
Caching & validating
Son Nguyen
 
ODP
Box connector Mule ESB Integration
AnilKumar Etagowni
 
PPTX
Compress and decompress
Son Nguyen
 
PPTX
Mule esb :Data Weave
AnilKumar Etagowni
 
PPTX
How to get http query parameters in mule
Ramakrishna kapa
 
Mule xml parsing
Muralidhar Gumma
 
Mule xml parsing
Santhosh Ramagiri
 
Mule ESB SMTP Connector Integration
AnilKumar Etagowni
 
Caching & validating
Son Nguyen
 
Box connector Mule ESB Integration
AnilKumar Etagowni
 
Compress and decompress
Son Nguyen
 
Mule esb :Data Weave
AnilKumar Etagowni
 
How to get http query parameters in mule
Ramakrishna kapa
 

Similar to Mulexml java (20)

PPTX
Mule XML java sample
Vishnukanth Rachineni
 
PPTX
Mule Esb Data Weave
Mohammed246
 
PPTX
Mule esb DataWeave
Praneethchampion
 
PPTX
Mule esb dataweave
Rajkattamuri
 
PPTX
Mule esb Data Weave
F K
 
PPTX
Mule esb:DataWeave
AbdulImrankhan7
 
PPTX
Mule esb
Khan625
 
PPTX
Mule esb
Sunil Komarapu
 
PPTX
Mule esb
mdfkhan625
 
PPTX
Mule esb
Hasan Syed
 
PPTX
Mule esb
javeed_mhd
 
PPTX
Mule esb :Data Weave
Krishnakanth Goud
 
PPTX
Transformation xmltoobjectesb
Davide Rapacciuolo
 
PPTX
Transformation xmltoobjectesb
Antonio Pellegrino
 
PPTX
Transformation xmltoobjectesb
Germano Barba
 
PPTX
Transformation xmltoobjectesb
Davide Rapacciuolo
 
PPTX
Muleesbobjecttojson
Davide Rapacciuolo
 
PPTX
Dataweave nagarjuna
Nagarjuna reddy
 
PPTX
Mule esb object_to_json
Davide Rapacciuolo
 
PPTX
Dataweave by nagarjuna
Nagarjuna reddy
 
Mule XML java sample
Vishnukanth Rachineni
 
Mule Esb Data Weave
Mohammed246
 
Mule esb DataWeave
Praneethchampion
 
Mule esb dataweave
Rajkattamuri
 
Mule esb Data Weave
F K
 
Mule esb:DataWeave
AbdulImrankhan7
 
Mule esb
Khan625
 
Mule esb
Sunil Komarapu
 
Mule esb
mdfkhan625
 
Mule esb
Hasan Syed
 
Mule esb
javeed_mhd
 
Mule esb :Data Weave
Krishnakanth Goud
 
Transformation xmltoobjectesb
Davide Rapacciuolo
 
Transformation xmltoobjectesb
Antonio Pellegrino
 
Transformation xmltoobjectesb
Germano Barba
 
Transformation xmltoobjectesb
Davide Rapacciuolo
 
Muleesbobjecttojson
Davide Rapacciuolo
 
Dataweave nagarjuna
Nagarjuna reddy
 
Mule esb object_to_json
Davide Rapacciuolo
 
Dataweave by nagarjuna
Nagarjuna reddy
 
Ad

More from Vishnukanth Rachineni (11)

PPTX
Mule debugging-sample
Vishnukanth Rachineni
 
PPTX
Mule connectors-session1
Vishnukanth Rachineni
 
PPTX
Munit-testing-sample
Vishnukanth Rachineni
 
PPTX
Cache scope-example
Vishnukanth Rachineni
 
PPTX
Mule copybook tutorial
Vishnukanth Rachineni
 
PPTX
Mule flatfile-json example
Vishnukanth Rachineni
 
PPTX
Mule copy book-tutorial
Vishnukanth Rachineni
 
PPTX
Munit testing sample
Vishnukanth Rachineni
 
PPTX
Mulesoft devkit connector
Vishnukanth Rachineni
 
PPTX
Cache scope sample
Vishnukanth Rachineni
 
PPTX
Polling with watermark
Vishnukanth Rachineni
 
Mule debugging-sample
Vishnukanth Rachineni
 
Mule connectors-session1
Vishnukanth Rachineni
 
Munit-testing-sample
Vishnukanth Rachineni
 
Cache scope-example
Vishnukanth Rachineni
 
Mule copybook tutorial
Vishnukanth Rachineni
 
Mule flatfile-json example
Vishnukanth Rachineni
 
Mule copy book-tutorial
Vishnukanth Rachineni
 
Munit testing sample
Vishnukanth Rachineni
 
Mulesoft devkit connector
Vishnukanth Rachineni
 
Cache scope sample
Vishnukanth Rachineni
 
Polling with watermark
Vishnukanth Rachineni
 
Ad

Recently uploaded (20)

PDF
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
PDF
ArcGIS Utility Network Migration - The Hunter Water Story
Safe Software
 
PDF
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
PDF
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
PDF
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
PDF
LLM Search Readiness Audit - Dentsu x SEO Square - June 2025.pdf
Nick Samuel
 
PPTX
reInforce 2025 Lightning Talk - Scott Francis.pptx
ScottFrancis51
 
PDF
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 
PDF
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
PDF
UiPath Agentic AI ile Akıllı Otomasyonun Yeni Çağı
UiPathCommunity
 
PPTX
Practical Applications of AI in Local Government
OnBoard
 
PDF
Python Conference Singapore - 19 Jun 2025
ninefyi
 
DOCX
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
ScyllaDB
 
PDF
Why aren't you using FME Flow's CPU Time?
Safe Software
 
PPTX
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
PDF
My Journey from CAD to BIM: A True Underdog Story
Safe Software
 
PDF
Optimizing the trajectory of a wheel loader working in short loading cycles
Reno Filla
 
PDF
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
ArcGIS Utility Network Migration - The Hunter Water Story
Safe Software
 
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
LLM Search Readiness Audit - Dentsu x SEO Square - June 2025.pdf
Nick Samuel
 
reInforce 2025 Lightning Talk - Scott Francis.pptx
ScottFrancis51
 
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
UiPath Agentic AI ile Akıllı Otomasyonun Yeni Çağı
UiPathCommunity
 
Practical Applications of AI in Local Government
OnBoard
 
Python Conference Singapore - 19 Jun 2025
ninefyi
 
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
ScyllaDB
 
Why aren't you using FME Flow's CPU Time?
Safe Software
 
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
My Journey from CAD to BIM: A True Underdog Story
Safe Software
 
Optimizing the trajectory of a wheel loader working in short loading cycles
Reno Filla
 
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 

Mulexml java

  • 1. XML – Java Conversion
  • 2. XML – Java Conversion in Dataweave Mule Pre-requisites:  Anypoint Studio  Mule ESB Runtime 3.7  xml input file. Input XML File <user> <name>Max</name> <lastName>Mule</lastName> </user>
  • 4. <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. 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; } }