Spring-ws:如何从没有"请求"的xsd创建Wsdl。元件

时间:2015-06-03 12:56:07

标签: java spring soapui spring-ws

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

我该怎么办?

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

1 个答案:

答案 0 :(得分:2)

没有这样的要求那些只是默认值。 Spring-WS参考指南中对此进行了解释here。它还解释了要设置哪些属性来覆盖这些默认值。

  

默认请求后缀为Request;默认响应后缀为Response,但可以通过在{{1}上设置 requestSuffix responseSuffix 属性来更改这些后缀}, 分别。

<dynamic-wsdl />