Spring-WS:如何从没有“ Request”元素的xsd创建Wsdl

问题描述

没有这样的 要求, 这些只是认值。这说明这里的春天-WS参考指南的 它还说明了要设置哪些属性以覆盖这些认值。

认的请求后缀为Request; 认响应后缀为Response,尽管可以分别通过将 和 属性设置为来更改它们<dynamic-wsdl />

<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>

解决方法

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