I am trying to develop a mule flow which takes a xml in the form of a string from a JMS queue and converts it into a POJO. I am using JAXB annotations to define the mappings between the xml and the class attributes. Below is the sample xml that is received on the JMS queue as a string.
<FCUBS_NOTIFICATION xmlns="http://fcubs.ofss.com/notify/NOTIF_UP_TRANSACTION">
<FCUBS_NOTIF_HEADER>
<MSGID>9132820000357947</MSGID>
</FCUBS_NOTIF_HEADER>
</FCUBS_NOTIFICATION>
My POJO class is as below:
package com.bean;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
#XmlRootElement(name="FCUBS_NOTIFICATION")
public class Notification {
private String MSGID;
public String getMSGID() {
return MSGID;
}
#XmlElement(name="MSGID")
public void setMSGID(String mSGID) {
MSGID = mSGID;
}
}
I have a jaxb.index file in the com.bean package consisting of only one bean
Notification
My mule flow config file is as below:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:quartz="http://www.mulesoft.org/schema/mule/quartz" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" 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" version="EE-3.4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="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://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/quartz http://www.mulesoft.org/schema/mule/quartz/current/mule-quartz.xsd">
<spring:beans>
<spring:bean name="myJaxb" class="javax.xml.bind.JAXBContext" factory-method="newInstance">
<!-- colon-separated (:) list of package names where JAXB classes exist -->
<spring:constructor-arg value="com.bean"/>
</spring:bean>
</spring:beans>
<jms:activemq-connector name="Active_MQ" specification="1.1" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ"/>
<flow name="JMS-exampleFlow1" doc:name="JMS-exampleFlow1">
<jms:inbound-endpoint queue="NotificationQueue" connector-ref="Active_MQ" doc:name="JMS"/>
<logger message="Payload after picking message from queue is #[message.payload]" level="INFO" doc:name="Logger"/>
<mulexml:xml-to-object-transformer returnClass="com.bean.Notification" doc:name="XML to Object"/>
<logger level="INFO" doc:name="Logger" message="Payload after xml to object transformation is #[message.payload]"/>
</flow>
</mule>
I am using Mule Studio for development and below is the error I get -
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Started app 'jms-example' +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
INFO 2013-11-27 16:19:44,225 [[jms-example].JMS-exampleFlow1.stage1.02] org.mule.api.processor.LoggerMessageProcessor: Payload after picking message from queue is <FCUBS_NOTIFICATION xmlns="http://fcubs.ofss.com/notify/NOTIF_UP_TRANSACTION"><FCUBS_NOTIF_HEADER><MSGID>9132820000357947</MSGID></FCUBS_NOTIF_HEADER></FCUBS_NOTIFICATION>
ERROR 2013-11-27 16:19:44,227 [[jms-example].JMS-exampleFlow1.stage1.02] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : FCUBS_NOTIFICATION (com.thoughtworks.xstream.mapper.CannotResolveClassException). Message payload is of type: String
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. FCUBS_NOTIFICATION (com.thoughtworks.xstream.mapper.CannotResolveClassException)
com.thoughtworks.xstream.mapper.DefaultMapper:56 (null)
2. FCUBS_NOTIFICATION (com.thoughtworks.xstream.mapper.CannotResolveClassException). Message payload is of type: String (org.mule.api.transformer.TransformerMessagingException)
org.mule.transformer.AbstractTransformer:139 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerMessagingException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
com.thoughtworks.xstream.mapper.CannotResolveClassException: FCUBS_NOTIFICATION
at com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:56)
at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
at com.thoughtworks.xstream.mapper.DynamicProxyMapper.realClass(DynamicProxyMapper.java:55)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
Is there anything I am missing here ?
Thanks in advance.
The serialization/deserialization in the xml-to-object-transformer is done through XStream, so JAXB won't matter at that point.
You would need an alias:
<mulexml:xml-to-object-transformer returnClass="com.bean.Notification" doc:name="XML to Object">
<mulexml:alias name="FCUBS_NOTIFICATION" class="com.bean.Notification"/>
</mulexml:xml-to-object-transformer>
Related
I am using Anypoint Studio 6.1 and Mule 3.8.1 and want to return an Exception message with the "\n" returned as a new line. I am trying to use System.getProperty("line.separator") but the "\n" still appear in the message as text and not a new line.
How can I get this to work?
XML Test Flow:
<?xml version="1.0" encoding="UTF-8"?>
<mule 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.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://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<flow name="tempflowFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/test-flow" allowedMethods="GET" doc:name="HTTP"/>
<set-payload value="{
"Exception": {
"status": -1,
"description": "\nJson content is not compliant with schema\ncom.github.fge.jsonschema.core.report.ListProcessingReport: failure\n--- BEGIN MESSAGES ---\nerror: object has too many properties (found 2 but schema requires at most 1)\n level: \"error\"\n schema: {\"loadingURI\":\"file:/C:/temp.json#\",\"pointer\":\"/properties/field1\"}\n instance: {\"pointer\":\"/field1\"}\n domain: \"validation\"\n keyword: \"maxProperties\"\n found: 2\n required: 1\n--- END MESSAGES ---\n (org.mule.module.json.validation.JsonSchemaValidationException)."
}
}" encoding="UTF-8" mimeType="application/json" doc:name="Set Payload"/>
<logger message="#[payload.replace("\n", System.getProperty('line.separator'))]" level="INFO" doc:name="Logger"/>
<set-payload value="#[payload.replace("\n", System.getProperty('line.separator'))]" encoding="UTF-8" mimeType="application/json" doc:name="Set Payload"/>
</flow>
</mule>
Thanks
Looks like you need to escape the newline character. Also, use single quotes (') instead of double quotes (") inside MEL expression.
<logger message="#[payload.replace('\\n', System.getProperty('line.separator'))]" level="INFO"
doc:name="Logger" />
<set-payload value="#[payload.replace('\\n', System.getProperty('line.separator'))]" encoding="UTF-8"
mimeType="application/json" doc:name="Set Payload" />
Above code seems to work:
INFO 2017-02-09 18:03:09,349 [Mule.app.deployer.monitor.1.thread.1] org.mule.module.launcher.MuleDeploymentService:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Started app 'test2' +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
INFO 2017-02-09 18:03:17,280 [[test2].HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: { "Exception": { "status": -1, "description": "
Json content is not compliant with schema
com.github.fge.jsonschema.core.report.ListProcessingReport: failure
--- BEGIN MESSAGES ---
error: object has too many properties (found 2 but schema requires at most 1)
level: \"error\"
schema: {\"loadingURI\":\"file:/C:/temp.json#\",\"pointer\":\"/properties/field1\"}
instance: {\"pointer\":\"/field1\"}
domain: \"validation\"
keyword: \"maxProperties\"
found: 2
required: 1
--- END MESSAGES ---
(org.mule.module.json.validation.JsonSchemaValidationException)." } }
Mule log
I have a JSON to object transformer that follows the datamapper in a Mule 3.6 workflow and found that the JSON to object transformer removes trailing zero in decimal fields so 11.00 becomes 11.0.
How can I prevent the JSON to Object transformer from dropping the last decimal place if it is a zero and enforce 2 decimal places so it will return 11.00 as this is a requirement?
An example flow showing the problem:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:data-mapper="http://www.mulesoft.org/schema/mule/ee/data-mapper" 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" version="EE-3.6.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="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://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/ee/data-mapper http://www.mulesoft.org/schema/mule/ee/data-mapper/current/mule-data-mapper.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd">
<data-mapper:config name="CSV_To_JSON" transformationGraphPath="csv_to_json.grf" doc:name="CSV_To_JSON"/>
<flow name="deimal-point-flowFlow">
<file:inbound-endpoint path="${file.unprocessed.location}" moveToPattern="#[message.inboundProperties['originalFilename']]" moveToDirectory="${file.unprocessed.location}" responseTimeout="10000" doc:name="File">
<file:filename-regex-filter pattern="test.csv" caseSensitive="true"/>
</file:inbound-endpoint>
<data-mapper:transform config-ref="CSV_To_JSON" doc:name="CSV To JSON"/>
<json:json-to-object-transformer returnClass="java.util.Map" doc:name="JSON to Object"/>
<json:object-to-json-transformer returnClass="java.lang.String" mimeType="application/json" doc:name="Object to JSON"/>
<logger level="INFO" doc:name="Logger"/>
</flow>
</mule>
The test.csv file looks like this:
DeptID,Dept,Staff
5LL/A,Human Resources,4.00
You could create your own custom function that rounds your data, that can be used by datamapper. First add a configuration on your flow, to extend the expression language.
<configuration doc:name="Configuration">
<expression-language autoResolveVariables="true">
<import name="dataformatter" class="com.utils.DataFormatter" />
<global-functions >
def (value, places) { return dataformatter.round(value, places) }
</global-functions>
</expression-language>
</configuration>
//package com.utils.DataFormatter
public static double round(double value, int places) {
if (places < 0) throw new IllegalArgumentException();
BigDecimal bd = new BigDecimal(value);
bd = bd.setScale(places, RoundingMode.HALF_UP);
return bd.doubleValue();
}
From that code you could directly call the function and round it properly.
Hope this helps.
I'm tying to build a mule flow which get data from a db, builds an object and then fires a drools rule. My problem is initialFacts-ref="#[payload.MapObject]" cannot be resolved. On deployment I'm getting 'No bean named '#[payload.MapObject]' is defined' How can I get the payload object into the rule as a fact?
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:db="http://www.mulesoft.org/schema/mule/db"
xmlns:json="http://www.mulesoft.org/schema/mule/json"
xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:jms="http://www.mulesoft.org/schema/mule/jms"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:bpm="http://www.mulesoft.org/schema/mule/bpm"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/db
http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd
http://www.mulesoft.org/schema/mule/json
http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
http://www.mulesoft.org/schema/mule/vm
http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd
http://www.mulesoft.org/schema/mule/jms
http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd
http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/bpm
http://www.mulesoft.org/schema/mule/bpm/3.2/mule-bpm.xsd
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/tracking
http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/ee/dw
http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd">
<bpm:drools />
<flow name="myFlow" >
<http:listener config-ref="HTTP_Listener_Configuration" path="/myflow" doc:name="HTTP">
<http:response-builder>
<http:header headerName="Access-Control-Allow-Origin" value="*"/>
</http:response-builder>
</http:listener>
<db:select config-ref="MySQL_Finance" doc:name="Database">
<db:parameterized-query><![CDATA[SELECT * FROM myTable WHERE ID = #[message.inboundProperties.'http.query.params'.ID]]]></db:parameterized-query>
</db:select>
<response>
<json:object-to-json-transformer doc:name="Object to JSON"/>
</response>
<component class="org.mule.transformers.myMapping" doc:name="myMapping"/>
<bpm:rules doc:name="myRule" rulesDefinition="src/main/resources/rules/myRule.drl" initialFacts-ref="#[payload.MapObject]"/>
</flow>
</mule>
package org.mule.transformers;
import org.mule.api.MuleMessage;
import org.mule.api.transformer.TransformerException;
import org.mule.transformer.AbstractMessageTransformer;
public class myMapping extends AbstractMessageTransformer {
/**
* #param args
*/
public Object transformMessage(MuleMessage message, String outputEncoding) throws TransformerException {
Object myMapping = null;
if(message != null){
myMapping = message.getPayload();
}
return myMapping;
}
}
initialFacts-ref refers to an existing Spring bean so you can't use a MEL expression as you try to. It is used for loading initial facts so that's why it's static.
In your case, it seems you just want to process the current message in a rule, not provide an initial set of facts to the rules engine. In this case, there's nothing to do. The current message payload is passed to Drools so you can access it directly.
I am setting some outbound properties in the message prior to sending the payload to a JMS queue, and I wanted to test that those properties are properly set in the message prior to sending it out to the JMS queue.
I thought about using an MUnit Spy before the JMS Outbound Endpoint, but the spy is only capable of validating the session properties, invocation properties, and the payload. Is there another way that I can achieve this using MUnit XML?
I created a mini mule project to illustrate the issue further. The code is provided below. Essentially it is just a flow that calls a sub-flow that sets outbound properties in a mule message, and the MUnit has a spy that asserts that the outbound properties are set in the mule message after the sub-flow is called. However, the MUnit Spy doesn't seem to have access to the mule outbound properties. I would like to know if there is another way around this at this time. I know that the docs specify that the spy is only capable of validating session and invocation properties, and the payload at this time. Any suggestion is welcome.
Sandbox.xml - Main Mule File
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" 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.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://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
<flow name="outbound-props-flow">
<flow-ref name="outbound-props-sub-flow" doc:name="Call outbound-props-sub-flow"/>
<logger message="#[message]" level="INFO" doc:name="Log Message"/>
</flow>
<sub-flow name="outbound-props-sub-flow">
<set-property propertyName="outbound-prop-1" value="test1" doc:name="set-outbound-prop-1"/>
<set-property propertyName="outbount-prop-2" value="test2" doc:name="set-outbound-prop-2"/>
</sub-flow>
</mule>
MUnit File - Testing the Main Flow
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:mock="http://www.mulesoft.org/schema/mule/mock" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:munit="http://www.mulesoft.org/schema/mule/munit" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/munit http://www.mulesoft.org/schema/mule/munit/current/mule-munit.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://www.mulesoft.org/schema/mule/mock http://www.mulesoft.org/schema/mule/mock/current/mule-mock.xsd">
<munit:config name="munit" doc:name="MUnit configuration"/>
<spring:beans>
<spring:import resource="classpath:sandbox.xml"/>
</spring:beans>
<munit:test name="outbound-props-flow-outbound-props-flowTest" description="Test">
<mock:spy messageProcessor="mule:sub-flow" doc:name="Spy">
<mock:with-attributes>
<mock:with-attribute name="name" whereValue="#[matchContains('outbound-props-sub-flow')]"/>
</mock:with-attributes>
<mock:assertions-after-call>
<logger message="Message in SPY Module: #[message]" level="INFO" doc:name="Log Message in Spy"/>
<munit:assert-on-equals message="outbound-props-1 is not set properly" expectedValue="test1" actualValue="#[message.outboundProperties['outbound-prop-1']]" doc:name="Assert outbound-props-1 is set properly"/>
<munit:assert-on-equals message="outbound-props-2 is not set properly" expectedValue="test1" actualValue="#[message.outboundProperties['outbound-prop-2']]" doc:name="Assert outbound-props-2 is set properly"/>
</mock:assertions-after-call>
</mock:spy>
<flow-ref name="outbound-props-flow" doc:name="Flow-ref to outbound-props-flow"/>
</munit:test>
</mule>
Thanks,
Juan
Don't use 'Spy' for this, it has some limitations. Take a look to the documentation:
https://docs.mulesoft.com/mule-user-guide/v/3.7/the-spy-message-processor#defining-spy-actions
You could simply add the asserts after the flow ref.
<munit:test name="outbound-props-flow-outbound-props-flowTest" description="Test">
<flow-ref name="outbound-props-flow" doc:name="Flow-ref to outbound-props-flow"/>
<munit:assert-on-equals message="outbound-props-1 is not set properly" expectedValue="test1" actualValue="#[message.outboundProperties['outbound-prop-1']]" doc:name="Assert outbound-props-1 is set properly"/>
<munit:assert-on-equals message="outbound-props-2 is not set properly" expectedValue="test2" actualValue="#[message.outboundProperties['outbound-prop-2']]" doc:name="Assert outbound-props-2 is set properly"/>
</munit:test>
I am trying to utilize the xml to object transformer in mule while transfroming an xml payload to a Java Bean (Customer). Here is my simple flow. The exception I am seeing is below
Exception stack is:
1. CUSTOMER (com.thoughtworks.xstream.mapper.CannotResolveClassException)
com.thoughtworks.xstream.mapper.DefaultMapper:56 (null)
2. CUSTOMER (com.thoughtworks.xstream.mapper.CannotResolveClassException) (org.mule.api.transformer.TransformerException)
org.mule.module.xml.transformer.XmlToObject:76 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
com.thoughtworks.xstream.mapper.CannotResolveClassException: CUSTOMER
at com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:56)
at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
at com.thoughtworks.xstream.mapper.DynamicProxyMapper.realClass(DynamicProxyMapper.java:55)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
FLOW
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" 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" version="EE-3.4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="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://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd">
<flow name="alternateFlow1" doc:name="alternateFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8999" doc:name="HTTP"/>
<http:outbound-endpoint exchange-pattern="request-response" host="www.thomas-bayer.com" port="80" path="sqlrest/CUSTOMER/3/" method="GET" doc:name="HTTP"/>
<mulexml:xml-to-object-transformer returnClass="com.abc.dto.CUSTOMER" doc:name="XML to Object"/>
<logger level="INFO" doc:name="Logger"/>
</flow>
</mule>
XML:
<CUSTOMER xmlns:xlink="w3.org/1999/xlink">
;
<ID>4</ID>
<FIRSTNAME>Sylvia</FIRSTNAME>
<LASTNAME>Ringer</LASTNAME>
<STREET>365 College Av.</STREET>
<CITY>Dallas</CITY>
</CUSTOMER>
You need to add an alias in the mulexml:xml-to-object-transformer:
<mulexml:alias name="CUSTOMER" class="com.abc.dto.CUSTOMER" />
Also there's no reason to go all caps with the class name so rename your class and alias it:
<mulexml:alias name="CUSTOMER" class="com.abc.dto.Customer" />