Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3637

WCF REST parameter object is null

$
0
0

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?


Viewing all articles
Browse latest Browse all 3637

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>