org.mule.api.transport.DispatchException - 消息有效内容的类型为:PostMethod

时间:2014-12-23 09:58:38

标签: soap https mule esb

我在通过https连接器发送请求时遇到了问题。当我在SoapUi准备模拟时,没有任何问题,但现在我正在尝试与其他系统集成。看起来标题可能有问题,但我不知道究竟是什么......我在这个样本中做了地址。

    <message-properties-transformer>
        <add-message-property key="SOAPAction" value="http://address"/>
    </message-properties-transformer>
    <logger level="INFO" message="#[payload]" />

    <https:outbound-endpoint  exchange-pattern="request-response" address="${adapter.ws.endpoint}"
        responseTransformer-refs="dom2xml-transformer" connector-ref="httpsConnector">
        <cxf:proxy-client payload="body"
            enableMuleSoapHeaders="false">
            <cxf:inInterceptors>
                <spring:ref bean="cxfLoggingInInterceptor" />
            </cxf:inInterceptors>
            <cxf:inFaultInterceptors>
                <spring:ref bean="cxfLoggingInInterceptor" />
            </cxf:inFaultInterceptors>
            <cxf:outInterceptors>
                <spring:ref bean="WssOutInterceptor" />
                <spring:ref bean="cxfLoggingOutInterceptor" />
            </cxf:outInterceptors>
            <cxf:outFaultInterceptors>
                <spring:ref bean="cxfLoggingOutInterceptor" />
            </cxf:outFaultInterceptors>
        </cxf:proxy-client>
    </https:outbound-endpoint>

和堆叠:

 Interceptor for {http://support.cxf.module.mule.org/}ProxyService#{http://support.cxf.module.mule.org/}invoke has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=https://10.100.100.100:443/ws/, connector=HttpsConnector
{
  name=httpsConnector
  lifecycle=start
  this=3c9519b9
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=true
  supportedProtocols=[https]
  serviceOverrides=<none>
}
,  name='endpoint.https.10.100.100.100.443.ws', mep=REQUEST_RESPONSE, properties={}, 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
        at org.mule.module.cxf.transport.MuleUniversalConduit$2.handleMessage(MuleUniversalConduit.java:198)
Caused by: org.apache.commons.lang.SerializationException: java.io.OptionalDataException
        at org.mule.util.SerializationUtils.deserialize(SerializationUtils.java:89)
        at org.mule.util.SerializationUtils.deserialize(SerializationUtils.java:127)
        at org.mule.util.SerializationUtils.deserialize(SerializationUtils.java:41)
        at org.mule.session.SerializeAndEncodeSessionHandler.retrieveSessionInfoFromMessage(SerializeAndEncodeSessionHandler.java:44)
        at org.mule.transport.AbstractMessageDispatcher.process(AbstractMessageDispatcher.java:85)
        ... 555 more
Caused by: java.io.OptionalDataException
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1368)

Exception stack is:
1. null (java.io.OptionalDataException)
  java.io.ObjectInputStream:1368 (null)
2. java.io.OptionalDataException (org.apache.commons.lang.SerializationException)
  org.mule.util.SerializationUtils:89 (null)
3. Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=https://10.100.100.100:443/ws, connector=HttpsConnector
{
  name=httpsConnector
  lifecycle=start
  this=3c9519b9
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=true
  supportedProtocols=[https]
  serviceOverrides=<none>
}
,  name='endpoint.https.10.100.100.100.443.ws', mep=REQUEST_RESPONSE, properties={}, 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.AbstractMessageDispatcher:109 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.io.OptionalDataException
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1368)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
        at org.mule.session.DefaultMuleSession.readObject(DefaultMuleSession.java:293)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

来自回复的标题:

X-MULE_ENCODING UTF-8
#status# HTTP/1.1 200 OK
http.method POST // ?? should it be there?
X-MULE_CORRELATION_SEQUENCE -1
Connection Keep-Alive
Server Mule Core/3.5.0
Date Tue, 23 Dec 2014 12:04:49 GMT
Transfer-Encoding chunked
Via 1.1 pl.service.pl
Keep-Alive timeout=15, max=100
Content-Type text/xml; charset=UTF-8
X-MULE_SESSION rO0ABXNyACNvcmcubXVsZS5zZXNzaW9uLkRlZmF1bHRNdWxlU2Vzc2lvbi7rdtEW7GGKAwAFWgAFdmFsaWRMAA1mbG93Q29uc3RydWN0dAAmTG9yZy9tdWxlL2FwaS9jb25zdHJ1Y3QvRmxvd0NvbnN0c

1 个答案:

答案 0 :(得分:0)

问题出在X-MULE_SESSION中。如果两个服务使用mule esb,它应该在同一个Mule Session中实现。有一个解决方法:

<https:connector name="httpsNoSessionConnector">
     <service-overrides sessionHandler="org.mule.session.NullSessionHandler" />
</https:connector>

这个答案贴在那里: Delete MULE_SESSION header from outbound HTTP call