Below is my flow and i'm trying to store my salesforce batch information into a queue in rabbit mq
<flow name="foreachsimilar_pmFlow1" doc:name="foreachsimilar_pmFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/>
<sfdc:create-job config-ref="Salesforce1" type="HRISASI__c" operation="insert" doc:name="Salesforce"/>
<set-variable variableName="batchID" value="1" doc:name="Variable"/>
<set-property propertyName="jobInfo" value="#[payload]" doc:name="Property"/>
<set-variable variableName="jobId" value="#[payload.id]" doc:name="Variable"/>
<jdbc-ee:outbound-endpoint exchange-pattern="request-response" queryKey="id" queryTimeout="-1" connector-ref="Database1" doc:name="Database"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
<scripting:transformer doc:name="Groovy">
<scripting:script engine="Groovy"><![CDATA[payload.collect { it.EmpId }.collate(3).collect { [min: it[0], max: it[-1]] }
]]></scripting:script>
</scripting:transformer>
<foreach doc:name="For Each">
<set-variable variableName="bulkPayload" value="#[groovy: return[];]" doc:name="bulkPayload EmptyArray"/>
<set-variable variableName="IDs" value="#[groovy:return[];]" doc:name="Id EmptyArray"/>
<set-variable variableName="jdbdinsbatch" value="#[groovy: return[];]" doc:name="Variable"/>
<jdbc-ee:outbound-endpoint exchange-pattern="request-response" queryTimeout="-1" connector-ref="Database1" doc:name="Database" queryKey="all"/>
<foreach doc:name="For Each">
<set-variable variableName="empId" value="#[payload['EmpId']]" doc:name="Variable"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
<data-mapper:transform config-ref="map_to_hrisasi__c" doc:name="Map To HRISASI__c"/>
<scripting:transformer doc:name="Groovy">
<scripting:script engine="Groovy"><![CDATA[payloadMap = payload[0];
IDs = flowVars['IDs'];
IDs.add( [ EmpId: flowVars['EmpId'] ] );
flowVars['IDs'] = IDs;
jdbdinsbatch= flowVars['jdbdinsbatch'];
jdbdinsbatch.add( [ EmpId: flowVars['EmpId'], batchID: flowVars['batchID'] ] );
flowVars['jdbdinsbatch'] = jdbdinsbatch;
return [ payloadMap ];]]></scripting:script>
</scripting:transformer>
<set-variable variableName="bulkPayload" value="#[groovy: bulkPayload = flowVars['bulkPayload']; bulkPayload.add(payload[0]); return bulkPayload;]" doc:name="bulkPayload"/>
</foreach>
<set-payload value="#[flowVars['bulkPayload']]" doc:name="Set Payload"/>
<sfdc:create-batch config-ref="Salesforce1" doc:name="Salesforce">
<sfdc:job-info ref="#[message.outboundProperties['jobInfo']]"/>
<sfdc:objects ref="#[payload]"/>
</sfdc:create-batch>
<scripting:transformer doc:name="Groovy">
<scripting:script engine="Groovy"><![CDATA[return [ batch: payload, IDs: flowVars['IDs'], batchid: flowVars['batchID'] ]]]></scripting:script>
</scripting:transformer>
<amqp:outbound-endpoint exchangeName="Salesforce-Batch" queueName="batchInfo" exchangeDurable="true" queueDurable="true" responseTimeout="10000" doc:name="AMQP"/>
</foreach>
<flow-ref name="foreachsimilar_pmFlow2" doc:name="Flow Reference"/>
</flow>
The below exception is thrown
Message : Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=amqp://Salesforce-Batch/amqp-queue.batchInfo, connector=AmqpConnector
{
name=AMQP_Connector
lifecycle=start
this=33982399
numberOfConcurrentTransactedReceivers=4
createMultipleTransactedReceivers=true
connected=true
supportedProtocols=[amqp]
serviceOverrides=<none>
}
, name='endpoint.amqp.Salesforce.Batch.amqp.queue.batchInfo', mep=ONE_WAY, properties={queueDurable=true, exchangeDurable=true}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: AmqpMessage
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. invalid value in table (java.lang.IllegalArgumentException)
com.rabbitmq.client.impl.Frame:306 (null)
2. Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=amqp://Salesforce-Batch/amqp-queue.batchInfo, connector=AmqpConnector
{
name=AMQP_Connector
lifecycle=start
this=33982399
numberOfConcurrentTransactedReceivers=4
createMultipleTransactedReceivers=true
connected=true
supportedProtocols=[amqp]
serviceOverrides=<none>
}
, name='endpoint.amqp.Salesforce.Batch.amqp.queue.batchInfo', mep=ONE_WAY, properties={queueDurable=true, exchangeDurable=true}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: AmqpMessage (org.mule.api.transport.DispatchException)
org.mule.transport.AbstractMessageDispatcher:109 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.lang.IllegalArgumentException: invalid value in table
at com.rabbitmq.client.impl.Frame.fieldValueSize(Frame.java:306)
at com.rabbitmq.client.impl.Frame.tableSize(Frame.java:246)
at com.rabbitmq.client.impl.ValueWriter.writeTable(ValueWriter.java:120)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
Could somebody please tell as why is the above exception thrown and what should be done to resolve it struck with this for the past two days
Thank you in advance.
below is the stack trace after enabling verbose exception logging
********************************************************************************
Root Exception stack trace:
java.lang.IllegalArgumentException: invalid value in table
at com.rabbitmq.client.impl.Frame.fieldValueSize(Frame.java:306)
at com.rabbitmq.client.impl.Frame.tableSize(Frame.java:246)
at com.rabbitmq.client.impl.ValueWriter.writeTable(ValueWriter.java:120)
at com.rabbitmq.client.impl.ContentHeaderPropertyWriter.writeTable(ContentHeaderPropertyWriter.java:98)
at com.rabbitmq.client.AMQP$BasicProperties.writePropertiesTo(AMQP.java:1782)
at com.rabbitmq.client.impl.AMQContentHeader.writeTo(AMQContentHeader.java:51)
at com.rabbitmq.client.impl.AMQContentHeader.toFrame(AMQContentHeader.java:78)
at com.rabbitmq.client.impl.AMQCommand.transmit(AMQCommand.java:106)
at com.rabbitmq.client.impl.AMQChannel.quiescingTransmit(AMQChannel.java:316)
at com.rabbitmq.client.impl.AMQChannel.transmit(AMQChannel.java:292)
at com.rabbitmq.client.impl.ChannelN.basicPublish(ChannelN.java:636)
at org.mule.transport.amqp.AmqpMessageDispatcher$OutboundAction$1.run(AmqpMessageDispatcher.java:55)
at org.mule.transport.amqp.AmqpMessageDispatcher.doOutboundAction(AmqpMessageDispatcher.java:172)
at org.mule.transport.amqp.AmqpMessageDispatcher.doDispatch(AmqpMessageDispatcher.java:127)
at org.mule.transport.AbstractMessageDispatcher.process(AbstractMessageDispatcher.java:99)
at org.mule.transport.AbstractConnector$DispatcherMessageProcessor.process(AbstractConnector.java:2627)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.AsyncInterceptingMessageProcessor.process(AsyncInterceptingMessageProcessor.java:101)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.endpoint.outbound.OutboundResponsePropertiesMessageProcessor.process(OutboundResponsePropertiesMessageProcessor.java:39)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.EndpointTransactionalInterceptingMessageProcessor$1.process(EndpointTransactionalInterceptingMessageProcessor.java:50)
at org.mule.processor.EndpointTransactionalInterceptingMessageProcessor$1.process(EndpointTransactionalInterceptingMessageProcessor.java:47)
at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:20)
at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:58)
at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:48)
at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:54)
at org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:44)
at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(I...
********************************************************************************
The payload you're trying to send to Rabbit looks quite complex (sfdc BatchInfo object). How do you except it to be readable for the queue consumer? I think that, for some reason, the message transformers involved in transforming this payload to a byte array suited for AMQP transport fails and you end up trying to send the groovy generated Map with an sfdc BatchInfo object as is to the AMQP client lib.
You should convert the map with contents to a string before sending it to Rabbit.
Something like this (call toString on the BatchInfo object and then convert the map to JSON):
Edited (removed outbound properties)
<scripting:transformer doc:name="Groovy">
<scripting:script engine="Groovy"><![CDATA[return [ batch: payload.toString(), IDs: flowVars['IDs'], batchid: flowVars['batchID'] ]]]></scripting:script>
</scripting:transformer>
<json:object-to-json-transformer doc:name="Object to JSON"/>
<amqp:outbound-endpoint exchangeName="Salesforce-Batch" queueName="batchInfo" exchangeDurable="true" queueDurable="true" responseTimeout="10000" doc:name="AMQP">
<message-properties-transformer scope="outbound">
<delete-message-property key="*" />
</message-properties-transformer>
</amqp:outbound-endpoint>
Related
I 'am building my error handeling section, but I am not getting the right response in the logs. I want to catch the most common errors like, 400, 401, 403, 404 and 500 and the ones that I don't know to get. I would like to log everything properly so that it becomes clear which error it throwing and the associated code.
This is what I implemented so for;
<choice-exception-strategy name="Choice_Exception_Strategy">
<catch-exception-strategy doc:name="400" when="#[message.inboundProperties['http.status'] == '400']">
<set-variable variableName="error"
value="#[exception.getDetailedMessage()]" doc:name="Set error flowVar" />
<set-variable variableName="ErrorDesc"
value="#[org.mule.util.ExceptionUtils.getRootCauseMessage(exception)]"
doc:name="Set response error message" />
<set-property propertyName="http.status" value="400"
doc:name="Set status 400" />
<logger message="#["Error: " + flowVars.error + " Response error: " + flowVars.ErrorDesc]"
level="INFO" doc:name="Log Error" />
</catch-exception-strategy>
<catch-exception-strategy
when="#[message.inboundProperties['http.status'] == '401']" doc:name="401">
<set-variable variableName="error"
value="#[exception.getDetailedMessage()]" doc:name="Set error flowVar" />
<set-variable variableName="ErrorDesc"
value="#[org.mule.util.ExceptionUtils.getRootCauseMessage(exception)]"
doc:name="Set response error message" />
<set-property propertyName="http.status" value="401"
doc:name="Set status 401" />
<logger message="#["Error: " + flowVars.error + " Response error: " + flowVars.ErrorDesc]" level="INFO" doc:name="Log Error"/>
</catch-exception-strategy>
<catch-exception-strategy doc:name="404" when="#[message.inboundProperties['http.status'] == '404']">
<set-variable variableName="error"
value="#[exception.getDetailedMessage()]" doc:name="Set error flowVar" />
<set-variable variableName="ErrorDesc"
value="#[org.mule.util.ExceptionUtils.getRootCauseMessage(exception)]"
doc:name="Set response error message" />
<set-property propertyName="http.status" value="404"
doc:name="Set status 404" />
<logger level="INFO" doc:name="Log Error"
message="#["Error: " + flowVars.error + " Response error: " + flowVars.ErrorDesc]" />
</catch-exception-strategy>
<catch-exception-strategy doc:name="500 or " >
<set-variable variableName="error"
value="#[exception.getDetailedMessage()]" doc:name="Set error flowVar" />
<set-variable variableName="ErrorDesc"
value="#[org.mule.util.ExceptionUtils.getRootCauseMessage(exception)]"
doc:name="Set response error message" />
<set-property propertyName="http.status" value="500, 503"
doc:name="Set status 500" />
<logger level="INFO" doc:name="Log Error"
message="#["Error: " + flowVars.error + " Response error: " + flowVars.ErrorDesc]" />
</catch-exception-strategy>
</choice-exception-strategy>
And this is output that I get with code above:
Message : Response code 401 mapped as failure.
Payload : org.glassfish.grizzly.utils.BufferInputStream#5b21fa2f
Element : /bos-topdesk-sas-km-dl-ms-main/processors/4/ref-sys-api-router/subprocessors/0 # ref-sys-api.xml:43 (HTTP Request Incidents)
Element XML : <http:request config-ref="HTTP_Request_Configuration_Incidents" path="" method="GET" doc:name="HTTP Request Incidents"></http:request>
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.module.http.internal.request.ResponseValidatorException: Response code 401 mapped as failure.
at org.mule.module.http.internal.request.SuccessStatusCodeValidator.validate(SuccessStatusCodeValidator.java:37)
at org.mule.module.http.internal.request.DefaultHttpRequester.validateResponse(DefaultHttpRequester.java:429)
at org.mule.module.http.internal.request.DefaultHttpRequester.innerProcess(DefaultHttpRequester.java:412)
at org.mule.module.http.internal.request.DefaultHttpRequester.processBlocking(DefaultHttpRequester.java:226)
at org.mule.processor.AbstractNonBlockingMessageProcessor.process(AbstractNonBlockingMessageProcessor.java:43)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:111)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:88)
at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:111)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:111)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:88)
at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:98)
at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59)
at org.mule.interceptor.AbstractEnvelopeInterceptor.processBlocking(AbstractEnvelopeInterceptor.java:59)
at org.mule.processor.AbstractRequestResponseMessageProcessor.process(AbstractRequestResponseMessageProcessor.java:48)
at org.mule.processor.AsyncInterceptingMessageProcessor.processNextTimed(AsyncInterceptingMessageProcessor.java:131)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:221)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:214)
at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:16)
at org.mule.execution.CommitTransactionInterceptor.execute(CommitTransactionInterceptor.java:35)
at org.mule.execution.CommitTransactionInterceptor.execute(CommitTransactionInterceptor.java:22)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:30)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:14)
at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:67)
at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:44)
at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:50)
at org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:40)
at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:41)
at org.mule.execution.ExternalTransactionInterceptor.execute(ExternalTransactionInterceptor.java:48)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:28)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:13)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:110)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:30)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker.doRun(AsyncInterceptingMessageProcessor.java:213)
at org.mule.work.AbstractMuleEventWork.run(AbstractMuleEventWork.java:53)
at org.mule.work.WorkerContext.run(WorkerContext.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
********************************************************************************
Response error: ResponseValidatorException: Response code 401 mapped as failure.
My expected output is that it shows in the logs as below;
{
"code": 403,
"Error type: "Access forbidden"
"message": "You are not allowed to administrate categories."
}
Thanks for helping.
Configuration XML
<sap:connectorname="SAP" jcoAsHost="1.1.1.1" jcoUser="test_User" jcoPasswd="password" jcoSysnr="00" jcoClient="20" jcoLang="EN" validateConnections="true" doc:name="SAP" />
<flow name="testFlow2" doc:name="testFlow2" />
<flow name="testFlow1" doc:name="testFlow1">
<composite-source doc:name="Composite Source">
<sap:inbound-endpoint exchange-pattern="request-response" connector-ref="SAP" type="function" xmlVersion="2" outputXml="true" jcoGwHost="1.1.1.1" jcoGwService="3300" jcoProgramId="muletest" responseTimeout="10000" doc:name="SAP" />
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="test" doc:name="HTTP" />
</composite-source>
<logger message="#[payload]" level="INFO" doc:name="Logger" />
<http:outbound-endpoint exchange-pattern="request-response" method="POST" address="http://www.test.com" doc:name="HTTP" />
<set-variable variableName="code" value="#[message.inboundProperties['http.status']]" doc:name="Variable" />
<set-payload value="<?xml version="1.0" encoding="UTF-8"?><Z_SD_CALL_TO_SVS><export><RESPONSE><code>#[flowVars.code]</code></RESPONSE></export></Z_SD_CALL_TO_SVS>" doc:name="Set Payload"
/>
</flow>
</mule>
The above is the configuration file.
When i send data from Soap UI am getting response code as 400 and sending it back to SOAP UI and I dint face any problem but when i send the data via SAP connector the data is sent to SAP but in console am getting error like below.
Message : Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=http://www.test.com, connector=HttpsConnector { name=HTTP_HTTPS lifecycle=start this=29a1ffa numberOfConcurrentTransactedReceivers=4 createMultipleTransactedReceivers=true
connected=true supportedProtocols=[https] serviceOverrides=
<none>
} , name='http://www.test.com', mep=REQUEST_RESPONSE, properties={http.method=POST, exceptionOnMessageError=true, Content-Type=application/xml}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false,
initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: PostMethod Code : MULE_ERROR-42999 --------------------------------------------------------------------------------
Exception stack is: 1. Bad Request, code: 400 (org.mule.transport.http.HttpResponseException) org.mule.transport.http.HttpClientMessageDispatcher:285 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/transport/http/HttpResponseException.html)
2. Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=http://www.test.com/, connector=HttpsConnector { name=HTTP_HTTPS lifecycle=start this=29a1ffa numberOfConcurrentTransactedReceivers=4 createMultipleTransactedReceivers=true connected=true
supportedProtocols=[https] serviceOverrides=
<none>
} , name='endpoint.https.svc.cert.storedvalue.com.ecomm.0.1.fulfillment.0.1.purchasephysical', mep=REQUEST_RESPONSE, properties={http.method=POST, exceptionOnMessageError=true, Content-Type=application/xml}, transactionConfig=Transaction{factory=null,
action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: PostMethod (org.mule.api.transport.DispatchException)
org.mule.transport.http.HttpClientMessageDispatcher:285 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html) -------------------------------------------------------------------------------- Root Exception
stack trace: org.mule.transport.http.HttpResponseException: Bad Request, code: 400 at org.mule.transport.http.HttpClientMessageDispatcher.doSend(HttpClientMessageDispatcher.java:285) at org.mule.transport.AbstractMessageDispatcher.process(AbstractMessageDispatcher.java:84)
at org.mule.transport.AbstractConnector$DispatcherMessageProcessor.process(AbstractConnector.java:2637) + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) Y am not getting error when trying with SoapUI and
I need to design a Mule flow with xml file as input to a JMS queue. Once in queue it will be picked up to hit a SOAP web service. Following is a code.
<jms:activemq-connector name="Active_MQ" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ"/>
<flow name="jmsFlow2" doc:name="jmsFlow2">
<file:inbound-endpoint responseTimeout="10000" doc:name="File" path="D:\Input"/>
<byte-array-to-string-transformer doc:name="Byte Array to String"/>
<jms:outbound-endpoint queue="DimQueue" connector-ref="Active_MQ" doc:name="JMS" mimeType="text/plain"/>
</flow>
<flow name="jmsFlow1" doc:name="jmsFlow1">
<jms:inbound-endpoint queue="DimQueue" connector-ref="Active_MQ" doc:name="JMS"/>
<jms:jmsmessage-to-object-transformer doc:name="JMSMessage to Object"/>
<logger message="#[message.payload]" level="INFO" doc:name="Logger"/>
<!-- <mulexml:object-to-xml-transformer doc:name="Object to XML"/> -->
<logger message="#[message.payload]" level="INFO" doc:name="Logger"/>
<set-property propertyName="Content-Type" value="application/soap+xml" doc:name="Property"/>
<logger message="#[message.outboundProperties]-------#[header:Content-Type]" level="INFO" doc:name="Logger"/>
<cxf:jaxws-service serviceClass="com.org.ProcessImpl" doc:name="SOAP" enableMuleSoapHeaders="false" mtomEnabled="true">
</cxf:jaxws-service>
<http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="9090" method="POST" doc:name="HTTP">
</http:outbound-endpoint>
</flow>
It gives following error:
WARN 2014-02-06 15:27:23,145 [[jms].jmsFlow1.stage1.02]org.apache.cxf.phase.PhaseInterceptorChain: Interceptor for {http://com.capgemini/cif/dim}ProcessActivityService has thrown exception, unwinding now
org.apache.cxf.binding.soap.SoapFault: Missing ContentType.
at org.apache.cxf.binding.soap.jms.interceptor.SoapFaultFactory.createSoap11Fault(SoapFaultFactory.java:58)
at org.apache.cxf.binding.soap.jms.interceptor.SoapFaultFactory.createFault(SoapFaultFactory.java:48)
at org.apache.cxf.binding.soap.jms.interceptor.SoapJMSInInterceptor.createFault(SoapJMSInInterceptor.java:226)
at org.apache.cxf.binding.soap.jms.interceptor.SoapJMSInInterceptor.checkContentType(SoapJMSInInterceptor.java:191)
at org.apache.cxf.binding.soap.jms.interceptor.SoapJMSInInterceptor.handleMessage(SoapJMSInInterceptor.java:49)
at org.apache.cxf.binding.soap.jms.interceptor.SoapJMSInInterceptor.handleMessage(SoapJMSInInterceptor.java:38)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:122)
at org.mule.module.cxf.CxfInboundMessageProcessor.sendToDestination(CxfInboundMessageProcessor.java:320)
at org.mule.module.cxf.CxfInboundMessageProcessor.process(CxfInboundMessageProcessor.java:142)
at org.mule.module.cxf.config.FlowConfiguringMessageProcessor.process(FlowConfiguringMessageProcessor.java:52)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:95)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:70)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:106)
at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55)
at org.mule.processor.AsyncInterceptingMessageProcessor.processNextTimed(AsyncInterceptingMessageProcessor.java:122)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:192)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:185)
at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:20)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:34)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:18)
at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:58)
at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:48)
at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:54)
at org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:44)
at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:44)
at org.mule.execution.ExternalTransactionInterceptor.execute(ExternalTransactionInterceptor.java:52)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:32)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:17)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:113)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:34)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker.doRun(AsyncInterceptingMessageProcessor.java:184)
at org.mule.work.AbstractMuleEventWork.run(AbstractMuleEventWork.java:43)
at org.mule.work.WorkerContext.run(WorkerContext.java:311)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.cxf.binding.soap.jms.interceptor.JMSFault: Missing ContentType.
at org.apache.cxf.binding.soap.jms.interceptor.JMSFaultFactory.createFault(JMSFaultFactory.java:111)
at org.apache.cxf.binding.soap.jms.interceptor.JMSFaultFactory.createMissingContentTypeFault(JMSFaultFactory.java:72)
at org.apache.cxf.binding.soap.jms.interceptor.SoapJMSInInterceptor.checkContentType(SoapJMSInInterceptor.java:188)
... 38 more
The loggers in the code give correct Content-Type but still the error persists.
Can anyone help?
Thanks in advance
Your issue with the Content-Type could be due to old version, as I can not reproduce it.
However, if you want to use xml data to call SOAP web service, I think your approach is incorrect. You should use a proxy client, instead. Something like this:
<jms:inbound-endpoint queue="DimQueue" connector-ref="Active_MQ" doc:name="JMS"/>
<set-property propertyName="Content-Type" value="application/soap+xml" doc:name="Property"/>
<set-property propertyName="SOAPAction" value="urn:#myMethod" doc:name="Property"/>
<cxf:proxy-client payload="envelope" doc:name="SOAP"/>
<http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="9090" method="POST" doc:name="HTTP">
</http:outbound-endpoint>
I provided snippet of my code that should work normally but it doesn't.
In short, my flow is triggered by quartz, read some data from database, loop through results, on each loop do something and then finish.
Everything works ok when result from service (http outbound) return that there is nothing to give back, but when choice (in flow) is not default it redirect to sub-flow where xslt perform and save file. File saves like it should (I checked with external tools if xml suits criteria) and logger prints out number 3 as proof that it is finished (couple of lines before error is thrown) but after that I get error given below. Anyone knows why? I am out of ideas.
My flow:
<flow name="msp2bassGettingContent" doc:name="Starter">
<quartz:inbound-endpoint responseTimeout="10000" doc:name="Quartz" jobName="Starter" repeatInterval="600000" startDelay="3000">
<quartz:event-generator-job groupName="Generator" jobGroupName="Generator">
<quartz:payload file="${prop.requestEvent}"/>
</quartz:event-generator-job>
</quartz:inbound-endpoint>
<jdbc:outbound-endpoint exchange-pattern="request-response" queryKey="getUnreadedRoutes" queryTimeout="-1" connector-ref="JDBCConnector" doc:name="GetNulls">
<jdbc:query key="getUnreadedRoutes" value="SELECT routeid FROM kptemp WHERE readed IS NULL"/>
</jdbc:outbound-endpoint>
<foreach collection="#[message.payload]" doc:name="For Each" counterVariableName="counter123">
<flow-ref name="msp2bass" doc:name="Flow Reference"/>
</foreach>
</flow>
<sub-flow name="msp2bass" doc:name="msp2bassGetEvent">
<set-variable variableName="routeid" value="#[payload['routeid']]" doc:name="Variable"/>
<set-payload value="<a/>;" doc:name="Set Payload"/>
<mulexml:object-to-xml-transformer doc:name="Object to XML"/>
<mulexml:xslt-transformer maxIdleTransformers="2" maxActiveTransformers="5" xsl-file="${prop.createRequest}" doc:name="XSLT" ignoreBadInput="true">
<mulexml:context-property key="customerId" value="${prop.customerId}"/>
<mulexml:context-property key="siteName" value="${prop.siteName}"/>
<mulexml:context-property key="routeID" value="#[routeid]"/>
</mulexml:xslt-transformer>
<cxf:proxy-client payload="body" doc:name="SOAP">
<cxf:outInterceptors>
<spring:ref bean="WSS4JOutInterceptorBean"/>
</cxf:outInterceptors>
</cxf:proxy-client>
<https:outbound-endpoint exchange-pattern="request-response" host="${prop.host}" port="${prop.port}" path="${prop.path}" method="POST" connector-ref="HTTP_HTTPS1" doc:name="HTTP"/>
<byte-array-to-object-transformer doc:name="Byte Array to Object"/>
<choice doc:name="Choice">
<when expression="#[xpath('boolean(//soap:Envelope/soap:Body/ns2:processComplexResponse/MSPResponse/serviceEvents/measurements/name)')]">
<flow-ref name="transform" doc:name="Flow Reference"/>
</when>
<otherwise>
<logger message="Not null: #[routeid]" level="INFO" doc:name="Logger"/>
</otherwise>
</choice>
</sub-flow>
<sub-flow name="transform" doc:name="transform">
<logger message="Payload: #[payload]" level="INFO" doc:name="Logger"/>
<mulexml:xslt-transformer maxIdleTransformers="2" maxActiveTransformers="5" xsl-file="${prop.transformer}" doc:name="XSLT"/>
<file:outbound-endpoint path="./work" outputPattern="#[routeid].xml" responseTimeout="10000" disableTransportTransformer="true" doc:name="File"/>
<logger message="3" level="INFO" doc:name="3"/>
</sub-flow>
Stack trace:
INFO 2014-01-22 12:30:21,999 [[bass2msp].msp2bassGettingContent.stage1.02] org.mule.api.processor.LoggerMessageProcessor: Not null: IR_1389972193818
INFO 2014-01-22 12:30:22,252 [[bass2msp].msp2bassGettingContent.stage1.02] org.mule.api.processor.LoggerMessageProcessor: Payload: SOME XML CONTENT
INFO 2014-01-22 12:30:22,301 [[bass2msp].msp2bassGettingContent.stage1.02] org.mule.api.processor.LoggerMessageProcessor: 3
WARN 2014-01-22 12:17:56,335 [[bass2msp].msp2bassGettingContent.stage1.04] org.apache.cxf.phase.PhaseInterceptorChain: Interceptor for {http://support.cxf.module.mule.org/}ProxyService#{http://support.cxf.module.mule.org/}invoke has thrown exception, unwinding now
org.apache.cxf.binding.soap.SoapFault: No namespace on "rootNode" element.
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.readVersion(ReadHeadersInterceptor.java:109)
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:141)
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:60)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:799)
at org.mule.module.cxf.transport.MuleUniversalConduit.dispatchMuleMessage(MuleUniversalConduit.java:280)
at org.mule.module.cxf.transport.MuleUniversalConduit$2.handleMessage(MuleUniversalConduit.java:194)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:533)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:375)
at org.mule.module.cxf.CxfOutboundMessageProcessor.doSendWithClient(CxfOutboundMessageProcessor.java:235)
at org.mule.module.cxf.CxfOutboundMessageProcessor.process(CxfOutboundMessageProcessor.java:125)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:95)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:70)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.doProcess(InterceptingChainLifecycleWrapper.java:54)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:70)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.access$001(InterceptingChainLifecycleWrapper.java:26)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper$1.process(InterceptingChainLifecycleWrapper.java:70)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.process(InterceptingChainLifecycleWrapper.java:65)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:106)
at org.mule.routing.outbound.AbstractMessageSequenceSplitter.processParts(AbstractMessageSequenceSplitter.java:133)
at org.mule.routing.outbound.AbstractMessageSequenceSplitter.process(AbstractMessageSequenceSplitter.java:63)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:95)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:70)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.doProcess(InterceptingChainLifecycleWrapper.java:54)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:70)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.access$001(InterceptingChainLifecycleWrapper.java:26)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper$1.process(InterceptingChainLifecycleWrapper.java:70)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.process(InterceptingChainLifecycleWrapper.java:65)
at org.mule.routing.Foreach.process(Foreach.java:95)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:95)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:70)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:106)
at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55)
at org.mule.processor.AsyncInterceptingMessageProcessor.processNextTimed(AsyncInterceptingMessageProcessor.java:122)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:192)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:185)
at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:20)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:34)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:18)
at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:58)
at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:48)
at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:54)
at org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:44)
at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:44)
at org.mule.execution.ExternalTransactionInterceptor.execute(ExternalTransactionInterceptor.java:52)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:32)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:17)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:113)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:34)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker.doRun(AsyncInterceptingMessageProcessor.java:184)
at org.mule.work.AbstractMuleEventWork.run(AbstractMuleEventWork.java:43)
at org.mule.work.WorkerContext.run(WorkerContext.java:311)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:679)
ERROR 2014-01-22 12:17:56,340 [[bass2msp].msp2bassGettingContent.stage1.04] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : No namespace on "rootNode" element.. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: PostMethod
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. No namespace on "rootNode" element. (org.apache.cxf.binding.soap.SoapFault)
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor:109 (null)
2. No namespace on "rootNode" element.. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: PostMethod (org.mule.api.transport.DispatchException)
org.mule.module.cxf.CxfOutboundMessageProcessor:144 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.apache.cxf.binding.soap.SoapFault: No namespace on "rootNode" element.
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.readVersion(ReadHeadersInterceptor.java:109)
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:141)
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:60)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
Any help is appreciated! Thank you!
EDIT.1
I did some more research and I found out that problem is when call to subflow in my loop (for each) end. I have put logger after flow-ref and it printed ok till that error (file at the end of flow is generated but logger is quiet). So, is this known/unknown bug or something? Or do I somehow rewrite collection that is looping here: message.payload so that looper cannot read next value? But then, why logger after flow-ref doesn't get triggered inside loop at the end?
The cxf:proxy-client element is a "two way" element, i.e. it deals with the message both in request and response phases.
The "transform" sub-flow affects the message payload, which was the response from the HTTP endpoint, with an XSL-T. This confuses the cxf:proxy-client element when it eventually gets the response back flowing through it.
One potential fix is to ref the sub-flow in an async block so whatever payload transformation it will do won't be visible to the calling flow, but this will change the response of "msp2bass".
Another option would consist in putting the byte-array-to-object-transformer and choice elements in a response block above the cxf:proxy-client, that way you would affect the response after CFX so it would stop complaining.
David,
Sending you my configuration again, appreciate your inputs in advance:
<flow name="IntegrationFlow" doc:name="IntegrationFlow">
<jdbc-ee:inbound-endpoint queryTimeout="-1" doc:name="Database" connector-ref="jdbcConnector" queryKey="selectAll" pollingFrequency="10000">
<jdbc-ee:transaction action="NONE"/>
</jdbc-ee:inbound-endpoint>
<logger message="************Payload is #[message.payload]*************" level="INFO" doc:name="Logger"/>
<logger message="************Payload is #[message.payload.destination]*************" level="INFO" doc:name="Logger"/>
<logger message="************Payload is #[message.payload.price]*************" level="INFO" doc:name="Logger"/>
<foreach doc:name="Foreach">
<choice doc:name="Choice">
<when expression="#[message.payload.price > 750]">
<!-- <when expression="#[message.payload.price > 750]"> -->
<processor-chain doc:name="Processor Chain">
<jdbc-ee:maps-to-xml-transformer doc:name="Maps to XML"/>
<jms:outbound-endpoint queue="queue1" connector-ref="jmsConnector" doc:name="JMS"/>
</processor-chain>
</when>
<otherwise>
<custom-transformer returnClass="java.util.List" class="org.mule.confluex.java.MapToListTransformer" doc:name="Java"/>
<logger message="Payload is #[message.payload]" level="INFO" doc:name="Logger1"/>
<jdbc-ee:maps-to-csv-transformer mimeType="text/plain" delimiter="," mappingFile="C:\Downloads\Temp\mapping.xml" doc:name="Maps to CSV"/>
<logger message="CSV Payload is #[message.payload]" level="INFO" doc:name="Logger2"/>
<file:outbound-endpoint path="C:\Downloads\toAmazon" responseTimeout="10000" mimeType="text/plain" connector-ref="fileConnector" doc:name="File"/>
<s3:create-object config-ref="Amazon_S3" bucketName="confluexdemo" contentType="text/plain" key="*.*" doc:name="Amazon S3"/>
</otherwise>
</choice>
</foreach>
</flow>
Here is the Run Log:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Started app 'ConfluexDemo' +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
INFO 2013-11-24 19:18:32,563 [[ConfluexDemo].IntegrationFlow.stage1.02] org.mule.api.processor.LoggerMessageProcessor: ************Payload is {DESTINATION=SFO, PRICE=300, ID=0}*************
INFO 2013-11-24 19:18:32,563 [[ConfluexDemo].IntegrationFlow.stage1.03] org.mule.api.processor.LoggerMessageProcessor: ************Payload is {DESTINATION=MLT, PRICE=1200, ID=1}*************
INFO 2013-11-24 19:18:32,611 [[ConfluexDemo].IntegrationFlow.stage1.02] org.mule.api.processor.LoggerMessageProcessor: ************Payload is SFO*************
INFO 2013-11-24 19:18:32,611 [[ConfluexDemo].IntegrationFlow.stage1.03] org.mule.api.processor.LoggerMessageProcessor: ************Payload is MLT*************
INFO 2013-11-24 19:18:32,658 [[ConfluexDemo].IntegrationFlow.stage1.03] org.mule.api.processor.LoggerMessageProcessor: ************Payload is 1200*************
INFO 2013-11-24 19:18:32,658 [[ConfluexDemo].IntegrationFlow.stage1.02] org.mule.api.processor.LoggerMessageProcessor: ************Payload is 300*************
ERROR 2013-11-24 19:18:32,704 [[ConfluexDemo].IntegrationFlow.stage1.03] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : Execution of the expression "message.payload.price > 750" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: String
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. [Error: could not access: price; in class: java.lang.String]
[Near : {... message.payload.price > 750 ....}]
^
[Line: 1, Column: 1] (org.mvel2.PropertyAccessException)
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer:690 (null)
2. Execution of the expression "message.payload.price > 750" failed. (org.mule.api.expression.ExpressionRuntimeException)
org.mule.el.mvel.MVELExpressionLanguage:213 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/expression/ExpressionRuntimeException.html)
3. Execution of the expression "message.payload.price > 750" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: String (org.mule.api.MessagingException)
org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor:35 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
[Error: could not access: price; in class: java.lang.String]
[Near : {... message.payload.price > 750 ....}]
^
[Line: 1, Column: 1]
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(ReflectiveAccessorOptimizer.java:690)
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanPropertyAO(ReflectiveAccessorOptimizer.java:472)
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:374)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
From my perspective it looks like it is a Map Payload when I print it out, it seemingly seems to read a string when I hit the 'when expression. Hopefully this should give the complete picture. Please let me know if anything else is needed.
For the sake of completion I am also including the JDBC definition:
<spring:beans>
<spring:bean id="SetupDatabaseNotificationListener" class="org.mule.confluex.database.SetupDatabaseNotificationListener"></spring:bean>
<spring:bean id="jdbcDataSource" class="org.enhydra.jdbc.standard.StandardDataSource" destroy-method="shutdown">
<spring:property name="driverName" value="org.apache.derby.jdbc.EmbeddedDriver"></spring:property>
<spring:property name="url" value="jdbc:derby:memory:muleEmbeddedDB;create=true"></spring:property>
</spring:bean>
</spring:beans>
<notifications>
<notification event="CONTEXT"></notification>
<notification-listener ref="SetupDatabaseNotificationListener"></notification-listener>
</notifications>
<jdbc-ee:connector name="jdbcConnector" pollingFrequency="10000" dataSource-ref="jdbcDataSource" doc:name="Database" queryTimeout="-1" transactionPerMessage="false" validateConnections="true">
<jdbc-ee:query key="selectAll" value="Select * from PriceTickets"></jdbc-ee:query>
</jdbc-ee:connector>
With Regards
S
The error is clear: you are passing a String to the foreach processor instead of something that can be iterated (Iterator, Collection, etc.).