ASP.NET - Passing Json data to Wcf service from aspx.cs

Asked By prince b on 06-Jan-14 12:18 AM
Good Morning,

 I am using restful wcf service concept and this is the method for the service in the interface.

      [WebInvoke(Method = WebMethods.POST, UriTemplate = UriTemplates.CreateDoctorProfileUri, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
      hxResponseDTO CreateDoctorProfile(CreateDoctorProfileArg createDoctorProfileArg); 
where it is taking argument as the class file which accepts some parameters.
So now I need to pass the class file from aspx.cs  with the properties same as the class.So I declared the class in the front end and I need to pass the data.
 How can I do,please explain me with proper example?
Robbe Morris replied to prince b on 06-Jan-14 08:50 AM
prince b replied to Robbe Morris on 06-Jan-14 09:27 AM

I need it from code behind that is from aspx.cs where I should pass a class with some properties to the wcf service.

Please explain with a proper example?

Robbe Morris replied to prince b on 06-Jan-14 09:44 AM
I misunderstood your original post.  If the WCF service is under your control, it would be better if you would add a basicHttp endpoint in the web config so that you could simply create a standard reference in your client code.  WCF services can use multiple endpoint types.

That said, I think what you are after is here: