1

Folks,

here is my technical issue. Let me know if you have some solution.

The problem is: it is not possible to do POST with JSONP. Since there is bowser URL restriction with using GET with JSONP, we actually wanted to go for POST with JSONP. There are some complex solutions mentioned in Internet, but i am not sure if they are recommended. For example, I want to have following web method as POST method (instead of GET method) since otherwise it exceeds URL limit of 2000 chars in IE. Note that this method is made small by allowing it to contain only few arguments.

[OperationContract]
    [Description("Accepts input profile values and returns back insert status as true or false.")]
    [WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped, Method = "POST",
    RequestFormat = WebMessageFormat.Json,
    ResponseFormat = WebMessageFormat.Json,
    UriTemplate = "InsertProfileDetails")]
    bool InsertProfileDetails(string AuthToken,
                          int Caste_Id, Boolean IsCasteNoBar, char Gender, int Age, int Height, string Complexion, string Marital_Status, int Religion_Id, int MotherTongue_Id, string Profile_Description,
                          string Education_Level,
                          DateTime Dob,
                          string Profile_FirstName, string Profile_LastName, string Address_Line1, string City, string State, int Country_Id, string ContactEmail, string CellPhonePrimary, string HomePhoneSecondary, string WorkPhoneOptional,
                          string EmploymentSector, string Profession,
                          int Min_Age, int Max_Age, int Min_Height, int Max_Height, string Religion_Ids, string Caste_Ids, string MotherTongue_Ids, string Education_Levels
                             );

The only option l could think of, considering the limitations, is to have small form submissions (multiple forms in case of 'create profile' user scenario) which in turn call smaller GET web methods. And on server side commit the forms data to database only after receiving all small forms data. we should associate all small forms of user on server-side by using some Guid sent from client during each form request.

Let me know your thoughts. Appreciate your time reading my post.

Thanks, Pullet

Community
  • 1
  • 1
  • Why do you need JSONP? Are you posting cross site? You can see this [SO: WCF REST POST of JSON: Parameter is empty](http://stackoverflow.com/questions/6835872/wcf-rest-post-of-json-parameter-is-empty) which shows how to shape your data contract and service. – Petar Vučetin Feb 24 '13 at 16:24
  • Peter, I guess Yes. My WCF REST service will be consumed by my mobile apps for Android and iOS platforms. I am building these apps using Phonegap. For example, Phonegap's iOS deployment package file is an IPA file, Android's is an APK file and for Window Phone, it is a XAP file. These files are distributed through the appropriate ecosystems (iTunes Store, Android Market, Amazon Market, BlackBerry App World, Windows Phone Marketplace, etc...). So if my mobile app contains a form, and form submission does a post to my remote WCF service, isn't it cross site? Please correct me if I am wrong. – user1639662 Feb 25 '13 at 23:47

0 Answers0