I have created WCF REST API. I have implemented following service interface and service method for the API.
service interface:
[OperationContract][WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare)]ObjAPI GetAPIRequest(ObjAPI objAPI)
service :
public ObjAPI GetAPIRequest(ObjAPI objAPI){ return new ExternalAPI().GetAPIRequest(objAPI);}
code of ObjAPI
class
[System.Runtime.Serialization.DataContract(Namespace = "")] public class ObjAPI { [System.Runtime.Serialization.DataMember] public int ID { get; set; } [System.Runtime.Serialization.DataMember] public Client Client { get; set; } }}
My ObjAPI
contain another object Client
, then I have passed Following XML to the service.
<ObjAPI> <ID> 1 </ID><Client> < ClientNumber>0067HA000001</ ClientNumber></Client > </ ObjAPI >
But in the GetAPIRequest
method, ID field is getting its value and client object become null.
How can I fix this Issue?