SpringBoot SOAP webservice 动态 WSDL 生成不起作用如果从 RequestPayload 元素中删除请求后缀 [英] SpringBoot SOAP webservice Dynamic WSDL generation not working If remove Request suffix from RequestPayload element
问题描述
我正在使用 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 官方文档:
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屋!