简体   繁体   English

camel cxf-如何在电子邮件中发送肥皂请求响应

[英]camel cxf - how to send soap request response in email

Here is my spring configuration.

Spring.xml
-------------
<!-- Outgoing SOAP client endpoint -->
    <cxf:cxfEndpoint id="serviceEndpoint" address="${endpointAddress}"
        wsdlURL="${wsdlAddress}" endpointName="${portName}" serviceName="${serviceName}">

        <!-- The interceptors - needed to log the SOAP requests and responses -->
        <!-- They can be removed, when no logging is needed -->
        <cxf:inInterceptors>
            <ref bean="loggingInInterceptor" />
        </cxf:inInterceptors>
        <cxf:outInterceptors>
            <ref bean="loggingOutInterceptor" />
        </cxf:outInterceptors>
        <cxf:outFaultInterceptors>
            <ref bean="loggingOutInterceptor" />
        </cxf:outFaultInterceptors>
        <cxf:inFaultInterceptors>
            <ref bean="loggingInInterceptor" />
        </cxf:inFaultInterceptors>
<cxf:properties>
            <entry key="dataFormat" value="PAYLOAD" />          
        </cxf:properties>
    </cxf:cxfEndpoint>

    <http:conduit name="*.http-conduit">
        <http:tlsClientParameters disableCNCheck="${disableHostnameCheck}">
            <sec:keyManagers keyPassword="${keystorePassword}">
                <sec:keyStore type="JKS" password="${keystorePassword}"
                    file="${keystoreLocation}" />
            </sec:keyManagers>
            <sec:trustManagers>
                <sec:keyStore type="JKS" password="${truststorePassword}"
                    file="${truststoreLocation}" />
            </sec:trustManagers>
            <sec:cipherSuitesFilter>
                <!-- these filters ensure that a ciphersuite with export-suitable or 
                    null encryption is used, but exclude anonymous Diffie-Hellman key change 
                    as this is vulnerable to man-in-the-middle attacks -->
                <sec:include>.*_EXPORT_.*</sec:include>
                <sec:include>.*_EXPORT1024_.*</sec:include>
                <sec:include>.*_WITH_DES_.*</sec:include>
                <sec:include>.*_WITH_AES_.*</sec:include>
                <sec:include>.*_WITH_NULL_.*</sec:include>
                <sec:exclude>.*_DH_anon_.*</sec:exclude>
            </sec:cipherSuitesFilter>
        </http:tlsClientParameters>
        <http:client AutoRedirect="true" Connection="Keep-Alive"
            ReceiveTimeout="${connectionTimeout}" ConnectionTimeout="${connectionTimeout}" />
    </http:conduit>

Here is the Camel route configuration
-------------
<from ...
<to uri="cxf:bean:serviceEndpoint" />

This works well and we can have the soap request/response logged into the log file. Here soap request with soap header is generated by cxf.

Do we have a way to capture the soap request and response into camel Exchange? 我们是否可以将肥皂请求和响应捕获到骆驼交换中? I have to send an email attached with soap request and response if the service call is failed. 如果服务呼叫失败,我必须发送一封附带肥皂请求和响应的电子邮件。 Have tried using thread local but it doesn't seems to work expected. 尝试使用本地线程,但似乎无法正常工作。

Suggestion: 建议:

You have it in CXF Interceptors - take a look at them. 您已经在CXF拦截器中拥有它-看一下它们。

I guess, you can send your e-mail out of it. 我想,您可以从中发送电子邮件。

Start from org.apache.cxf.phase.AbstractPhaseInterceptor class - there are bunch of different ones for different phases. org.apache.cxf.phase.AbstractPhaseInterceptor类开始-针对不同的阶段有很多不同的类。

PS From first glance org.apache.cxf.binding.soap.saaj.SAAJInInterceptor and org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor could be good candidates... PS乍一看, org.apache.cxf.binding.soap.saaj.SAAJInInterceptororg.apache.cxf.binding.soap.saaj.SAAJOutInterceptor都是不错的选择...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM