繁体   English   中英

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

[英]Spring-ws: How to create Wsdl from an xsd with no “Request” element

尝试为客户端实现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>

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

默认的请求后缀是Request 默认响应后缀是Response ,尽管可以通过分别在<dynamic-wsdl />上设置requestSuffixresponseSuffix属性来更改它们。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM