Server Side :
Method 1:
[OperationContract(Action = "urn:getEmployee", Name = "getEmployee")]
[return: MessageParameter(Name = "getEmployeeReturn")]
Employee getEmployee(User user); // This works properly
Method 2:
[OperationContract(Action = "urn:getEmployees", Name = "getEmployees")]
[return: MessageParameter(Name = "getEmployeeReturn")] // Here is the issue - missing something ?
Employee[] getEmployees(User user);
Client Side: (proxy - we should not change this)
Method 1 Call:
[SoapDocumentMethod("urn:getEmployee", RequestNamespace = "http://employee.com", ResponseNamespace = "http://employee.com", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: XmlElement("getEmployeeReturn", Form = XmlSchemaForm.Unqualified, IsNullable = true)]
public Employee getEmployee([XmlElement(Form = XmlSchemaForm.Unqualified, IsNullable = true)] User user)
{
object[] arr_ = base.Invoke("getEmployee", new object[]
{
user
});
return (Employee)arr_[0]; // This works properly
}
Method 2 Call:
[SoapDocumentMethod("urn:getEmployees", RequestNamespace = "http://employee.com", ResponseNamespace = "http://employee.com", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: XmlArrayItem("elements", Form = XmlSchemaForm.Unqualified), XmlArray("getEmployeeReturn", Form = XmlSchemaForm.Unqualified, IsNullable = true)]
public Employee[] getEmployees([XmlElement(Form = XmlSchemaForm.Unqualified, IsNullable = true)] User user)
{
object[] arr_ = base.Invoke("getEmployees", new object[]
{
user
});
return (Employee[])arr_[0];
}
Problem:
Method 1 returns single object to client successfully, but Method 2 which returns the string ‘Employee[0]’ not the total array collection.
I know am missing something on [return] attribute of server side code of Method 2. Please help me... where am wrong ?