Mule - 无法通过HTTP出站端点路由

时间:2014-05-08 09:47:48

标签: http exception mule mule-studio outbound

我有一个Mule流程,它将入站文件转换为某些XML,我希望将其发布到HTTP出站端点,但是当我尝试这样做时,我的流程失败了。我的流程如下:

<flow name="mainFlow" processingStrategy="synchronous">
   <file:inbound-endpoint name="fileIn" path="path/to/file"/>

   <file:file-to-string-transformer />

   <component class="CUSTOM JAVA CLASS TO CONVERT CSV INPUT TO BASIC XML"/>

   <mulexml:xml-to-dom-transformer returnClass="org.w3c.dom.Document"/>

   <!-- XSLT converts my Java-produced XML to a more complex structure for output -->
   <mulexml:xslt-transformer maxIdleTransformers="2" maxActiveTransformers="5" xsl-file="path/to/xsl"/>

   <object-to-string-transformer doc:name="Object to String"/>

   <!-- AT THIS POINT, THE PAYLOAD IS A STRING OF XML (payload=java.lang.String) -->

   <http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="hello" contentType="text/xml" method="POST" doc:name="HTTP"/>
</flow>

我得到的错误如下:

ERROR 2014-05-08 10:39:41,449 [[processes].consignmentInputFileConnector.receiver.02] org.mule.exception.CatchMessagingExceptionStrategy: 
********************************************************************************
Message               : Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=http://localhost:8081/hello, connector=HttpConnector
{
  name=connector.http.mule.default
  lifecycle=start
  this=45f8d5e5
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=true
  supportedProtocols=[http]
  serviceOverrides=<none>
}
,  name='endpoint.http.localhost.8081.hello', mep=REQUEST_RESPONSE, properties={http.method=POST, Content-Type=text/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--2
--------------------------------------------------------------------------------
Exception stack is:
1. Connection refused (java.net.ConnectException)
  java.net.PlainSocketImpl:-2 (null)
2. Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=http://localhost:8081/hello, connector=HttpConnector
{
  name=connector.http.mule.default
  lifecycle=start
  this=45f8d5e5
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=true
  supportedProtocols=[http]
  serviceOverrides=<none>
}
,  name='endpoint.http.localhost.8081.hello', mep=REQUEST_RESPONSE, properties={http.method=POST, Content-Type=text/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:155 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

我在此尝试实现的最终目标是评估从HTTP端点收到的响应代码,然后相应地继续。但是,到目前为止,我还没有成功发布。

1 个答案:

答案 0 :(得分:2)

你确定有人在监听http://localhost:8081/hello吗? java.net.ConnectException倾向于说相反。