如何使用WS Security Apache Camel调用WSDL



正在尝试调用WSDL服务,该服务在不使用Apache CXF的情况下使用Apache Camel的WS安全性。

这是如何完成的?

预先感谢。

来自Apache Camel而不使用Apache CXF

骆驼是一个集成框架(在端点之间传递消息)。没有骆驼端点(知道如何调用特定服务/技术)

so-如果要调用安全性的Web服务,则需要一些框架,这些框架可以签署或验证肥皂消息(您真的不想自己做)

示例如何使用骆驼和cxf:https://pastebin.com/alcnzfvf(此示例用于公开服务,而不是消耗/调用,但是原理是相同的,配置非常相似)

) )
 <camelcxf:cxfEndpoint id="egovAddressEndpoint"
                     address="/egov/api/external/AddressService"
                     xmlns:addr="http://address.ws.egov.xxx.com/v1_0/ws"
                     serviceName="addr:eGovAddressService"
                     endpointName="addr:AddressServicePortBinding" 
serviceClass="com.xxx.egov.ws.address.v1_0.ws.EGovAddressService">
    <!--        wsdlURL="classpath:com/xxx/egov/ws/address/v1_0/AddressService.wsdl"-->
    <camelcxf:properties>
        <entry key="dataFormat" value="PAYLOAD" />
<!-- maybe one of these is enough, I put both directives to be sure.
The intention is not to provide a password callback, but let the CXF
use an underlaying security context to authenticate and authorize users -->
        <entry key="ws-security.ut.no-callbacks" value="true"/>
        <entry key="ws-security.validate.token" value="false"/>
    </camelcxf:properties>
    <camelcxf:outInterceptors>
        <!--<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>-->
    </camelcxf:outInterceptors>
    <camelcxf:inInterceptors>
        <!--<bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>-->
        <ref component-id="wsSecInterceptor" />
        <ref component-id="authenticationInterceptor"/>  
        <ref component-id="authorizationInterceptor" />          
    </camelcxf:inInterceptors>
</camelcxf:cxfEndpoint>
<bean id="wsSecInterceptor" class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
    <argument>
        <map>
            <entry key="action" value="UsernameToken"/>
            <entry key="passwordType" value="PasswordText"/>
        </map>
    </argument>
</bean>    

最新更新