Hi,
I have the following type definition in my wsdl.
[html]<xs:complexType name="employeeType">
<xs:all>
<xs:element name="FirstName" type="xs:string" />
<xs:element name="LastName" type="xs:string" />
</xs:all>
</xs:complexType>[/html]
Then I have this definition for a list(array) of employees:
[html]<xs:complexType name="employeeListType">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="employee" type="usxs:employeeType" />
</xs:sequence>
</xs:complexType>[/html]
Then the wsdl defines the request and response types as:
[html]- <xs:complexType name="getAllEmployeesRequestType">
- <xs:complexContent mixed="false">
<xs:extension base="usxs:queryRequestType" />
</xs:complexContent>
</xs:complexType>
- <xs:complexType name="getAllEmployeesResponseType">
- <xs:complexContent mixed="false">
- <xs:extension base="usxs:queryResponseType">
- <xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="employees" type="usxs:employeeListType" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>[/html]
Given these details...how do I write my web method? I tried the following:
1. I created a class called "employee"
2. I created a web method "getAllEmployees"
In this method, I am creating an array of type employee and after populating values am returning this array.
But the output is something like this:
[html]- <ArrayOfEmployee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
- <employee>
<FirstName>Robin</FirstName>
<LastNameName>Sharma</LastName>
</employee>
- <employee>
<FirstName>Paulo</FirstName>
<LastNameName>Coelho</LastName>
</employee>
</ArrayOfEmployee>[/html]
I dont want the "ArrayOfEmployee" tag!! I need the employees to be within a <EmployeeList> tag!! How do I do this?