soap - Mule ESB choice flow control route -
in mule have following flow : there choice flow control test input , verify if 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 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 when run them speratly, when add choice ccontrol 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 local 1 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 : invalid return type "class java.io.inputstream" specified transformer "jaxbmarshallertransformer" code : mule_error-266 -------------------------------------------------------------------------------- exception stack is: 1. invalid return type "class java.io.inputstream" specified 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: invalid return type "class java.io.inputstream" specified transformer "jaxbmarshallertransformer" @ org.mule.module.xml.transformer.jaxb.jaxbmarshallertransformer.dotransform(jaxbmarshallertransformer.java:122) @ org.mule.transformer.abstracttransformer.transform(abstracttransformer.java:411) @ org.mule.defaultmulemessage.getpayload(defaultmulemessage.java:362) + 3 more (set debug level logging or '-dmule.verbose.exceptions=true' everything) ********************************************************************************
i'm not sure if it's comming choice test expression ? altough cant find informations on how use choice control flow in details.
appreciate help. thank you.
mule default applies lot of transformers in flow convert payload required formats.
in case when there no choice router converts object returned xml string write file. choice router programmers responsibility provide transformer convert response object xml string.
add following mule-xml jaxb object xml transformer after choice router , before writing file-outbound.
..... </otherwise> </choice> <xm:jaxb-object-to-xml-transformer name="objecttoxml" jaxbcontext-ref="myjaxb" returnclass="java.lang.string" encoding="utf-8"/>
hope helps.
Comments
Post a Comment