When you are working with WCF service for the first time, generally you will get this error for some reason. Here is the description of the error:
Solution:
Those nulls are due to error in generating the proxy for the Data Contract defined by the service. Verify that [DataMember] attribute tag is given for all the data fields and [DataContract] for the Class. If those attributes are missing, the object will be generated with null values. If all fields have the tags but the issue is not resolved, then the service reference should be re-added and the proxy should be re-generated. Then the problem will be resolved.
Here is a post which describes basics of creating a WCF service.
http://sivakrishnakuchi.blogspot.com/2010/05/how-to-create-wcf-service-application.html
Here the Method GetRequest will return an object of ImplementationRequest. Everything will run without any error but the req object will contain all null fields/ majority null fields.WebServiceReference.ServiceClient client = new
WebServiceReference
.
ServiceClient
();
WebServiceReference
.ImplementationRequest req = new
WebServiceReference
.ImplementationRequest();
req = client.GetRequest();
Solution:
Those nulls are due to error in generating the proxy for the Data Contract defined by the service. Verify that [DataMember] attribute tag is given for all the data fields and [DataContract] for the Class. If those attributes are missing, the object will be generated with null values. If all fields have the tags but the issue is not resolved, then the service reference should be re-added and the proxy should be re-generated. Then the problem will be resolved.
Here is a post which describes basics of creating a WCF service.
http://sivakrishnakuchi.blogspot.com/2010/05/how-to-create-wcf-service-application.html
Thank's!
ReplyDelete