web-services - Spring Boot SOAP Web 服务动态 WSDL 生成不起作用如果从请求负载元素中删除请求后缀

标签 web-services soap spring-boot wsdl spring-ws

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

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

但我需要请求元素像这样改变。
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "OTAHotelAvailNotifRQ")
@ResponsePayload
public OTAHotelAvailNotifRS getOTAHotelAvailNotifRQ(@RequestPayload OTAHotelAvailNotifRQ request) {

我在此链接 Spring web service dynamic wsdl not generating message for a schema element 上发现了类似的问题回答说我们需要在请求元素后添加后缀请求,如 AvailNotifRequest 但我想用 OTAHotelAvailNotifRQ 作为我的请求输入。
我该如何使用它,因为当我像这样更改请求输入时,我没有在 wsdl 中进行操作。

最佳答案

根据 official Spring-WS documentation :

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.



换句话说,您可以使用 setRequestSuffixsetResponseSuffixDefaultWsdl11Definition为了指定一个不同于默认的请求和响应后缀。在上述情况下,例如可能是:
wsdl11Definition.setRequestSuffix("RQ");
wsdl11Definition.setResponseSuffix("RS");

关于web-services - Spring Boot SOAP Web 服务动态 WSDL 生成不起作用如果从请求负载元素中删除请求后缀,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39094070/

相关文章:

c# - NetSuite SuiteTalk - 从 "SearchColumnSelectCustomField"检索值字符串

python - Spyne/RPClib - 如何响应 ComplexModel?

java - iPhone 到 Java EE 远程处理

android - 以编程方式完成时来自 SOAP 的响应不正确

web-services - 使用Delphi调用UPS包裹追踪Web服务吗?

java - 在 Eclipse : "wsdl:operation was not a request/response or one-way operation" 中验证期间出现奇怪的 WSDL 警告

java - CLIENT-CERT auth-method 可以与 tomcat 中的 JDBC 域一起使用吗?

docker - 用于 Spring Boot 构建错误的 Maven docker 插件

mysql - Spring数据JPA与MySQL服务器: case is ignored on Entity class by default

java - “基本”属性类型不应为持久性实体