This is a migrated thread and some comments may be shown as answers.

Clean the Parameters for Webservice

2 Answers 127 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Chandu
Top achievements
Rank 1
Chandu asked on 21 Mar 2012, 05:23 PM
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 Answers, 1 is accepted

Sort by
0
Chandu
Top achievements
Rank 1
answered on 21 Mar 2012, 06:28 PM
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.




0
DaVID
Top achievements
Rank 1
answered on 13 Nov 2012, 09:41 PM
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)  





Tags
Data Source
Asked by
Chandu
Top achievements
Rank 1
Answers by
Chandu
Top achievements
Rank 1
DaVID
Top achievements
Rank 1
Share this question
or