简体   繁体   中英

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

Trying to implement a SOAP Webservice for a client and I need a wsdl file to test the service by soapUI. But as you can see below, this xsd has no Request and Response methods, all requests and responses are defined as aa "type" in a base ServiceProvider element. So when I try to auto generate my wsdl file by spring-ws it does not generate a proper wsdl, because Spring-ws requires all requests and responses element names should end with "Request" "Response".

What can I do?

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

And this how I generate wsdl file

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

There is no such requirement those are just the defaults. This is explained here in the Spring-WS reference guide. It also explains which properties to set to override those defaults.

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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