I am trying to create Webservice Simulator where we can create SOAP Webservices by just providing the .xsd
or xml
file. After providing xml/xsd
wsdl file will be generated and for that reason only i am trying to make ServiceEndPoint class methods generic so that single method provides response for all operations.
Till now i have made sample code to test how soap web service is generated using spring web service and uses JAXP APIs. I want to make following method generic so that it provides response to all operations :
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "getStudentRequest")
@ResponsePayload
public GetStudentResponse getCountry(@RequestPayload GetStudentRequest request) {
GetStudentResponse response = new GetStudentResponse();
response.setStudent(studentUtility.getStudent(request.getStudentId()));
return response;
As of now above method is binded to specific operation getStudentRequest
Please help me to know how can I make above method generic so that it provides response for all operations.
Please find below the xsd
file through which I am generating WSDL
file:
<xs:element name="getStudentRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="studentId" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getStudentResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="student" type="tns:student"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="student">
<xs:sequence>
<xs:element name="studentId" type="xs:int"/>
<xs:element name="name" type="xs:string"/>
<xs:element name="age" type="xs:int"/>
<xs:element name="class" type="xs:string"/>
</xs:sequence>
</xs:complexType>