我最近开始使用WSO2,我遇到了使用VFS写入文件的问题。
<?xml version="1.0" encoding="UTF-8"?><proxy xmlns="http://ws.apache.org/ns/synapse" name="PX_WriteToFile" transports="https,http,vfs" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<loopback/>
</inSequence>
<outSequence>
<payloadFactory media-type="xml">
<format>
<Fungus xmlns="">
<Info>$1 is a fungus with a $2 cap. It has $3 stem with $4 gills. It may be dangerous having $5</Info>
</Fungus>
</format>
<args>
<arg evaluator="xml" expression="//name"/>
<arg evaluator="xml" expression="//cap"/>
<arg evaluator="xml" expression="//stem"/>
<arg evaluator="xml" expression="//gill"/>
<arg evaluator="xml" expression="//toxin"/>
</args>
</payloadFactory>
<property name="transport.vfs.ReplyFileName" value="reply.txt" scope="transport" type="STRING"/>
<property name="OUT_ONLY" value="true" scope="default" type="BOOLEAN"/>
<send>
<endpoint>
<address uri="vfs:file://C:/vfs/reply"/>
</endpoint>
</send>
</outSequence>
</target>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.PollInterval">5</parameter>
<parameter name="transport.vfs.MoveAfterProcess">file://C:/vfs/map</parameter>
<parameter name="transport.vfs.FileURI">file://C:/vfs/reply</parameter>
<parameter name="transport.vfs.MoveAfterFailure">file://C:/vfs/maf</parameter>
<parameter name="transport.vfs.ContentType">text/xml</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
<description/>
</proxy>
执行此代理服务时,我得到了
[2015-06-03 16:57:24,377] WARN {SERVICE_LOGGER.PX_WriteToFile} - Executing fault handler due to exception encountered
[2015-06-03 16:57:24,378] WARN {SERVICE_LOGGER.PX_WriteToFile} - ERROR_CODE : 0 ERROR_MESSAGE : Unexpected error during sending message ou
t
[2015-06-03 16:57:24,379] INFO {SERVICE_LOGGER.PX_WriteToFile} - FaultHandler executing impl: org.apache.synapse.mediators.MediatorFaultHa
ndler
[2015-06-03 16:57:24,380] WARN {SERVICE_LOGGER.PX_WriteToFile} - Executing fault sequence mediator : fault
[2015-06-03 16:57:24,380] INFO {SERVICE_LOGGER.PX_WriteToFile} - To: , From: 136.227.134.115, WSAction: urn:mediate, SOAPAction: urn:media
te, ReplyTo: http://www.w3.org/2005/08/addressing/anonymous, MessageID: http://identifiers.wso2.com/messageid/1433365044366/4616446479, Dire
ction: response, MESSAGE = Executing default 'fault' sequence, ERROR_CODE = 0, ERROR_MESSAGE = Unexpected error during sending message out,
Envelope: <?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://www.w3.org/2
005/08/addressing"><s:Header>
</s:Header><s:Body><Fungus><Info>Silvercap is a fungus with a Blue, White and Pearlescent cap. It has No stem with Smooth gills. It may be d
angerous having Mercury comparable to Tuna/lb</Info></Fungus></s:Body></s:Envelope>
启用VFS(Receiver和Sender) 我尝试过使用
Writing on a text file using VFS in WSO2 ESB 4.8.1
作为没有运气的参考。
有什么我忽略的吗?
谢谢,
Additional Logging with Tracing enabled.
[2015-06-04 08:09:39,784] INFO {TRACE_LOGGER} - End : Property mediator
[2015-06-04 08:09:39,784] INFO {TRACE_LOGGER} - Start : Send mediator
[2015-06-04 08:09:39,785] INFO {TRACE_LOGGER} - Sending message through endpoint : null resolving to address = vfs:file:.=///C:/vfs/reply
[2015-06-04 08:09:39,785] INFO {TRACE_LOGGER} - SOAPAction: urn:mediate
[2015-06-04 08:09:39,785] INFO {TRACE_LOGGER} - WSA-Action: urn:mediate
[2015-06-04 08:09:39,811] WARN {TRACE_LOGGER} - Executing fault handler due to exception encountered
[2015-06-04 08:09:39,811] WARN {SERVICE_LOGGER.PX_WriteToFile} - Executing fault handler due to exception encountered
[2015-06-04 08:09:39,811] WARN {TRACE_LOGGER} - ERROR_CODE : 0
[2015-06-04 08:09:39,811] WARN {TRACE_LOGGER} - ERROR_MESSAGE : Unexpected error during sending message out
[2015-06-04 08:09:39,811] WARN {TRACE_LOGGER} - ERROR_DETAIL : org.apache.synapse.SynapseException: Unexpected error during sending message out
at org.apache.synapse.core.axis2.Axis2Sender.handleException(Axis2Sender.java:172)
at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:71)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:309)
at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:333)
at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:59)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:97)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:268)
at org.apache.synapse.mediators.builtin.LoopBackMediator.mediate(LoopBackMediator.java:42)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:166)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
at org.wso2.carbon.core.transports.CarbonServlet.doPost(CarbonServlet.java:231)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(CharacterSetFilter.java:61)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:178)
at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:49)
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:141)
at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:156)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:52)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.axis2.AxisFault: The VFS transport doesn't support synchronous responses. Please use the appropriate (out only) message exchange pattern.
at org.apache.synapse.transport.vfs.VFSTransportSender.sendMessage(VFSTransportSender.java:110)
at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.send(DynamicAxisOperation.java:185)
at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.executeImpl(DynamicAxisOperation.java:167)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:482)
at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:59)
... 48 more
[2015-06-04 08:09:39,811] WARN {TRACE_LOGGER} - ERROR_EXCEPTION : org.apache.synapse.SynapseException: Unexpected error during sending message out
[2015-06-04 08:09:39,811] WARN {SERVICE_LOGGER.PX_WriteToFile} - ERROR_CODE : 0 ERROR_MESSAGE : Unexpected error during sending message out
答案 0 :(得分:1)
在您的端点地址中,vfs:file://是协议,其余的是必须以/
开头的目录目录C:\ vfs \ reply必须存在
<send>
<endpoint>
<address uri="vfs:file:///C:/vfs/reply"/>
</endpoint>
</send>