我正在使用spring-ws apache camel,它默认支持SOAP1.1。但是我想发布一个将其绑定到SOAP1.2的请求,因为我的端点服务只支持SOAP1.2。我尝试在applicationContext.xml中像下面这样设置messageFactory
<bean id="soapMessageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory"> <property name="soapVersion">
<util:constant static-field="org.springframework.ws.soap.SoapVersion.SOAP_12"/>
</property>
</bean> 然后将其添加到spring中,如.to(“RouteBuilder -ws:https://"+url+"?soapAction=#xxx&wsAddressingAction=#xxx&messageFactory=#soapMessageFactory
但它不起作用。有没有其他方法可以在spring-ws组件中设置soap版本?我没有访问the服务的权限。
谢谢
发布于 2018-07-25 23:22:43
我遇到了类似的情况,并采取了略有不同的方法来解决这个问题。我创建了一个自定义WebServiceTemplate,并将我的消息工厂附加到它。然后,我在RouteBuilder中指定webServiceTemplate作为调用的一部分。代码如下:
@Bean
public WebServiceTemplate webServiceTemplate() throws Exception {
final MessageFactory msgFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
final SaajSoapMessageFactory messageFactory = new SaajSoapMessageFactory(msgFactory);
final WebServiceTemplate webServiceTemplate = new WebServiceTemplate(messageFactory);
return webServiceTemplate;
}然后在我的路线上,我打了这样的电话:
.toD("spring-ws:{{some.service.url}}?webServiceTemplate=#webServiceTemplate&wsAddressingAction=http://test.org/SomeService/SomeOperation")希望这能有所帮助。
https://stackoverflow.com/questions/51411330
复制相似问题