2013-03-19 42 views
0

將啓用MTOM到JBoss中7上運行的業務服務後,我們發現,通過SOAP請求通過騾子現在導致錯誤: -騾子MTOM運輸出境驗證錯誤

<faultstring>An exception occurred while invoking message processor "DefaultMessageProcessorChain '(inner iterating chain) of OutboundEndpoint 'http://127.0.0.1:8280/communication' request chain' 
[ 
    org.mule.endpoint.outbound.OutboundEventTimeoutMessageProcessor, 
    org.mule.endpoint.outbound.OutboundSessionHandlerMessageProcessor, 
    org.mule.endpoint.outbound.OutboundEndpointPropertyMessageProcessor, 
    org.mule.endpoint.outbound.OutboundResponsePropertiesMessageProcessor 
]" with transaction "Transaction{factory=null, action=NEVER, timeout=0}".. Message payload is of type: PostMethod</faultstring> 

這似乎所致驗證錯誤發生在服務響應中的有效內容被傳遞迴SOAPUI之前進行驗證時發生。檢查騾子的日誌文件,這是記錄:

Caused by: org.apache.cxf.binding.soap.SoapFault: Error reading XMLStreamReader. 
    at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:222) 
    at ... 80 more 
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '-' (code 45) in prolog; expected '<' 
at [row,col {unknown-source}]: [1,1] 
    at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:644) 
    at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2003) 
    at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1100) 
    at com.ctc.wstx.sr.BasicStreamReader.nextTag(BasicStreamReader.java:1123) 
    at org.mule.module.xml.stax.DelegateXMLStreamReader.nextTag(DelegateXMLStreamReader.java:242) 
    at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:122) 
    ... 90 more 

的錯誤似乎發生,因爲MULE試圖解析SOAP響應,XML在validatingStreamReader,而實際上SOAP信封頭中的以下文字:

[------=_Part_22_1884954755.1363694621407 Content-Type:application/xop+xml;charset=utf-8;type="text/xml" 

<SOAP-ENV:Envelope..... 

所以驗證失敗,因爲MtoM標記使SOAP數據包格式不正確。

下面是我的騾子配置

<!-- Primary Choice router is used to forward requests to the wsdl proxy 
     and SOAPflow this should be the only endpoint that is exposed to the public 
     domain. --> 
    <flow name="SOAInboundRouter"> 
     <!-- public inbound listener --> 
     <inbound-endpoint address="${web.inboundAddress}" 
      exchange-pattern="request-response" /> 

     <!-- Outbound filter for routing requests --> 
     <choice> 
      <when> 
       <regex-filter pattern="soap" /> 
       <outbound-endpoint 
        address="${soa.inboundAddress}#[header:inbound:http.request]" 
        exchange-pattern="request-response" /> 
      </when> 
     </choice> 

    </flow> 

    <!-- Flow used for SOAP request processing, this implements a callback to 
     check the SOAP header for the correct username token for WS-Security request 
     are passed to this flow by the Flow SOAInboundRouter. This endpoint is not 
     for use in the public domain. --> 

    <flow name="SoapFlow"> 
     <!-- http listener for SOAP requests --> 
     <inbound-endpoint address="${soa.inboundAddress}" 
      exchange-pattern="request-response"> 
      <cxf:proxy-service service="" namespace=""> 
       <!-- WS-Security intercetor applied to the inbound request --> 
       <cxf:inInterceptors> 
        <spring:ref bean="cxfSecurityInterceptor" /> 
       </cxf:inInterceptors> 

      </cxf:proxy-service> 
     </inbound-endpoint> 

     <!--Success on authentication request is passed to outbound router this 
      is the actual service --> 
     <outbound-endpoint 
      address="${soa.outboundAddress}#[header:inbound:http.request]" 
      exchange-pattern="request-response"> 
      <cxf:proxy-client /> 
     </outbound-endpoint> 

    </flow> 

    <!-- application configuration --> 
    <spring:bean id="cxfSecurityInterceptor" 
     class="uk.co.weatherbys.security.esb.cxf.CXFSecurityInterceptor" 
     scope="prototype"> 
     <spring:constructor-arg value="${mule.userfile}" /> 
     <spring:property name="wServiceHeaderDelegate" ref="wServiceHeaderDelegate" /> 
     <spring:property name="cxfWsSecurityDelegate" ref="cXfWsSecurityDelegate" /> 
    </spring:bean> 

    <spring:bean id="wServiceHeaderDelegate" 
     class="uk.co.weatherbys.security.esb.cxf.WServiceHeaderDelegate"> 
    </spring:bean> 

    <spring:bean id="cXfWsSecurityDelegate" 
     class="uk.co.weatherbys.security.esb.cxf.CxfWsSecurityDelegate"> 
    </spring:bean> 

我到處檢查了一個解決方案,但不能找到一個。有沒有人有什麼建議? 可以以某種方式關閉出站驗證嗎?我是否需要配置一個轉換器來處理這個非標準的頭信息?我需要新的流程嗎?

感謝

回答

1

我見過wereby的CXF代理是多部分/相關變更內容類型之前,類似的東西;類型= 「應​​用/ XOP + xml」 的; .....回覆爲「text/plain」。

您可以登錄Content-Type和嘗試手動設置或複製的內容類型類似於:

<code> 
    <message-properties-transformer> 
    <add-message-property key="Content-Type" value="#[header:Content-Type]" /> 
    </message-properties-transformer> 
</code> 

http://forums.mulesoft.org/message.jspa?messageID=9152 和向下滾動或搜索 「wstx」

+0

魔術!謝謝,這種內容類型是一個很棒的地方。 – user2187306 2013-03-21 14:47:12

+1

mulesoft鏈接似乎不再工作:(..你有新的鏈接? – edbras 2015-12-14 16:52:38