简体   繁体   English

Spring-WS Apache Camel with Soap version 1.2

[英]Spring-ws apache Camel with soap version 1.2

I am working with spring-ws apache camel which by default supports soap 1.1. 我正在使用spring-ws apache骆驼,默认情况下它支持soap 1.1。 But I want to post a request binding it to soap 1.2 as my endpoint service supports only soap 1.2. 但是我想发布一个将其绑定到soap 1.2的请求,因为我的端点服务仅支持soap 1.2。 I tried setting up the messageFactory like the below in applicationContext.xml 我试图在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> 

then added it to RouteBuilder like, .to("spring-ws:https://"+url+"?soapAction=#xxx&wsAddressingAction=#xxx&messageFactory=#soapMessageFactory 然后将其添加到RouteBuilder中,如.to(“ spring-ws:https://” + url +“?soapAction =#xxx&wsAddressingAction =#xxx&messageFactory =#soapMessageFactory

But it doesn't work. 但这是行不通的。 Is there any other way to set the soap version in spring-ws component ? 还有其他方法可以在spring-ws组件中设置soap版本吗? I don't have access to the Webservice. 我无权访问Web服务。

Thanks 谢谢

I was running into a similar situation and took a slightly different approach to solve the issue. 我遇到了类似的情况,并采用了稍微不同的方法来解决该问题。 I created a custom WebServiceTemplate and attached my message factory to it. 我创建了一个自定义WebServiceTemplate并将消息工厂附加到它。 Then I specified the webServiceTemplate as part of the call in the RouteBuilder. 然后,在RouteBuilder中将webServiceTemplate指定为调用的一部分。 Here is the code: 这是代码:

@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;
}

And then in my route, I made the call like this: 然后在我的路线中,我像这样打了电话:

    .toD("spring-ws:{{some.service.url}}?webServiceTemplate=#webServiceTemplate&wsAddressingAction=http://test.org/SomeService/SomeOperation")

Hopefully this helps. 希望这会有所帮助。

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

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