我试图在Spring集成中创建一个简单的SOAP Web服务代理。为此,我需要从客户端调用我的服务到服务即时代理传递给SOAPAction。不幸的是,在转换为Spring Integration Message对象时似乎丢失了这个值。 Message对象具有有效负载和标头。我期待在标题中找到SOAPAction(作为" ws_soapAction")但它不在那里。唯一的标题是replyChannel,errorChannel,id和timestamp。这些是标准的Spring Integration标头。我可以通过硬编码来设置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;
}
答案 0 :(得分:1)