[英]Apache Camel + Spring-WS + Authorization
I have a project using apache camel, and I have to consume a WS .. 我有一个使用apache骆驼的项目,我必须使用WS ..
.setHeader(HttpHeaders.AUTHORIZATION, constant("Basic {base64"))
.to("spring-ws:http://myhost.com.br?soapAction=myAction")
And I get the follow error : org.springframework.ws.client.WebServiceTransportException: Unauthorized [401] 而且我得到以下错误:org.springframework.ws.client.WebServiceTransportException:未经授权[401]
If I send using soap-ui just with the header, it's work well. 如果我仅在标题中使用soap-ui发送,则效果很好。
Any ideas? 有任何想法吗? Thanks a lot.
非常感谢。
From http://people.apache.org/~dkulp/camel/spring-web-services.html 来自http://people.apache.org/~dkulp/camel/spring-web-services.html
A custom message sender or factory in the registry can be referenced like this: 注册表中的自定义消息发件人或工厂可以像这样引用:
from("direct:example")
.to("spring-ws:http://foo.com/bar?messageFactory=#messageFactory&messageSender=#messageSender")
Spring configuration: 弹簧配置:
<!-- authenticate using HTTP Basic Authentication -->
<bean id="messageSender" class="org.springframework.ws.transport.http.CommonsHttpMessageSender">
<property name="credentials">
<bean class="org.apache.commons.httpclient.UsernamePasswordCredentials">
<constructor-arg index="0" value="admin"/>
<constructor-arg index="1" value="secret"/>
</bean>
</property>
</bean>
<!-- force use of Sun SAAJ implementation, http://static.springsource.org/spring-ws/sites/1.5/faq.html#saaj-jboss -->
<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
<property name="messageFactory">
<bean class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl"></bean>
</property>
</bean>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.