gpt4 book ai didi

java - Spring-ws:如何从没有 "Request"元素的 xsd 创建 Wsdl

转载 作者:行者123 更新时间:2023-11-30 03:24:21 24 4
gpt4 key购买 nike

尝试为客户端实现 SOAP Web 服务,我需要一个 wsdl 文件来通过soapUI 测试该服务。但正如您在下面看到的,这个 xsd 没有 Request 和 Response 方法,所有请求和响应都被定义为基本 ServiceProvider 元素中的“类型”。因此,当我尝试通过 spring-ws 自动生成 wsdl 文件时,它不会生成正确的 wsdl,因为 Spring-ws 要求所有请求和响应元素名称应以“Request”“Response”结尾。

我能做什么?

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified" targetNamespace="http://myurl" xmlns="http://myurl">

<xs:element name="ServiceProviderT" nillable="false">
<xs:annotation>
<xs:documentation>ServiceProviderT is the message spec for data sent between TechX and service providers or
vendors</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Version" type="xs:string" nillable="false"/>
<xs:choice>
<xs:element name="Request" type="RequestType" nillable="false"/>
<xs:element name="Response" type="ResponseType" nillable="false"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
....

这就是我生成 wsdl 文件的方式

<sws:dynamic-wsdl id="myservice"
portTypeName="MyService"
locationUri="/myService"
targetNamespace="http://myurl">
<sws:xsd location="/schemas/my.xsd"/>
</sws:dynamic-wsdl>

最佳答案

没有这样的要求,这些只是默认值。这是解释here在 Spring-WS 引用指南中。它还解释了要设置哪些属性来覆盖这些默认值。

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.

<sws:dynamic-wsdl id="myservice"
portTypeName="MyService"
locationUri="/myService"
requestSuffix="YourRequestSuffixHere"
responseSuffix="YourResponseSuffixHere"
targetNamespace="http://myurl">
<sws:xsd location="/schemas/my.xsd"/>
</sws:dynamic-wsdl>

关于java - Spring-ws:如何从没有 "Request"元素的 xsd 创建 Wsdl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30620762/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com