Spring 集成中未通过 SOAPAction
SOAPAction not passed through in Spring Integration
我正在尝试在 Spring 集成中创建一个简单的 SOAP Web 服务代理。为此,我需要从调用我的服务的客户端传递到 SOAPAction 到我正在代理的服务。不幸的是,这个值似乎在转换为 Spring 集成消息 object 时丢失了。消息 object 有一个负载和一个 header。我期待在 header(如 "ws_soapAction")中找到 SOAPAction,但它不在那里。仅有的 header 是 replyChannel、errorChannel、id 和 timestamp。这些是标准 Spring 集成 header。我可以通过硬编码来设置 ws_soapAction,但这会使服务的动态性大大降低。我已经尝试过 SOAP 1.1 和 SOAP 1.2。
这是应用程序:
@SpringBootApplication
public class OmgApplication {
public static void main(String[] args) {
SpringApplication.run(OmgApplication.class, args);
}
@Autowired
MarshallingWebServiceInboundGateway entryPoint;
@Autowired
MarshallingWebServiceOutboundGateway omgGateway;
@Bean
IntegrationFlow flow() {
return IntegrationFlows.from(entryPoint)
.handle(omgGateway)
.get();
}
}
以及网关:
@Bean
MarshallingWebServiceInboundGateway entryPoint() {
MarshallingWebServiceInboundGateway entryPoint = new MarshallingWebServiceInboundGateway(jaxb2Marshaller());
entryPoint.setHeaderMapper(new DefaultSoapHeaderMapper());
return entryPoint;
}
@Bean
MarshallingWebServiceOutboundGateway omgGateway() {
MarshallingWebServiceOutboundGateway omgGateway = new MarshallingWebServiceOutboundGateway(
"https://url.to.the/service", jaxb2Marshaller(), jaxb2Marshaller()
);
omgGateway.setHeaderMapper(new DefaultSoapHeaderMapper());
return omgGateway;
}
这将在 4.2 中可用。参见 this JIRA。
4.2 候选版本将于本周发布,实际发布时间为 9 月初。
目前在 4.2.0.BUILD-SNAPSHOT
可用。
但是 JIRA 也有针对早期版本的解决方法。
我正在尝试在 Spring 集成中创建一个简单的 SOAP Web 服务代理。为此,我需要从调用我的服务的客户端传递到 SOAPAction 到我正在代理的服务。不幸的是,这个值似乎在转换为 Spring 集成消息 object 时丢失了。消息 object 有一个负载和一个 header。我期待在 header(如 "ws_soapAction")中找到 SOAPAction,但它不在那里。仅有的 header 是 replyChannel、errorChannel、id 和 timestamp。这些是标准 Spring 集成 header。我可以通过硬编码来设置 ws_soapAction,但这会使服务的动态性大大降低。我已经尝试过 SOAP 1.1 和 SOAP 1.2。
这是应用程序:
@SpringBootApplication
public class OmgApplication {
public static void main(String[] args) {
SpringApplication.run(OmgApplication.class, args);
}
@Autowired
MarshallingWebServiceInboundGateway entryPoint;
@Autowired
MarshallingWebServiceOutboundGateway omgGateway;
@Bean
IntegrationFlow flow() {
return IntegrationFlows.from(entryPoint)
.handle(omgGateway)
.get();
}
}
以及网关:
@Bean
MarshallingWebServiceInboundGateway entryPoint() {
MarshallingWebServiceInboundGateway entryPoint = new MarshallingWebServiceInboundGateway(jaxb2Marshaller());
entryPoint.setHeaderMapper(new DefaultSoapHeaderMapper());
return entryPoint;
}
@Bean
MarshallingWebServiceOutboundGateway omgGateway() {
MarshallingWebServiceOutboundGateway omgGateway = new MarshallingWebServiceOutboundGateway(
"https://url.to.the/service", jaxb2Marshaller(), jaxb2Marshaller()
);
omgGateway.setHeaderMapper(new DefaultSoapHeaderMapper());
return omgGateway;
}
这将在 4.2 中可用。参见 this JIRA。
4.2 候选版本将于本周发布,实际发布时间为 9 月初。
目前在 4.2.0.BUILD-SNAPSHOT
可用。
但是 JIRA 也有针对早期版本的解决方法。