Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Sending Custom HTTP RequestHeaders

New Here ,
Dec 16, 2013 Dec 16, 2013

I want to send values from Flash to REST Service (Different Domain) through RequestHeader using GET method.

When I use the following code the header values are not attached with the request. Please help me on this

var request:URLRequest = new URLRequest();

request.url="http://www.myexample.com/"

var headers:Array = [new URLRequestHeader("name", "value")];

request.requestHeaders=headers;

request.method = URLRequestMethod.GET;

var loader:URLLoader=new URLLoader(request);

TOPICS
ActionScript
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 16, 2013 Dec 16, 2013

Take a look at the GET example here (URLVariables is the key):

http://help.adobe.com/en_US/as3/dev/WSb2ba3b1aad8a27b061afd5d7127074bbf44-8000.html

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 17, 2013 Dec 17, 2013

Thanks for your reply. The example is adding the parameters to the URL not adding the request header.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 18, 2013 Dec 18, 2013

The URLVariables will be handed to a RESTful service via GET. The URL they're using in the GET example has no URL parameters. The information is contained in the URLVariables to complete the GET request (e.g. variables.method = "test.echo"; // tell the RESTful GET request which method to invoke).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 18, 2013 Dec 18, 2013

request is completed without sending the request header.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 19, 2013 Dec 19, 2013

Flash follows SOAP so yes, it just supports POST and GET (not PUT or DELETE), etc. I thought what you meant by 'GET' was arguments in the URL.

If you truely need it in headers you're pretty out of luck except for essentially using a proxy, e.g.:

https://github.com/ricick/as3httpclient

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 26, 2013 Dec 26, 2013
LATEST

Flash doesn't but just for posterity, AIR has DELETE and PUT as a valid URLRequestMethod.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Dec 20, 2013 Dec 20, 2013

Most places that need to use a RESTful service with Flash have a way to fake it--Flash can't send the PUT and DELETE parts.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines