Clean the Parameters for Webservice

3 posts, 0 answers
  1. Chandu
    Chandu avatar
    9 posts
    Member since:
    Aug 2005

    Posted 21 Mar 2012 Link to this post

    I am having issues in passing the Parameters to my Webservice. I am passing two parameters that my WS is expecting in the code as: 

      var dataSource = new kendo.data.DataSource({
                            transport: {
                                read: {
                                url: "http://localhost/ws/MobileWS.asmx/GetMenuItems",
                                    dataType: "json", 
                                    contentType: 'application/json; charset=utf-8',
                                    data:  
                                    }
                                        q: { 'MenuID': '5', 'VersionID': '2' }
                                    }
                                }
                            },

    The parameters are passed with special characters as:
    http://localhost/ws/MobileWS.asmx/GetMenuItems?q%5BMenuid%5D=5&q%5BVersionID%5D=2

    How can I clean it up to get it as:
    http://localhost/ws/MobileWS.asmx/GetMenuItems?Menuid=5&VersionID=2 


    Thanks,
    Chandu

  2. Chandu
    Chandu avatar
    9 posts
    Member since:
    Aug 2005

    Posted 21 Mar 2012 Link to this post

    I changed the code to call the WS like this:
    var dataSource = new kendo.data.DataSource({
                            transport: {
                                read: {
                                url: "http://localhost/ws/MobileWS.asmx/GetMenuItems",
                                    dataType: "json", 
                                     data:  
                                     
                                         { 'MenuID': '5', 'VersionID': '2' }
                                    }
                                }
                            },

    Now I am getting the string as needed.

    And everything is working fine. Thanks for giving the comfort that we can turn to you and ask questions when we have issues.




  3. DaVID
    DaVID avatar
    1 posts
    Member since:
    Oct 2012

    Posted 13 Nov 2012 Link to this post

    This seems crasy but i have encounter a bizzare scenario like the one posted above.
    My probleme is that i have double parameter meaning  i want to pass param:UserName=newYork to my web service call

     
    var myData = new kendo.data.DataSource({
                transport: {
                    read: {
                        url: "http://myserverdata.com/mysvcservice.svc/login",
                        dataType: "json",
                        data:  {param:{ 'UserName': 'newYork'}},
                        type: "POST",
                        contentType: "application/json; charset=utf-8"
                    }
                }
               
            });

    My Service method take a Param object, Meaning i have to receive param in the request.
    This is the result:param%5BUserName%5D=newYork 
    Any idea?, because i have try even these parameterMap: function(options, operation)  





Back to Top