How to send PUT HTTP Request in Flex

为君一笑 提交于 2019-11-29 02:46:29

I have found the solution to send the put and delete service with HTTPSerivce in flex.

You just have to send one more header with the service method POST.

You have to send data in the POST method and attach one more header X-HTTP-Method-Override and the value as the PUT or DELETE.

Your service will be send as PUT or DELETE.

Thanks......

While Mitul's response did work for me as well, I was able to get PUT and DELETE requests working by doing the following.

var urlLoader:URLLoader = new URLLoader();
            var urlString:String = "https://www.google.com/arbitraryUrl.json";
            var urlRequest:URLRequest = new URLRequest(urlString);
            urlRequest.method = URLRequestMethod.POST;

            var variables:URLVariables = new URLVariables();
            variables._method = "DELETE";
            urlRequest.data = variables;

            urlLoader.load(urlRequest); 

So same concept really. Different way of going about it. Hope this helps some people.

Bozho

Flex doesn't support PUT due to the underlying flash player. See this article about the limitations.

There is a workaround here. However, if both the server and the client are under your control, I'd suggest using only GET and POST. Flex just isn't meant for true RESTful clients. (For example make a post with a parameter put=true)

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