首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >403号禁止与骆驼和cxf一起使用wss4jOutInterceptor

403号禁止与骆驼和cxf一起使用wss4jOutInterceptor
EN

Stack Overflow用户
提问于 2016-06-17 07:14:59
回答 1查看 848关注 0票数 1

首先要做的是:

  • 与骆驼和cxf的战争(尝试了最新版本,实际上分别尝试了2.12.0和2.7.6 )。
  • 一个简单的骆驼路线,没有过程,只是从-登录到。
  • 最后的目标是将添加到SOAP消息中。

Configuration:

application-context.xml

代码语言:javascript
复制
<!-- Import for camel config and beans -->    
<import resource="./cxf-beans-testws.xml" />
<import resource="./camel-testws.xml" />

camel-testws.xml

代码语言:javascript
复制
<!-- CAMEL CONTEXT -->
<camelContext id="camelContextTest" xmlns="http://camel.apache.org/schema/spring">
    <!-- CAMEL ROUTE -->
    <route id="TestWSRoute">
        <description>
            Camel route for testws
        </description>
        <from uri="cxf:bean:serviceTestProvider" />
        <log message="Process" loggingLevel="DEBUG" />
        <to uri="cxf:bean:serviceTestClient" />
    </route>
</camelContext>

cxf-beans-testws.xml (只是相关部分)

代码语言:javascript
复制
<bean id="wss4JOutInterceptorRea" class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
    <constructor-arg>
        <map>
            <entry key="action" value="Encrypt Signature"/>
            <entry key="useSingleCertificate" value="true" />
            <entry key="user" value="xxxx" />
            <entry key="signaturePropRefId" value="signaturePropertiesBean" />
            <entry key="signaturePropertiesBean" value-ref="signaturePropertiesTest" />
            <entry key="signatureUser" value="${test.signature.certificate.alias}" />
            <entry key="passwordCallbackRef" value-ref="clientCallbackTest" />
            <entry key="signatureAlgorithm" value="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
            <entry key="signatureKeyIdentifier" value="DirectReference" />
            <entry key="signatureParts" value="{Element}{http://schemas.xmlsoap.org/soap/envelope/}Body" />
            <entry key="encryptionUser" value="${test.encryption.certificate.alias}" />
            <entry key="encryptionPropRefId" value="encryptionPropertiesBean" />
            <entry key="encryptionPropertiesBean" value-ref="encryptionPropertiesTest" />
        </map>
    </constructor-arg>
</bean>

当我调用web服务公开(serviceTestProvider)时,SOAP消息出现,日志出现,WSS配置被放置。然后消息被发送到endPoint..。并总是返回:

代码语言:javascript
复制
HTTP response '403: Forbidden' when communicating with http://...

如果我删除了wss4jOutInterceptor,那么响应就是没有wss安全性(预期响应)。

但是,如果我将日志级别设置为调试,那么在所有拦截器链处理之后,从日志中获取出站消息,然后从REST控制台或SoapUI手动发送.那就行了,第403号。因此,这一信息似乎已形成良好的形式。这两个调用都是从同一台计算机发出的,没有代理或类似的。

代码语言:javascript
复制
2016-06-17 08:59:12 INFO  WSTestCXFService:234 - Outbound Message
---------------------------
ID: 4
Address: http://correct-ws-url
Http-Method: POST
Content-Type: text/xml;charset=UTF-8
Headers: {Accept=[text/xml;charset=UTF-8], accept-encoding=[gzip,deflate], breadcrumbId=[ID-MACHINENAME-55387-1466145154908-1-4], Cache-Control=[No-Cache], Connection=[Keep-Alive], host=[correct-host], SOAPAction=[method], User-Agent=[Apache-HttpClient/4.1.1 (java 1.5)]}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" soap:mustUnderstand="1">...</wsse:Security></SOAP-ENV:Header><soap:Body xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="id-5"><xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" Id="ED-4" Type="http://www.w3.org/2001/04/xmlenc#Content">...</xenc:EncryptedData></soap:Body></soap:Envelope>

没有https,只有http端点。尝试用导管添加标题,只是为了匹配REST控制台或SoapUI原始消息,而没有运气。有猜到吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-12-07 10:16:38

最后,这是一个Windows/网络问题。几天后(2-3),没有任何变化.开始起作用了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37875327

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档