Mule ESB choice flow control route - soap

In Mule I have the following flow :
there is a choice flow control which test the input and verify if the input String equals 'ctr1'.
<flow name="mediationFlow1" doc:name="mediationFlow1">
<file:inbound-endpoint path="C:\MuleStudio\SandBox\input" pollingFrequency="3000" responseTimeout="10000" doc:name="File"/>
<file:file-to-string-transformer doc:name="File to String"/>
<choice doc:name="Choice">
<when expression="payload=='ctr1'">
<cxf:jaxws-client operation="find" serviceClass="services.port.PortWS" port="portWSPort" enableMuleSoapHeaders="true" doc:name="Port"/>
<http:outbound-endpoint exchange-pattern="request-response" method="POST" address="http://localhost:8080/Actors/portWS" doc:name="portWS"/>
</when>
<otherwise >
<cxf:jaxws-client operation="find" serviceClass="services.douane.DouaneWS" port="douaneWSPort" enableMuleSoapHeaders="true" doc:name="Douane"/>
<http:outbound-endpoint exchange-pattern="request-response" method="POST" address="http://localhost:8080/Actors/douaneWS" doc:name="douaneWS"/>
</otherwise>
</choice>
<file:outbound-endpoint path="C:\MuleStudio\SandBox\output" outputPattern="#[function:datestamp:dd-MM-yy]_#[function:systime].xml " responseTimeout="10000" doc:name="Outgoing File"/>
</flow>
</mule>
the both web services call works perfectly when I run them speratly, but when I add the choice ccontrol this is what I got :
INFO 2013-05-14 15:48:07,892 [[mediation].connector.file.mule.default.receiver.01] org.mule.transport.file.FileMessageReceiver: Lock obtained on file: C:\MuleStudio\SandBox\input\input.txt
INFO 2013-05-14 15:48:08,206 [[mediation].mediationFlow1.stage1.02] org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default outbound transformer: org.mule.transport.http.transformers.ObjectToHttpClientMethodRequest
INFO 2013-05-14 15:48:08,216 [[mediation].mediationFlow1.stage1.02] org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default response transformer: org.mule.transport.http.transformers.MuleMessageToHttpResponse
INFO 2013-05-14 15:48:08,253 [[mediation].mediationFlow1.stage1.02] org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default outbound transformer: org.mule.transport.http.transformers.ObjectToHttpClientMethodRequest
INFO 2013-05-14 15:48:08,254 [[mediation].mediationFlow1.stage1.02] org.mule.lifecycle.AbstractLifecycleManager: Initialising: 'connector.http.mule.default.dispatcher.7073225'. Object is: HttpClientMessageDispatcher
INFO 2013-05-14 15:48:08,260 [[mediation].mediationFlow1.stage1.02] org.mule.lifecycle.AbstractLifecycleManager: Starting: 'connector.http.mule.default.dispatcher.7073225'. Object is: HttpClientMessageDispatcher
INFO 2013-05-14 15:48:09,035 [[mediation].connector.file.mule.default.dispatcher.01] org.mule.lifecycle.AbstractLifecycleManager: Initialising: 'connector.file.mule.default.dispatcher.23051110'. Object is: FileMessageDispatcher
INFO 2013-05-14 15:48:09,035 [[mediation].connector.file.mule.default.dispatcher.01] org.mule.lifecycle.AbstractLifecycleManager: Starting: 'connector.file.mule.default.dispatcher.23051110'. Object is: FileMessageDispatcher
INFO 2013-05-14 15:48:09,040 [[mediation].connector.file.mule.default.dispatcher.01] org.mule.transport.file.FileConnector: Writing file to: C:\MuleStudio\SandBox\output\14-05-13_1368539289037.xml
INFO 2013-05-14 15:48:09,043 [[mediation].connector.file.mule.default.dispatcher.01] org.mule.module.xml.transformer.jaxb.JAXBContextResolver: No common Object of type 'class javax.xml.bind.JAXBContext' configured, creating a local one for: SimpleDataType{type=services.port.Port, mimeType='text/xml'}, SimpleDataType{type=java.io.InputStream, mimeType='*/*'}
ERROR 2013-05-14 15:48:09,058 [[mediation].connector.file.mule.default.dispatcher.01] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : An invalid return type "class java.io.InputStream" was specified for transformer "JAXBMarshallerTransformer"
Code : MULE_ERROR-266
--------------------------------------------------------------------------------
Exception stack is:
1. An invalid return type "class java.io.InputStream" was specified for transformer "JAXBMarshallerTransformer" (org.mule.api.transformer.TransformerException)
org.mule.module.xml.transformer.jaxb.JAXBMarshallerTransformer:122 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.api.transformer.TransformerException: An invalid return type "class java.io.InputStream" was specified for transformer "JAXBMarshallerTransformer"
at org.mule.module.xml.transformer.jaxb.JAXBMarshallerTransformer.doTransform(JAXBMarshallerTransformer.java:122)
at org.mule.transformer.AbstractTransformer.transform(AbstractTransformer.java:411)
at org.mule.DefaultMuleMessage.getPayload(DefaultMuleMessage.java:362)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
I'm not sure if it's coming from the choice test expression?
Although I cant find much informations on how to use the choice control flow in details.

Mule by default applies lot of transformers in the flow to convert the payload to required formats.
In the case when there is no choice router it converts the object returned into an xml string to write to file.
But with choice router it is the programmers responsibility to provide a transformer to convert the response object to an XML string.
Add the following mule-xml jaxb object to xml transformer after choice router and before writing to file-outbound.
.....
</otherwise>
</choice>
<xm:jaxb-object-to-xml-transformer name="ObjectToXML" jaxbContext-ref="MyJaxb" returnClass="java.lang.String" encoding="UTF-8"/>
Hope this helps.

Related

Mule ESB Flow calling SOAP not working but worked from SOAP UI

Details : I have created on flow in MuleESB which is calling a web-service without any parameter just sending it username, password and token in a property and it is working fine.
But the second API I want to post some parameters while calling soap request but I don't know how to use it I tried to pass through set payload but no response.
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<http:request-config name="HTTP_Request_Configuration" host="webservicehostadd" port="443" doc:name="HTTP Request Configuration">
<http:basic-authentication username="username" password="pass"/>
</http:request-config>
<ws:consumer-config name="Web_Service_Consumer" wsdlLocation="https://xxxx/1.0?wsdl" service="xxx" port="xxxx" serviceAddress="https://xxxxx/1.0" connectorConfig="HTTP_Request_Configuration" doc:name="Web Service Consumer"/>
<flow name="mycustomflow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/TEST" doc:name="HTTP"/>
<set-property propertyName="APIKey" value="xxx-xxx-xxx-xxx-xxx" doc:name="Property"/>
<dw:transform-message doc:name="Transform Message" metadata:id="xxx-xxx-xxx-xxx-xxxxxxxx">
<dw:input-payload mimeType="application/xml"/>
<dw:set-payload><![CDATA[%dw 1.0
%output application/xml
%namespace ns0 http://localhost/getDetails:getDetailsWSD
---
{
ns0#getDetails: {
getDetailsOrder: {
ID: payload.ns0#getDetails.getDetailsOrder.ID,
AllData: payload.ns0#getDetails.getDetailsOrder.AllData
}
}
}]]></dw:set-payload>
</dw:transform-message>
<ws:consumer config-ref="Web_Service_Consumer" operation="employeeDetails" doc:name="Web Service Consumer"/>
</flow>
It showed the below error:
Exception while executing:
[row,col]: [1,1]
Unexpected character '{' (code 123) in prolog; expected '<'
at [row,col {unknown-source}]: [1,1].
Updated answer:
<dw:transform-message metadata:id="XXXXX" doc:name="Transform Message">
<dw:set-payload><![CDATA[
%output application/xml skipNullOn="everywhere"
%namespace ns0 localhost/getDetails:getDetailsWSD
---
{
ns0#getDetails: {
getDetailsOrder: {
ID: payload.ns0#getDetails.getDetailsOrder.ID,
AllData: payload.ns0#getDetails.getDetailsOrder.AllData
}
}
}]]>
</dw:set-payload>
</dw:transform-message>
In your scenario: you are passing a body in XML format and sometimes an empty body in your Postman requests.
Passing an empty body results your payload to be {NullPayload}. To handle this, we have to remove explicitly defining the input mime type: <dw:input-payload mimeType="application/xml"/>.
In your transformation: ID: payload.ns0#getDetails.getDetailsOrder.ID,. You are retrieving a value from an empty payload and this will fail. To avoid failing, we have added: skipNullOn="everywhere". You can read more about it here.
I have tried the transformation myself which results to this:
<?xml version='1.0' encoding='UTF-8'?>
<ns0:getDetails xmlns:ns0="http://localhost/getDetails:getDetailsWSD">
<getDetailsOrder/>
</ns0:getDetails>
I think we are done with your initial issue regarding transformation of your empty payload. Your concern now is consuming the web service.
Thank you.

Using WSO2 FHIR Connector

I'm trying the FHIR Connector with WSO2 EI 6.1.0
I'm following this documentation
The request for the create operation is:
{
"body": {
"base": "https://sqlonfhir-stu3.azurewebsites.net",
"type": "Patient",
"format": "json"
}
}
My proxy is:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="fhirTest"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="http,https">
<target>
<inSequence>
<property expression="json-eval($.body.base)"
name="base"
scope="default"
type="STRING"/>
<property expression="json-eval($.body.type)"
name="type"
scope="default"
type="STRING"/>
<property expression="json-eval($.body.format)"
name="format"
scope="default"
type="STRING"/>
<fhir.init>
<base>{$ctx:base}</base>
</fhir.init>
<fhir.create>
<type>{$ctx:type}</type>
<format>{$ctx:format}</format>
</fhir.create>
<send/>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
<parameter name="ApplicationXMLBuilder.allowDTD">true</parameter>
<description/>
</proxy>
After the request the response is (the body is void):
HTTP/1.1 202 Accepted
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Content-Type: text/html;charset=UTF-8
Content-Length: 0
Date: Fri, 05 May 2017 14:09:01 GMT
Server: WSO2 Carbon Server
but I get the following exception: DOCTYPE is not allowed
log:
[2017-05-05 16:09:01,192] [] INFO - LogMediator To: /services/fhirTest,From: 192.168.81.118,Direction: request,base1 = https://sqlonfhir-stu3.azurewebsites.net
,type1 = Patient,format1 = json,Payload: {
"body": {
"base": "https://sqlonfhir-stu3.azurewebsites.net",
"type": "Patient",
"format": "json"
}
}
[2017-05-05 16:09:01,704] [] ERROR - RelayUtils Error while building Passthrough stream
org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: DOCTYPE is not allowed
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:109)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:570)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:566)
at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:160)
at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:136)
at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:99)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.buildMessage(Axis2SynapseEnvironment.java:817)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:546)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:118)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:281)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:775)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:282)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:554)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:188)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:262)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.xml.stream.XMLStreamException: DOCTYPE is not allowed
at org.apache.axiom.util.stax.dialect.DisallowDoctypeDeclStreamReaderWrapper.next(DisallowDoctypeDeclStreamReaderWrapper.java:36)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
... 21 more
[2017-05-05 16:09:01,709] [] ERROR - Axis2SynapseEnvironment Error while building message
org.apache.axis2.AxisFault: Error while building Passthrough stream
at org.apache.synapse.transport.passthru.util.RelayUtils.handleException(RelayUtils.java:283)
at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:142)
at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:99)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.buildMessage(Axis2SynapseEnvironment.java:817)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:546)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:118)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:281)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:775)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:282)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:554)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:188)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:262)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: DOCTYPE is not allowed
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
at ...
[2017-05-05 16:11:03,952] [] WARN - SynapseCallbackReceiver Synapse received a response for the request with message Id : urn:uuid:c14afbec-7e12-4c9a-be5e-0746
53fed0e6 But a callback is not registered (anymore) to process this response
My questions are:
Has anyone been able to take the correct tests by following the guide?
How do I pass the other data to create the resource fhir (further base, type and format) as described here?
Thanks in advance
UPDATE: After I have enabled messageBuilder and messageFormatter (as suggested by Hariprasath) the previus error is resolved
but now I have an other error:
[2017-05-10 16:42:20,891] [] DEBUG - RelayUtils Content Type is application/fhir+json; charset=utf-8
[2017-05-10 16:42:20,893] [] ERROR - Axis2Sender Unexpected error during sending message out
java.lang.NullPointerException
at org.apache.coyote.http11.InternalNioOutputBuffer.addToBB(InternalNioOutputBuffer.java:211
This is because of the response is an HTML page(with the content-type is in text/html format). Usually, we need to enable the following formatter and builder to avoid this error and supports text/html format. Please add following message builders and formatters to the sections in /repository/conf/axis2/axis2.xml.
<messageBuilder contentType="text/html"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<messageFormatter contentType="text/html"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
Make sure that you add/enable builders and formatter for "text/html" in /repository/conf/axis2/axis2.xml file.
<messageFormatter contentType="text/html"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
[1] https://github.com/wso2-extensions/esb-connector-fhir/blob/master/src/test/INTEGRATION-TEST.txt

org.mule.module.ws.consumer.SoapFaultException... Message payload is of type: NullPayload

The inbound of the Web Service Soap Consumer states that the inbound of the component, even though I set the payload.
Here is an image of my flow (in action):
Here is the code behind the worfklow:
<flow name="getScope" doc:name="getScope">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8082" doc:name="HTTP" />
<echo-component doc:name="Echo"/>
<message-filter doc:name="Filter favicon">
<not-filter>
<wildcard-filter pattern="/favicon.ico" caseSensitive="true"/>
</not-filter>
</message-filter>
<set-payload doc:name="Set Payload" value="<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://xxxxx.xxxx.xxx/services/"><soapenv:Header/><soapenv:Body><ser:GetDetails><!--Optional:--><ser:request><ser:Code>xxxxxx</ser:Code></ser:request></ser:GetDetails></soapenv:Body></soapenv:Envelope>"/>
<message-properties-transformer name="contentTypeTextXML">
<add-message-property key="Content-Type" value="text/xml" />
</message-properties-transformer>
<echo-component doc:name="Echo"/>
<ws:consumer config-ref="WebService_xxxxxxxxxxxServiceBasicHttpEndpoint" operation="GetDetails" doc:name="Web Service Consumer Organisation"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
</flow>
Here is the log:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Mule is up and kicking (every 5000ms) +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
INFO 2014-05-27 23:43:54,004 [[traininggovau].connector.http.mule.default.receiver.02] org.mule.component.simple.LogComponent:
********************************************************************************
* Message received in service: getScope. Content is: '/' *
********************************************************************************
INFO 2014-05-27 23:43:54,015 [[traininggovau].connector.http.mule.default.receiver.02] org.mule.component.simple.LogComponent:
********************************************************************************
* Message received in service: getScope. Content is: '<soapenv:Envelope *
* xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" *
* xmlns:ser="http://traini...[100 of 291]' *
********************************************************************************
INFO 2014-05-27 23:43:54,267 [[traininggovau].connector.http.mule.default.receiver.02] org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default outbound transformer: org.mule.transport.http.transformers.ObjectToHttpClientMethodRequest
INFO 2014-05-27 23:43:54,275 [[traininggovau].connector.http.mule.default.receiver.02] org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default response transformer: org.mule.transport.http.transformers.MuleMessageToHttpResponse
INFO 2014-05-27 23:43:54,275 [[traininggovau].connector.http.mule.default.receiver.02] org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default outbound transformer: org.mule.transport.http.transformers.ObjectToHttpClientMethodRequest
INFO 2014-05-27 23:43:54,276 [[traininggovau].connector.http.mule.default.receiver.02] org.mule.lifecycle.AbstractLifecycleManager: Initialising: 'connector.https.mule.default.dispatcher.1981074383'. Object is: HttpsClientMessageDispatcher
INFO 2014-05-27 23:43:54,288 [[traininggovau].connector.http.mule.default.receiver.02] org.mule.lifecycle.AbstractLifecycleManager: Starting: 'connector.https.mule.default.dispatcher.1981074383'. Object is: HttpsClientMessageDispatcher
INFO 2014-05-27 23:43:58,409 [[traininggovau].connector.http.mule.default.receiver.02] org.mule.transport.http.HttpsClientMessageDispatcher: Received a redirect, but followRedirects=false. Response code: 500 Internal Server Error
ERROR 2014-05-27 23:43:58,480 [[traininggovau].connector.http.mule.default.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : An unexpected error occurred while trying to process your request. All details have been logged.. Message payload is of type: NullPayload
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. An unexpected error occurred while trying to process your request. All details have been logged.. Message payload is of type: NullPayload (org.mule.module.ws.consumer.SoapFaultException)
org.mule.module.ws.consumer.WSConsumer$1:164 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/module/ws/consumer/SoapFaultException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.module.ws.consumer.SoapFaultException: An unexpected error occurred while trying to process your request. All details have been logged.. Message payload is of type: NullPayload
at org.mule.module.ws.consumer.WSConsumer$1.process(WSConsumer.java:164)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:58)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

How can i resolve this MULE_ERROR-109

I am performing a transformation and getting the following error:
ERROR 2013-10-02 12:38:19,763 [[vistaesb].VistaESBFlow1.stage1.04] org.mule.exception.DefaultMessagingExceptionStrategy:
Message : Failed to transform from "json" to "personal_information"
Code : MULE_ERROR-109
Exception stack is:
1. Unrecognized field "phone_number" (Class personal_information), not marked as ignorable
at [Source: java.io.InputStreamReader#ac7e4af; line: 2, column: 21] (through reference chain: personal_information["phone_number"]) (org.codehaus.jackson.map.exc.UnrecognizedPropertyException)
org.codehaus.jackson.map.exc.UnrecognizedPropertyException:53 (null)
2. Failed to transform from "json" to "personal_information" (org.mule.api.transformer.TransformerException)
org.mule.module.json.transformers.JsonToObject:136 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html)
MY configuration is simple enough:
<flow name="VistaESBFlow1" doc:name="VistaESBFlow1">
<jdbc-ee:inbound-endpoint queryKey="personal_information" responseTimeout="1000" encoding="UTF-8" mimeType="text/plain" queryTimeout="-1" pollingFrequency="10000" connector-ref="applyVista_dev" doc:name="Data Entry Point">
</jdbc-ee:inbound-endpoint>
<json:object-to-json-transformer doc:name="Object to JSON"/>
<data-mapper:transform config-ref="new_mapping_grf" doc:name="DataMapper"/>
<json:json-to-object-transformer doc:name="JSON to Object" encoding="utf8" returnClass="personal_information" mimeType="text/plain"/>
<file:outbound-endpoint path="C:\Users\abrowning\Desktop\test" responseTimeout="10000" doc:name="File" encoding="utf8" mimeType="text/plain"/>
</flow>
There is a link to a similar problem here, 109 Error, but i don't think this has to do with my endpoint.
I'm guessing a 109 is a bush-league error, so nay help is appreciated.
The source of my issue was that I had a data mismatch in my get/set methods and after having written a lot of PHP over the last year, I over looked that.

Consuming a JAX-WS in a Mule ESB flow

I want to consume a JAX-WS service method. the methode is named find and accept a String as argument.
this the Mule flow :
<flow name="InvokeAWebServiceFlow1" doc:name="InvokeAWebServiceFlow1">
<file:inbound-endpoint path="C:\MuleStudio\SandBox\input" pollingFrequency="3000" responseTimeout="10000" doc:name="File"/>
<file:file-to-string-transformer encoding="UTF-8" mimeType="text/xml" doc:name="File to String"/>
<cxf:jaxws-client port="douaneWSPort" serviceClass="WSDL.DouaneWS" doc:name="SOAP" enableMuleSoapHeaders="true" operation="find"/>
<echo-component doc:name="Echo"/>
<file:outbound-endpoint path="C:\MuleStudio\SandBox\output" outputPattern="#[function:datestamp:dd-MM-yy]_#[function:systime].xml" responseTimeout="10000" doc:name="File"/>
</flow>
I put a argument into a file, in this exampl the argument is "ctr1" after i put the file into the inbound endpoint, after that the file is transformed into a String and goes to the JAX-WS client, finally the respponse is written into an output file.
when I run the flow I get as an output :
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:find xmlns:ns2="http://douane.ws/">
<id>ctr1</id>
</ns2:find>
</soap:Body>
</soap:Envelope>
the output is the SOAP the request instead of the expected SOAP Response, that should be somthing like:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:findResponse xmlns:ns2="http://douane.ws/">
<return>
<quality>medium</quality>
<price>150</price>
<idProd>ctr1</idProd>
</return>
</ns2:findResponse>
</S:Body>
</S:Envelope
>
.
The error generate is
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Started app 'invokeawebservice' +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
INFO 2013-05-14 11:13:15,024 [[invokeawebservice].connector.file.mule.default.receiver.01] org.mule.transport.file.FileMessageReceiver: Lock obtained on file: C:\MuleStudio\SandBox\input\input.txt
INFO 2013-05-14 11:13:15,155 [[invokeawebservice].InvokeAWebServiceFlow1.stage1.02] org.mule.component.simple.LogComponent:
********************************************************************************
* Message received in service: InvokeAWebServiceFlow1. Content is: *
* '<soap:Envelope *
* xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:find *
* xmlns:ns2...[100 of 173]' *
********************************************************************************
INFO 2013-05-14 11:13:15,184 [[invokeawebservice].connector.file.mule.default.dispatcher.01] org.mule.lifecycle.AbstractLifecycleManager: Initialising: 'connector.file.mule.default.dispatcher.2917880'. Object is: FileMessageDispatcher
INFO 2013-05-14 11:13:15,184 [[invokeawebservice].connector.file.mule.default.dispatcher.01] org.mule.lifecycle.AbstractLifecycleManager: Starting: 'connector.file.mule.default.dispatcher.2917880'. Object is: FileMessageDispatcher
INFO 2013-05-14 11:13:15,200 [[invokeawebservice].connector.file.mule.default.dispatcher.01] org.mule.transport.file.FileConnector: Writing file to: C:\MuleStudio\SandBox\output\14-05-13_1368522795199.xml
WARN 2013-05-14 11:13:15,261 [[invokeawebservice].InvokeAWebServiceFlow1.stage1.02] org.apache.cxf.phase.PhaseInterceptorChain: Interceptor for {http://douane.ws/}DouaneWSService#{http://douane.ws/}find has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Unexpected wrapper element {http://douane.ws/}find found. Expected {http://douane.ws/}findResponse.
at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:106)
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.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)
ERROR 2013-05-14 11:13:15,271 [[invokeawebservice].InvokeAWebServiceFlow1.stage1.02] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : Unexpected wrapper element {http://douane.ws/}find found. Expected {http://douane.ws/}findResponse.. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: String
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. Unexpected wrapper element {http://douane.ws/}find found. Expected {http://douane.ws/}findResponse. (org.apache.cxf.interceptor.Fault)
org.apache.cxf.interceptor.DocLiteralInInterceptor:106 (null)
2. Unexpected wrapper element {http://douane.ws/}find found. Expected {http://douane.ws/}findResponse.. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: String (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.interceptor.Fault: Unexpected wrapper element {http://douane.ws/}find found. Expected {http://douane.ws/}findResponse.
at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:106)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:799)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
Any help ??
If the webservice you want to consume is hosted, let's say at http://domain.com/ws , than your configuration should look like this:
<flow name="InvokeAWebServiceFlow1" doc:name="InvokeAWebServiceFlow1">
<file:inbound-endpoint path="C:\MuleStudio\SandBox\input" pollingFrequency="3000" responseTimeout="10000" doc:name="File"/>
<file:file-to-string-transformer encoding="UTF-8" mimeType="text/xml" doc:name="File to String"/>
<cxf:jaxws-client port="douaneWSPort" serviceClass="WSDL.DouaneWS" doc:name="SOAP" enableMuleSoapHeaders="true" operation="find"/>
<http:outbound-endpoint address="http://domain.com/ws" />
<echo-component doc:name="Echo"/>
<file:outbound-endpoint path="C:\MuleStudio\SandBox\output" outputPattern="#[function:datestamp:dd-MM-yy]_#[function:systime].xml" responseTimeout="10000" doc:name="File"/>
</flow>
You can find more informations on the topic here