Spring Boot SOAP Web 服务动态 WSDL 生成不起作用如果从 Request Payload 元素中删除 Request 后缀
SpringBoot SOAP webservice Dynamic WSDL generation not working If remove Request suffix from RequestPayload element
我正在使用 Spring Boot SOAP Webservice 示例项目创建 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) {
我在这个 link 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.
换句话说,您可以在 DefaultWsdl11Definition 上使用 setRequestSuffix
和 setResponseSuffix
来指定与默认后缀不同的请求和响应后缀。在上述情况下,例如可以是:
wsdl11Definition.setRequestSuffix("RQ");
wsdl11Definition.setResponseSuffix("RS");
我正在使用 Spring Boot SOAP Webservice 示例项目创建 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) {
我在这个 link 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.
换句话说,您可以在 DefaultWsdl11Definition 上使用 setRequestSuffix
和 setResponseSuffix
来指定与默认后缀不同的请求和响应后缀。在上述情况下,例如可以是:
wsdl11Definition.setRequestSuffix("RQ");
wsdl11Definition.setResponseSuffix("RS");