Consider the Message contract type definition as shown below.
In this we are having array of Employee type as message header. When this converted to SOAP Header it looks as shown below.
Suppose you want to show the all employee detail in same level. We
can use MessageHeaderArray attribute which will serialize the array
element independently. If you use the MessageHeaderArray attribute of
Employees, SOAP message will look as shown below.
Note:
MessageHeaderArray Attribute is applicable only for Array, not for collection.
[MessageContract] public class Department { [MessageHeader] public string DepartmentID; [MessageHeader] public string DepartmentName; [MessageHeader] public Employees Employee(); }
<Department> <DepartmentID>PRO1243</DepartmentID> <DepartmentName>Production</DepartmentName> <Employees> <Employee>Sam</Employee> <Employee>Ram</Employee> <Employee>Raja</Employee> </Employees> </Department>
<Department> <DepartmentID>PRO1243</DepartmentID> <DepartmentName>Production</DepartmentName> <Employee>Sam</Employee> <Employee>Ram</Employee> <Employee>Raja</Employee> </Department>
No comments:
Post a Comment