SlideShare a Scribd company logo
MULE ESB: DATA WEAVE
PARSING XML PAYLOAD
BY MURALIDHAR. GUMMA
XML – JAVA CONVERSION IN DATAWEAVE MULE
PRE-REQUISITES:
• ANYPOINT STUDIO
• MULE ESB RUNTIME 3.8
• XML INPUT FILE.
INPUT XML FILE
<user>
<name>Max</name>
<lastName>Mule</lastName>
</user>
MULE FLOW
CONFIG.XML
<http:listener-config name="HTTP_Listener_Configuration"
host="0.0.0.0" port="8081" doc:name="HTTP Listener
Configuration"/>
<flow name="parsexmlFlow">
<http:listener config-
ref="HTTP_Listener_Configuration" path="/"
doc:name="HTTP"/>
<dw:transform-message metadata:id="3b459816-
cc8f-46aa-9f2f-34372d3b506c" doc:name="Transform
Message">
<dw:input-payload
doc:sample="D:MuraliSampleXML.xml"
mimeType="application/xml"/>
<dw:set-payload><![CDATA[%dw 1.0
%output application/java
---
{
firstname:payload.Details.user.name,
LastName:payload.Details.user.lastName
}]]></dw:set-payload>
</dw:transform-message>
<byte-array-to-string-transformer doc:name="Byte
IN THE TRANSFORM CODE, JUST USE THE BELOW SIMPLE
LOGIC.
THE XML DATA WILL COME TO THE TRANSFORM
MESSAGE AS PAYLOAD. NOW CONSIDER PAYLOAD AS A
STATIC CLASS IN JAVA AND FOLLOW THE BELOW CODE
TO GET THE WHATEVER THE DATA YOU NEED TO
RETRIEVE FROM AN XML TAG.
THE VALUES ARE ASSIGNED TO VARIABLES.
{
FIRSTNAME: PAYLOAD.USER.NAME,
LASTNAME: PAYLOAD.USER.LASTNAME
}
DATAWEAVE
Test this service from a browser or by using the postman you can find
the desired output
THANK Q

More Related Content

PPTX
Mule xml parsing
PPTX
Mule xml java
PPTX
Mule xml java
PPTX
Message enricher in mule
PPTX
Caching and invalidating with managed store
 
PPTX
Caching and invalidating with managed store
ODP
Mule ESB SMTP Connector Integration
PPTX
Mule esb :Data Weave
Mule xml parsing
Mule xml java
Mule xml java
Message enricher in mule
Caching and invalidating with managed store
 
Caching and invalidating with managed store
Mule ESB SMTP Connector Integration
Mule esb :Data Weave

What's hot (9)

PPTX
Php basics
ODP
Database Connection With Mysql
PPTX
Cake PHP 3 Presentaion
PPTX
Mapping and listing with mule
ODP
Mysql proxy presentation_yahoo
PPTX
System performance tuning
PPTX
Mapping and listing in mule
PDF
CakePHP 3
PPTX
Mapping and listing with mule
Php basics
Database Connection With Mysql
Cake PHP 3 Presentaion
Mapping and listing with mule
Mysql proxy presentation_yahoo
System performance tuning
Mapping and listing in mule
CakePHP 3
Mapping and listing with mule
Ad

Similar to Mule xml parsing (20)

PPTX
Mule XML java sample
PPTX
Mulexml java
PPTX
Mulesoft xml to Java Conversion
PPTX
Mule esb Data Weave
 
PPTX
Mule esb
PPTX
Mule esb:DataWeave
PPTX
Mule esb dataweave
PPTX
Mule esb :Data Weave
PPTX
Mule esb
PPTX
Mule esb
PPTX
Mule esb DataWeave
PPTX
Mule esb
PPTX
Mule esb
PPTX
Mule Esb Data Weave
PPTX
How to get http query parameters in mule
PPTX
Caching & validating
PPT
Anypoint connectorfor ibm as 400
PPTX
Caching and invalidating with managed store
PPTX
Caching and invalidating with managed store
PPTX
Caching and invalidating with managed store
Mule XML java sample
Mulexml java
Mulesoft xml to Java Conversion
Mule esb Data Weave
 
Mule esb
Mule esb:DataWeave
Mule esb dataweave
Mule esb :Data Weave
Mule esb
Mule esb
Mule esb DataWeave
Mule esb
Mule esb
Mule Esb Data Weave
How to get http query parameters in mule
Caching & validating
Anypoint connectorfor ibm as 400
Caching and invalidating with managed store
Caching and invalidating with managed store
Caching and invalidating with managed store
Ad

Recently uploaded (20)

PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Empathic Computing: Creating Shared Understanding
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Encapsulation theory and applications.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Spectroscopy.pptx food analysis technology
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
cuic standard and advanced reporting.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Network Security Unit 5.pdf for BCA BBA.
Empathic Computing: Creating Shared Understanding
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Programs and apps: productivity, graphics, security and other tools
Reach Out and Touch Someone: Haptics and Empathic Computing
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Spectral efficient network and resource selection model in 5G networks
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Unlocking AI with Model Context Protocol (MCP)
Encapsulation theory and applications.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Understanding_Digital_Forensics_Presentation.pptx
Spectroscopy.pptx food analysis technology
Per capita expenditure prediction using model stacking based on satellite ima...
cuic standard and advanced reporting.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton

Mule xml parsing

  • 1. MULE ESB: DATA WEAVE PARSING XML PAYLOAD BY MURALIDHAR. GUMMA
  • 2. XML – JAVA CONVERSION IN DATAWEAVE MULE PRE-REQUISITES: • ANYPOINT STUDIO • MULE ESB RUNTIME 3.8 • XML INPUT FILE. INPUT XML FILE <user> <name>Max</name> <lastName>Mule</lastName> </user>
  • 4. CONFIG.XML <http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/> <flow name="parsexmlFlow"> <http:listener config- ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/> <dw:transform-message metadata:id="3b459816- cc8f-46aa-9f2f-34372d3b506c" doc:name="Transform Message"> <dw:input-payload doc:sample="D:MuraliSampleXML.xml" mimeType="application/xml"/> <dw:set-payload><![CDATA[%dw 1.0 %output application/java --- { firstname:payload.Details.user.name, LastName:payload.Details.user.lastName }]]></dw:set-payload> </dw:transform-message> <byte-array-to-string-transformer doc:name="Byte
  • 5. IN THE TRANSFORM CODE, JUST USE THE BELOW SIMPLE LOGIC. THE XML DATA WILL COME TO THE TRANSFORM MESSAGE AS PAYLOAD. NOW CONSIDER PAYLOAD AS A STATIC CLASS IN JAVA AND FOLLOW THE BELOW CODE TO GET THE WHATEVER THE DATA YOU NEED TO RETRIEVE FROM AN XML TAG. THE VALUES ARE ASSIGNED TO VARIABLES. { FIRSTNAME: PAYLOAD.USER.NAME, LASTNAME: PAYLOAD.USER.LASTNAME }
  • 6. DATAWEAVE Test this service from a browser or by using the postman you can find the desired output