Question

I'm trying to post data to a page that handles it for me. I always get following error, however:

ioErrorHandler: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://localhost:8080/_user/a/ad/admin/message.create.html" errorID=2032] Blockquote

This is the code I have so far. This works fine for GET requests.

        // Object that contains data of the message to be sent
        var toSend:Object = {
            "sakai:type": "internal",
            "sakai:sendstate": "pending",
            "sakai:messagebox": "outbox",
            "sakai:to": "internal:"+sakaimain.gui.dgMessages.selectedItem["to"],
            "sakai:subject": sakaimain.gui.dgMessages.selectedItem["subject"],
            "sakai:body":"testreply with AIR GUI",
            "sakai:previousmessage" : sakaimain.gui.dgMessages.selectedItem["id"]
        };
        // Send message
        // Create loader to load objects
        var loader:URLLoader = new URLLoader();
        // Add event listeners for error and complete events
        loader.addEventListener(Event.COMPLETE, replyMessageCompleteHandler);
        loader.addEventListener(IOErrorEvent.IO_ERROR, replyMessageErrorHandler);
        // Create the request to be done
        var request:URLRequest = new URLRequest("http://localhost:8080/_user/a/ad/admin/message.create.html");
        request.requestHeaders = new Array(new URLRequestHeader("x-sakai-token", sakaimain.token ));
        request.method = URLRequestMethod.POST;
        request.data = toSend;
        // Do the request
        loader.load(request);

Anyone seeing the problem here?

Was it helpful?

Solution

The problem has been solved. I created URLVariables instead of an object to pass through which fixed the problem.

var urlv:URLVariables = new URLVariables();
urlv["sakai:type"] = "internal";
urlv["sakai:sendstate"] = "pending";
urlv["sakai:messagebox"] = "outbox";
urlv["sakai:to"] = "internal:"+sakaimain.gui.dgMessages.selectedItem["from"];
urlv["sakai:subject"] = sakaimain.gui.dgMessages.selectedItem["subject"];
urlv["sakai:body"] ="testreply with AIR GUI";
urlv["sakai:previousmessage" ] = sakaimain.gui.dgMessages.selectedItem["id"];

OTHER TIPS

Check your url first. Thats where the stream error generally comes into play. Make sure you can post to that url outside of your flex application. If you can't, you will probably get a better error message.

What server-side language are you using? Are you really intending to be posting to a .html file?

If the url is accurate, try sending a simpler request with only one key-value pair.

Also, I don't know, but are you sure that it is okay to have a : colon in the form variable name? I would guess that might depend on the server side language you are using.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top