SpringBoot SOAP webservice 动态 WSDL 生成不起作用如果从 RequestPayload 元素中删除请求后缀 [英] SpringBoot SOAP webservice Dynamic WSDL generation not working If remove Request suffix from RequestPayload element

查看:26
本文介绍了SpringBoot SOAP webservice 动态 WSDL 生成不起作用如果从 RequestPayload 元素中删除请求后缀的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Spring Boot SOAP Webservice Sample 项目创建 SOAP Web 服务.如果我使用以下代码动态生成的 WSDL 显示操作.

I am creating SOAP web service using Spring Boot SOAP Webservice Sample project. If I use following code dynamically generated WSDL shows Operations.

@PayloadRoot(namespace = NAMESPACE_URI, localPart = "AvailNotifRequest")
@ResponsePayload
public OTAHotelAvailNotifRS getAvailNotif(@RequestPayload AvailNotifRequest request) {

但我需要请求元素像这样改变.

But I need request element to change like this.

@PayloadRoot(namespace = NAMESPACE_URI, localPart = "OTAHotelAvailNotifRQ")
@ResponsePayload
public OTAHotelAvailNotifRS getOTAHotelAvailNotifRQ(@RequestPayload OTAHotelAvailNotifRQ request) {

我在这个链接上发现了一个类似的问题 Spring Web 服务动态 wsdl 不为架构元素生成消息 回答说我们需要在请求元素后添加后缀请求,例如 AvailNotifRequest,但我想使用 OTAHotelAvailNotifRQstrong> 作为我的请求输入.我该如何使用它,因为当我像这样更改请求输入时,我没有在 wsdl 中进行操作.

I found a similar question on this link Spring web service dynamic wsdl not generating message for a schema element answer says we need to add suffix Request after request element like AvailNotifRequest but I want to use OTAHotelAvailNotifRQ as my request input. How can I use this because I am not getting operations in wsdl when I change request input like this.

推荐答案

根据 Spring-WS 官方文档:

使用约定从 XSD 模式构建 WSDL.它遍历模式中找到的所有元素元素,并为所有元素创建一条消息.接下来,它为所有以定义的请求或响应后缀结尾的消息创建 WSDL 操作.默认请求后缀为Request;默认的响应后缀是 Response,尽管可以通过分别在 上设置 requestSuffix 和 responseSuffix 属性来更改这些后缀.

The <dynamic-wsdl> builds a WSDL from a XSD schema by using conventions. It iterates over all element elements found in the schema, and creates a message for all elements. Next, it creates WSDL operation for all messages that end with the defined request or response suffix. The default request suffix is Request; the default response suffix is Response, though these can be changed by setting the requestSuffix and responseSuffix attributes on <dynamic-wsdl />, respectively.

换句话说,您可以在 DefaultWsdl11Definition 以指定与默认后缀不同的请求和响应后缀.在上述情况下,例如:

In other words you can use the setRequestSuffix and setResponseSuffix on DefaultWsdl11Definition in order to specify a request and response suffix different from the default one. In the above case that could for example be:

wsdl11Definition.setRequestSuffix("RQ");
wsdl11Definition.setResponseSuffix("RS");

这篇关于SpringBoot SOAP webservice 动态 WSDL 生成不起作用如果从 RequestPayload 元素中删除请求后缀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆