简体   繁体   English

如何向被请求方发送客户端的 SOAP 响应

[英]How to send a SOAP response of Client to Requested party

I'm developing a Spring Boot application that is acting as a channel between 2 components.我正在开发一个 Spring 引导应用程序,它充当两个组件之间的通道。 which consume SOAP Request and Produces SOAP Response.它消耗 SOAP 请求并产生 SOAP 响应。

eg:-例如:-

A -> calling party A -> 主叫方
B -> My Component B -> 我的组件
C -> client party. C -> 客户方。

A<->B<->C A<->B<->C

Previously A and C are connecting to each other directly through SOAP operations.以前 A 和 C 是通过 SOAP 操作直接相互连接的。 C party is using RPC encoded WSDL. C 方使用 RPC 编码的 WSDL。

I have deployed the party C WSDL interface using the below code.我已经使用以下代码部署了方 C WSDL 接口。 As I need to forward the Request to C and Process Request from A.因为我需要将请求转发给 C 并处理来自 A 的请求。

Creating Endpoint using @Endpoint annotation as below and @XPathParam to read tag value.使用如下@Endpoint注释和@XPathParam创建端点来读取标签值。

I want to return that SOAP response to Party A. which is coming from Party C.我想将 SOAP 响应返回给甲方。这是来自 C 方。 But Cannot figure out how to return the SOAP response coming from C to A.但无法弄清楚如何将来自 C 的 SOAP 响应返回给 A。

A hint would be helpful.一个提示会很有帮助。

@Bean
public Wsdl11Definition wsdl11Definition(){
  SimpleWsdl11Definition simpleWsdl11Definition = new SimpleWsdl11Definition();
  simpleWsdl11Definition.setWsdl(new ClassPathResource("/wsdl/calculator.wsdl"));
  return simpleWsdl11Definition;
}

@Bean
public ServletRegistrationBean<MessageDispatcherServlet>
  messageDispatcherServlet(ApplicationContext applicationContext){
  MessageDispatcherServlet messageDispatcherServlet = new MessageDispatcherServlet();
  messageDispatcherServlet.setApplicationContext(applicationContext);
  return new ServletRegistrationBean<>(messageDispatcherServlet, "/medium/ws/*");
}
@ResponsePayload
@PayloadRoot(namespace = "http://medium.com/types/calculator", localPart = "AdditionInput")
public Output addition(@XPathParam("lineId") String lineID){
  // Calling Party C and creating Request Using Apache Axis tool for party C
  // String response = SOAP Response from Party C.
}

I have deployed Client WSDL as we are consuming request and forwarding this request to C.我已经部署了客户端 WSDL,因为我们正在使用请求并将此请求转发到 C。 So, I have created my one Object and Mapped value of C Response in Object.所以,我在 Object 中创建了我的一个 Object 和 C 响应的映射值。 I have return that Object in Response.我已经返回 Object 作为响应。 Using Interceptor, I have converted that Object to desired Response.使用拦截器,我已将 Object 转换为所需的响应。

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

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