Send parameters in order in HTTPService

送分小仙女□ 提交于 2019-12-11 13:58:23

问题


I am trying to work with a simple HTTPService. The problem is that my webservice is conscious of the order of arguments it gets. I will tell the problem with an example:

var service:HTTPService = new HTTPService(); 
var params:Object = new Object(); 
params.rows = 0;
params.facet = "true"; 
service.send(params); 

Note that in the above code I have mentioned the parameter rows before facet, but the url I recieve is facet=true&rows=0. So I recieve the argument rows before facet and hence my webservice does not work. I figured out that the contents of array is always sent in alphabetical order, which I dont want.

Is there any way I can achieve explict ordering of parameters sent?

Note that I am not in power of changing the logic of webservice(its basically a RPC service supporting both desktop and web client).

Thanks.


回答1:


I am assuming you are using a get method. Instead of passing params to the HTTPService, build a url string. You can pass get params just by changing that string then calling the service.

service.url = "originalURL" + "?" + "rows=0" + "&" + "facet=true";
service.send();


来源:https://stackoverflow.com/questions/2512739/send-parameters-in-order-in-httpservice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!