Flex :: Setting JSON Content Type On HTTPService?

Nov 16, 2010

I am trying to set the json content type on httpservice to make REST service return the json data. When I add the content type in fiddler all works fine so the problem lays in flex application, not in the web-service. But the code below does not work and I get the xml data instead of json.

mxml:
<s:HTTPService id="service" method="POST" url="server.com" result="loaded(event)" fault="fault(event)" useProxy="false" resultFormat="text">

Actionscript:
public function loadAllSamples():void {
service.contentType = "application/json";
service.send('something');
}

View 2 Replies


Similar Posts:


Php :: Use HTTPService Rather Than URLRequest To Send Data. Content Type Is Messing With The Data?

Jul 28, 2011

I need to send a byte array of data (its an image source) along with a bunch of other vars to a service.If I send the byte array using something like the following

var request:URLRequest = new URLRequest ( 'http://www.mydomain.com/upload.php' );
var loader: URLLoader = new URLLoader();
request.contentType = 'application/octet-stream';

[code].....

View 1 Replies

Ruby On Rails 3 :: HTTPService Not Properly JSON-encoding Nested Objects On Send()?

Nov 22, 2011

i am creating an object like this:

var myObj:Object = new Object();
myObj["someProperty"] = {
anotherProperty: "someValue",
whateverProperty: "anotherValue"
}

now i want to send it to a web server (rails):

var service:HTTPService = new HTTPService();
service.url = "http://server.com/some/path/entry.json";
service.method = URLRequestMethod.POST;
service.send( myObj );

the problem is that the server receives the json like this:

{"someProperty"=>"[object Object]"}

is this a problem with HTTPService? should i use the good old loader/urlrequest and serialize myself? by the way, serializing and then passing the string doesn't work, webserver receives empty request as GET.but i kinda want to use the httpservice class though...

View 2 Replies

Json :: Unable To Encode Flex Grid Data Into JSON On Sorting Columns?

Nov 28, 2011

Created an editable flex grid which exposes a method called getGridData() to javascript. I am using the JSON.encode() method of the [url]....library to convert the grid object's dataProvider into JSON before returning it.

ExternalInterface.addCallback("getGridData", getGridData);
public function getGridData():String
{[code].....

However, when I sort a column in the user interface, the encode method is failing throwing the following error

Property usingCustomCompareFunction not found on mx.collections.SortField and there is no default value.

View 1 Replies

Xml :: Set XML Content-Type In Flex 3?

Jun 11, 2010

I've got a Flex 3 project. Flex makes an ExternalCall to some Javascript. The Javascript is then turned into XML.

But, my xml isn't parsing in IE. It works in all other browsers. I think that the problem is that I haven't set the XML's content-type and IE doesn't like that. So my code looks like:

myReturn = '<myXMLReturn>' + myReturn + '</myXMLReturn>';
myReturn = '<?xml version="1.0" encoding="UTF-8"?>' + myReturn;
xmlReturn = new XML(myReturn);

How would I set: header('Content-type: application/xml'); in Actionscript?

As I understand it IE requires that the Content-type be set.

View 1 Replies

Flex :: Setting Content Area In Custom Component?

Dec 11, 2009

I am trying to define the content area of a custom component that extends mx:VBox. The component has predefined headers and footers (visual children) and I want to set the area in the middle for adding children to the component. The component will be used like this:

<custom_component>
<mx:button/>
</custom_component>

How would I set this content area?

View 3 Replies

Flex :: Setting Up Content Children For Custom Mxml Component

Dec 9, 2009

I am trying to develop a custom component to act as a divider.

[Code]....

I would like to use this component to assign objects like this:

[Code]...

Unfortunately, this does not work. I get a compiler error saying: In initializer for 'left': multiple initializer values for target type mx.containers.Canvas.

View 1 Replies

ActionScript 3.0 :: JSON: Can't Cast Decoded Object To Actual Type?

Feb 8, 2010

So I just started using JASON to make my application data driven. I'm not doing any encoding, only decoding (I encoded once to create an example data layout). My question is, how come I can't cast the data that I read in into the object that it is? I know that question is useless without an example so here goes:This is my data class that I encoded once to create an example JSON file.

ActionScript Code:
public class ButtonData
{

[code].....

View 3 Replies

Flex :: Setting Spark List Height To Its Content Height?

Apr 1, 2010

How to set a Spark List height to the height of its content?Tried this:

var lastRow:IVisualElement =
myList.dataGroup.getElementAt(myList.dataGroup.numElements - 1);
myList.height = lastRow.y + lastRow.height;

It works in case of a single item, but lastRow is null in case of more items.

View 5 Replies

Professional :: Get Nothing When Type Text Using The TFL Setting

Mar 19, 2011

I'm using the tutorials on [URL] to show me how to work through things. However, when I am trying to type text using the TFL setting, I get nothing but a blue box. I open a blank file, select the Text tool. It comes up with the cross-hair the a small capital T to the bottom right. I click on the stage to make the text box from the dotted lines/marching ants, then as soon as I let go, it snaps to the top left corner as a blue box. And every time I repeat this,each subsequent box snaps to the top left corner. When I click the selection tool, and make a box around the corner, all the different blue boxes I made fro my text tool is shown, but I still can't type even a single letter!

View 1 Replies

AS2 :: Post JSON Data From Flash With The JSON As The Body Of The Request?

Nov 5, 2010

I'm working on a Flash AS2 application that needs to post JSON data to a web service.In previous projects, I've used LoadVars.send() or LoadVars.sendAndLoad() successfully to manage this:

var send_lv:LoadVars = new LoadVars();
send_lv.data = JSON.stringify({some json object});
var response_lv:LoadVars = new LoadVars();
response_lv.onData = function(rawdata) {

[code]....

In somepage.php, I can grab that JSON data using $_POST['data'].However, on this project, the developer of the web service requires the JSON content to be the BODY of the request (i.e., not a name/value pair). Is this possible with LoadVars?

View 1 Replies

Actionscript 3 :: Json - Decode JSON - JSONParseError: Unexpected H Encountered

Oct 14, 2011

I'm new to JSON. This is the .json I want to decode but I always get this error:

[Code]...

View 1 Replies

Actionscript 3 :: Json - Counting Elements In JSON Array Which Is In An Object

Feb 23, 2012

I have a pure ActionScript 3 problem, but the simplified test case I've prepared is in Flex 4 for better visibility (the source code is below): Since Flash Player 11 / AIR 3 support JSON natively, I've decided to move a multiplayer game, which used XML for communicating with server, to JSON. But I have a frustrating problem, that given two Objects like

[Code]...

View 1 Replies

ActionScript 2.0 :: Dynamically Setting Function Type Through Xml?

Jan 16, 2006

I have a number of functions and I want to execute 1 based on the entries in a .xml file

part my xml file reads as follows

<funcType>thisFunc</funcType>

In my .fla I have defined thisFunc along with a number of similar functions

I want to execute the function as follows

chosenFunc=Node.childNodes[0].childNodes[0].nodeValue;//points to thisFunc in the .xml file
chosenFunc(); // This should execute as thisFunc ()

Problem is this doesn't seem to be working. Am I trying the impossible?

View 1 Replies

AS3 :: Flash - Setting Changing Class Type At Runtime

Mar 14, 2011

i have a class and trace its type with flash.utils.describeType(this)

class Data extends EventDispatcher
{
public function Data()

[Code]....

Is it possible to override this information e.g type.@isDynamic, as well as extendsClass.@type, at runtime? without bytecode?

View 5 Replies

ActionScript 3.0 :: Setting Flash To Demand Type On Variables?

Dec 2, 2009

Being a code purist, I always set Flash to demand that I declare all variables/functions with a type. Like this:var myVar1:int = 14; //Okvar myVar2 = 18; //Compiler ERRORMy problem is that I just reinstalled my computer (including Flash) but I've forgotten where I do this setting. Anyone here with a better memory than me?

View 4 Replies

Actionscript 3 :: Json : Parsing JSON Data?

Sep 28, 2011

I am sending a request to a server, and in return I get a long block of JSON.

{
"response":"success",
"assignments":{
"17733":{
"asnid":"17733",

[code]....

Is there a way to do this? I checked if the property was enumerated and it returned true, but I cant find a way to access this data.

View 1 Replies

Actionscript 3.0 :: Json : How To Post JSON Data

Dec 13, 2011

I have to work with webservices in Actionscript. I found the following code that allows me to use JSON URLs that implement only the GET method. However, it doesn't work for POST methods (doesn't even enter the "onComplete" method). How can i "POST" JSON data using Actionscript 3.0?

package
{
import flash.display.Sprite;
import flash.net.URLRequest;

[code]....

View 1 Replies

Flex :: Type 1046: Type Was Not Found Or Was Not A Compile-time Constant: NetworkInfo

Jun 15, 2010

Just started playing with the new AIR functions NetworkInfo and NetworkInterface, but can't build ...

This is the example I started from: tourdeflex But these lines cause errors:

var networkInfo:NetworkInfo = NetworkInfo.networkInfo;
var networkInterfaces:Vector.<NetworkInterface> = networkInfo.findInterfaces();

View 2 Replies

ActionScript 3.0 :: Json - Use A JSON API In Flash?

Jan 15, 2012

I was wondering if someone could explain or point me in the direction of how to implement an API that uses JSON in ActionScript 3.0. What I specifically want to know is how would I grab specific information. The following is how I do it in XML but I don't know how I would do something similar in JSON as in getting the equivalent of an XML tag. For example with the twitter API I'd like to grab the text [URL]

[Code]....

View 1 Replies

Flex :: Gzip - Flex - HTTPService And Gzipped Responses?

Jul 5, 2010

I have a Flex client making RESTful calls to a webservice using HTTPService. The server is returning JSON responses, which we would like to compress. Can Flex using HTTPService handle gzip-encoded responses? If so, what steps are required to make it work (e.g., which headers to set, how to decompress, etc.)? If not, can you suggest a simple alternative?

View 1 Replies

Filled Colour As A Variable / Setting Layer To Not Block Content Underneath?

Dec 10, 2009

I wonder if it's possible to take the filled colour (filled with myColor.setRGB(0x993366); like a colouring style) and set the colour filled to be a value of a variable in an if statement? if yes, anyone know how to do it?and is it possible to set a layer's content so that it does not block any button underneath it? I'm trying use that movie as a mask but I do not want it to block any activity underneath it. or is it better to use the myMovieClip .setMask (maskMovieClip)I only need the masking to appear when a specific button is pressed.

View 8 Replies

Flex :: Re-using HTTPService Object

Oct 22, 2009

I'm trying to reuse the HTTPService object in a flex app but I'm running into a problem. In the handler for ResultEvent.RESULT I'm removing the listener, but it isn't removed. I've have to catch the asyncToken from send() and attach a new property so I know what it's supposed to do in the handler.URL...You can right-click and view source.Has anyone else run into an issue where listeners aren't removed? Should HTTPService not be reused?

View 3 Replies

Flex :: HTTPService Progressbar?

Nov 10, 2009

How can I set a progress bar that may start when an HTTPService is sent and stop when the HTTPService ends?I followed code given here but encountered following error Type was not found or was not acompile-time constant: ProgressWin.Don't know whether ProgressWin.mxml is a component or module or what. I just created a new ProgressWin.mxml file and pasted the code you posted but following error popped out before

View 1 Replies

Flex :: XML HTTPService Result And For Each

Mar 3, 2010

XML is cool in flex, but I have an annoying problem to solve, caused by what I can imagine is a feature. You see, when you have just one tag of something, it creates an object which is not an array. But when finds more than one, it puts it on an array structure.[code]I could check the format of resObj.specifictag (to check if it is has an array) and then duplicate the code (for each case). But -even if it's calling a function- I don't think it is an elegant solution.Well, I hope someone has a good idea on this matter. (I know from experience that SO has much more C++ experts than flex, but well...)The perfect thing would be that HTTPrequest handled every tag in a consistent way (using always arrays... though I'm guessing that that would also have its drawbacks).

View 3 Replies

Flex :: Air - HTTPService Times Out Anyway?

Jan 11, 2012

I'm getting an error after 30 seconds of execution of this service

<s:HTTPService id="svcList" url="http://localhost/index.php" method="GET" result="svcList_resultHandler(event)" fault="svcList_faultHandler(event)" requestTimeout="300">
<s:request xmlns="">
<mod>module</mod>

[Code]...

View 2 Replies

Flex :: Two Different HTTPService Classes?

Jun 2, 2009

Why are there two different HTTPService classes in Flex?thisandthisAnd the second one inherits the first one.Why couldn't there be a single class combining the two?

View 4 Replies

HTTPService In Flex With Multiconnections

Jun 10, 2009

I am using an HTTPService in my Flex application. I want to load several xml files, each about 1mb in size. Sometimes I need to stop loading previous xml file and start loading a new one. If I use HTTPService.cancel(); or HTTPService.disconnect() , it increase the time to get the answer from the server.Is there a quick way to stop the previous loading in HTTPService and start new one?

View 1 Replies

Flex :: OnResult HTTPService?

Aug 28, 2004

I have a HTTPService:

<mx:HTTPService id="scoreService" url="http://" method="POST" result="onResult(event)">
<s:request xmlns="">
<name>{..}</name>

[code].....

View 3 Replies

Actionscript 3 - Can Flash Load External Images Regardless Of Content-Type?

Jun 21, 2011

The dilemma I currently have is that I'm hosting a resource that is application/octet-stream. In my Actionscript code, I'm using some library that ( from what I can recall ) does new Image and loads a resource into that object which was created.There is a method, loadImage(url) which accepts a url and that's where you feed it the path to the image.I do not have access to the loadImage source code, so I don't know exactly what it does, but the working one loads the image fine because the Content-Type is image/jpeg. The non-working one ( this one I'm trying to fix ) doesn't because of the different Content-Type.I'm wondering if someone can tell me if I can make the flash basically parse the URI as if it were image/jpeg, regardless of the Content-Type? [code]

I assume that Image the constructor is native to flash/AS, but I haven't been able to google the loadImage method so it must be custom, right?Or could the Image constructor itself be custom? An extended version of the original Image with loadImage method and such?Anyways, does anyone know how I can view the source code of loadImage? I did an ack-grep and found the source code for the loadImage method defined in a library:[code]Can anyone offer advice as to how I can do the loadBytes on this? I was thinking of defining a custom method, loadResource or something which can load regardless of Content-Type... or just create an optional parameter in the current load method and inside, branch out based on what was passed.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved