Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to set a method with class as a parameter in WCF service?
    primarykey
    data
    text
    <p>I am trying to create a method with class as a parameter. But it's throwing error. After some search I found the <code>implementation of QueryStringConverter</code>. I am trying to do it but I didn't have much knowledge in it.</p> <p>In my service class, the method is :</p> <pre><code>[WebInvoke(UriTemplate="LogInForMobileWithDeviceNo", Method="POST", RequestFormat=WebMessageFormat.Json, ResponseFormat=WebMessageFormat.Json, BodyStyle=WebMessageBodyStyle.Wrapped)] string LogInForMobileWithDeviceNo(clsUserDeviceInfo userDeviceInfo); </code></pre> <p>In the <strong>clsUserDeviceInfo</strong> class, i declared the properties as:</p> <pre><code> [DataContract] public class clsUserDeviceInfo { [DataMember] public string UserID{get;set;} [DataMember] public string DeviceName{get;set;} [DataMember] public string CordovaVersion{get;set;} [DataMember] public string DevicePlatformJs{get;set;} [DataMember] public string DeviceUID{get;set;} [DataMember] public string DeviceModel { get; set; } [DataMember] public string DeviceVersion { get; set; } } </code></pre> <p>but it's not working.</p> <p>using Jquery i did Ajax posting:</p> <pre><code> var DeviceName = "samsung"; var CordovaVersion = "2.1.1.1"; var DevicePlatformJs = "windows 8"; var DeviceUID = "23dswd-234dff-23-2334nhj"; var DeviceModel = "grand duos"; var DeviceVersion = "3.2"; var DataArr = {DeviceName:DeviceName,CordovaVersion:CordovaVersion, DevicePlatformJs:DevicePlatformJs,DeviceUID:DeviceUID,DeviceModel:DeviceModel,DeviceVersion:DeviceVersion}; $.ajax({ type: "GET", url: serverurl, data: JSON.stringify(DataArr), success: function (result) { alert(result); }, accept: 'application/json' }); </code></pre> <p>Am I doing anything wrong?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload