3
我試圖在Spring集成中創建一個簡單的SOAP Web服務代理。爲了這個工作,我需要通過從客戶端調用我的服務到服務即時代理來傳遞給SOAPAction。不幸的是,似乎這個值在轉換爲Spring集成消息對象時丟失了。 Message對象有一個有效載荷和一個標題。我期待在頭文件中找到SOAPAction(如「ws_soapAction」),但它不在那裏。唯一的標題是replyChannel,errorChannel,id和時間戳。這些是標準的Spring Integration頭文件。我可以通過硬編碼來設置ws_soapAction,但這會使服務動態性下降。我已經嘗試了SOAP 1.1和SOAP 1.2。SOAP集成在Spring集成中未通過
這裏是應用程序:
@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;
}