0

I have xsd schema below describe the

  <xs:element name="ReqStartTest">   
    <xs:complexType> 
        <xs:sequence> 
            <xs:element name="Version" >
                <xs:simpleType>
                    <xs:restriction base="xs:string" />
                </xs:simpleType>
            </xs:element>   
            <xs:element name="Time" >
                <xs:simpleType>
                    <xs:restriction base="xs:string" />
                </xs:simpleType>
            </xs:element>   
            <xs:element ref="tns:StartTestRequest" minOccurs="1" maxOccurs="1"></xs:element>
        </xs:sequence>
    </xs:complexType> 
</xs:element>    
<xs:element name="StartTestRequest">   
    <xs:complexType> 
        <xs:sequence> 
            <xs:element name="Name" >
                <xs:simpleType>
                    <xs:restriction base="xs:string" />
                </xs:simpleType>
            </xs:element>   
        </xs:sequence>
    </xs:complexType> 
</xs:element>   

After i generate java classes from xsd file, and recieve *.wsdl file. After i testing *.wsdl file in SOAPUI, I see just "StartTestRequest" request. My question, why/where my input data ("Version","Time") in request?

Thanks in advance.

1 Answers1

0

Spring only generates request/response for the elements that has the postfixes "request" and "response". In this case, you are referencing "StartTestRequest" from "ReqStartTest". So, you will only see "StartTestRequest" which only has the name field in it. You should extend or reference "ReqStartTest" in your "StartTestRequest"

Following should work fine.

<complexType name="ReqStartTest">
    <sequence>
        <element name="Version" type="string"/>
        <element name="Time" type="string"/>
    </sequence>
</complexType>

<element name="StartTestRequest">
    <complexType>
        <complexContent>
            <extension base="tns:ReqStartTest">
                <sequence>
                    <element name="Name" type="string"/>
                </sequence>
            </extension>
        </complexContent>
    </complexType>
</element>

Update:

Spring requires predefined suffixes to identify elements that are requests or responses of a web service. Default suffixes are "Request" and "Response". You can change it in the configuration. This thread might help you: Spring-ws: How to create Wsdl from an xsd with no "Request" element

Also this is the closest you will get without changing suffixes:

<element name="ReqStartTestRequest">
    <complexType>
        <sequence>
            <element name="version" type="string"/>
            <element name="time" type="string"/>
            <element name="startTestRequest" type="tns:StartTestRequest"/>
        </sequence>
    </complexType>
</element>

<complexType name="StartTestRequest">
    <sequence>
        <element name="name" type="string"/>
    </sequence>
</complexType>

I highly advise you to follow naming conventions. For example, first letter of a variable or non constant field should be lower case (camelcase notation).

Community
  • 1
  • 1
Çelebi Murat
  • 168
  • 11