SlideShare a Scribd company logo
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>
<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
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

Mule esb
Mule esbMule esb
Mule esb
Khan625
 
Splitting with mule part2
Splitting with mule part2Splitting with mule part2
Splitting with mule part2
Anirban Sen Chowdhary
 
Spring introduction
Spring introductionSpring introduction
Spring introduction
AnilKumar Etagowni
 
Junit in mule demo
Junit in mule demo Junit in mule demo
Junit in mule demo
javeed_mhd
 
Mule esb :Data Weave
Mule esb :Data WeaveMule esb :Data Weave
Mule esb :Data Weave
AnilKumar Etagowni
 
Mulesoft Using Groovy Component
Mulesoft Using Groovy ComponentMulesoft Using Groovy Component
Mulesoft Using Groovy Component
kumar gaurav
 
Expression filter in Mule
Expression filter in MuleExpression filter in Mule
Expression filter in Mule
Khan625
 
Mule esb add logger to existing flow
Mule esb add logger to existing flowMule esb add logger to existing flow
Mule esb add logger to existing flow
Germano Barba
 
Anypoint connectorfor ibm as 400
Anypoint connectorfor ibm as 400Anypoint connectorfor ibm as 400
Anypoint connectorfor ibm as 400
himajareddys
 
Box connector Mule ESB Integration
Box connector Mule ESB IntegrationBox connector Mule ESB Integration
Box connector Mule ESB Integration
AnilKumar Etagowni
 
How to get http query parameters in mule
How to get http query parameters in muleHow to get http query parameters in mule
How to get http query parameters in mule
Ramakrishna kapa
 
MuleSoft ESB Message Enricher
MuleSoft ESB Message Enricher MuleSoft ESB Message Enricher
MuleSoft ESB Message Enricher
akashdprajapati
 

What's hot (12)

Mule esb
Mule esbMule esb
Mule esb
 
Splitting with mule part2
Splitting with mule part2Splitting with mule part2
Splitting with mule part2
 
Spring introduction
Spring introductionSpring introduction
Spring introduction
 
Junit in mule demo
Junit in mule demo Junit in mule demo
Junit in mule demo
 
Mule esb :Data Weave
Mule esb :Data WeaveMule esb :Data Weave
Mule esb :Data Weave
 
Mulesoft Using Groovy Component
Mulesoft Using Groovy ComponentMulesoft Using Groovy Component
Mulesoft Using Groovy Component
 
Expression filter in Mule
Expression filter in MuleExpression filter in Mule
Expression filter in Mule
 
Mule esb add logger to existing flow
Mule esb add logger to existing flowMule esb add logger to existing flow
Mule esb add logger to existing flow
 
Anypoint connectorfor ibm as 400
Anypoint connectorfor ibm as 400Anypoint connectorfor ibm as 400
Anypoint connectorfor ibm as 400
 
Box connector Mule ESB Integration
Box connector Mule ESB IntegrationBox connector Mule ESB Integration
Box connector Mule ESB Integration
 
How to get http query parameters in mule
How to get http query parameters in muleHow to get http query parameters in mule
How to get http query parameters in mule
 
MuleSoft ESB Message Enricher
MuleSoft ESB Message Enricher MuleSoft ESB Message Enricher
MuleSoft ESB Message Enricher
 

Similar to Mule Esb Data Weave

Mule esb
Mule esbMule esb
Mule esb
javeed_mhd
 
Mule esb DataWeave
Mule esb DataWeaveMule esb DataWeave
Mule esb DataWeave
Praneethchampion
 
Mule esb Data Weave
Mule esb Data WeaveMule esb Data Weave
Mule esb Data Weave
F K
 
Mule esb dataweave
Mule esb dataweaveMule esb dataweave
Mule esb dataweave
Rajkattamuri
 
Mule esb
Mule esbMule esb
Mule esb
Sunil Komarapu
 
Mule esb
Mule esbMule esb
Mule esb
Hasan Syed
 
Mule esb :Data Weave
Mule esb :Data WeaveMule esb :Data Weave
Mule esb :Data Weave
Krishnakanth Goud
 
Mule esb:DataWeave
Mule esb:DataWeaveMule esb:DataWeave
Mule esb:DataWeave
AbdulImrankhan7
 
Mule esb
Mule esb Mule esb
Mule esb
mdfkhan625
 
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
 
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
 
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
 

Similar to Mule Esb Data Weave (20)

Mule esb
Mule esbMule esb
Mule esb
 
Mule esb DataWeave
Mule esb DataWeaveMule esb DataWeave
Mule esb DataWeave
 
Mule esb Data Weave
Mule esb Data WeaveMule esb Data Weave
Mule esb Data Weave
 
Mule esb dataweave
Mule esb dataweaveMule esb dataweave
Mule esb dataweave
 
Mule esb
Mule esbMule esb
Mule esb
 
Mule esb
Mule esbMule esb
Mule esb
 
Mule esb :Data Weave
Mule esb :Data WeaveMule esb :Data Weave
Mule esb :Data Weave
 
Mule esb:DataWeave
Mule esb:DataWeaveMule esb:DataWeave
Mule esb:DataWeave
 
Mule esb
Mule esb Mule esb
Mule esb
 
Mulexml java
Mulexml javaMulexml java
Mulexml java
 
Mule XML java sample
Mule XML java sampleMule XML java sample
Mule XML java sample
 
Mule xml java
Mule xml javaMule xml java
Mule xml java
 
Mule xml java
Mule xml javaMule xml java
Mule xml java
 
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
 

More from Mohammed246

Expression filter in Mule
Expression filter in MuleExpression filter in Mule
Expression filter in Mule
Mohammed246
 
Anypoint data gateway
Anypoint data gatewayAnypoint data gateway
Anypoint data gateway
Mohammed246
 
Oracle connector
Oracle connectorOracle connector
Oracle connector
Mohammed246
 
Api Layer
Api LayerApi Layer
Api Layer
Mohammed246
 
Maven part 3
Maven part 3Maven part 3
Maven part 3
Mohammed246
 
Maven part 2
Maven part 2Maven part 2
Maven part 2
Mohammed246
 
Maven part 1
Maven part 1Maven part 1
Maven part 1
Mohammed246
 
Jenkins part 3
Jenkins part 3Jenkins part 3
Jenkins part 3
Mohammed246
 
Jenkins part 2
Jenkins part 2Jenkins part 2
Jenkins part 2
Mohammed246
 
Jenkins Part 1
Jenkins Part 1Jenkins Part 1
Jenkins Part 1
Mohammed246
 
jBPM Connector
jBPM ConnectorjBPM Connector
jBPM Connector
Mohammed246
 
Java for beginners
Java for beginnersJava for beginners
Java for beginners
Mohammed246
 
Scatter gather
Scatter gather Scatter gather
Scatter gather
Mohammed246
 
Velocity in Mule
Velocity in MuleVelocity in Mule
Velocity in Mule
Mohammed246
 
Rabbit Mq in Mule
Rabbit Mq in MuleRabbit Mq in Mule
Rabbit Mq in Mule
Mohammed246
 
Quartz in Mule
Quartz in MuleQuartz in Mule
Quartz in Mule
Mohammed246
 
Simple web service vm
Simple web service vmSimple web service vm
Simple web service vm
Mohammed246
 
Validate soap request in mule
Validate soap request in muleValidate soap request in mule
Validate soap request in mule
Mohammed246
 
Web service vm in mule
Web service vm in muleWeb service vm in mule
Web service vm in mule
Mohammed246
 
Xslt in mule
Xslt in muleXslt in mule
Xslt in mule
Mohammed246
 

More from Mohammed246 (20)

Expression filter in Mule
Expression filter in MuleExpression filter in Mule
Expression filter in Mule
 
Anypoint data gateway
Anypoint data gatewayAnypoint data gateway
Anypoint data gateway
 
Oracle connector
Oracle connectorOracle connector
Oracle connector
 
Api Layer
Api LayerApi Layer
Api Layer
 
Maven part 3
Maven part 3Maven part 3
Maven part 3
 
Maven part 2
Maven part 2Maven part 2
Maven part 2
 
Maven part 1
Maven part 1Maven part 1
Maven part 1
 
Jenkins part 3
Jenkins part 3Jenkins part 3
Jenkins part 3
 
Jenkins part 2
Jenkins part 2Jenkins part 2
Jenkins part 2
 
Jenkins Part 1
Jenkins Part 1Jenkins Part 1
Jenkins Part 1
 
jBPM Connector
jBPM ConnectorjBPM Connector
jBPM Connector
 
Java for beginners
Java for beginnersJava for beginners
Java for beginners
 
Scatter gather
Scatter gather Scatter gather
Scatter gather
 
Velocity in Mule
Velocity in MuleVelocity in Mule
Velocity in Mule
 
Rabbit Mq in Mule
Rabbit Mq in MuleRabbit Mq in Mule
Rabbit Mq in Mule
 
Quartz in Mule
Quartz in MuleQuartz in Mule
Quartz in Mule
 
Simple web service vm
Simple web service vmSimple web service vm
Simple web service vm
 
Validate soap request in mule
Validate soap request in muleValidate soap request in mule
Validate soap request in mule
 
Web service vm in mule
Web service vm in muleWeb service vm in mule
Web service vm in mule
 
Xslt in mule
Xslt in muleXslt in mule
Xslt in mule
 

Recently uploaded

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
 
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
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
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
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
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
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
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
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
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...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
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
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 

Mule Esb Data Weave

  • 1. 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>
  • 3.
  • 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
  • 6.
  • 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; } }