Empty xml response in flash memory

I am reversing the development of the old flash game and the login process. A POST request is sent to the server. ActionScript 2:

req.username = inicial.login_mc.username_txt.text;
req.password = inicial.login_mc.password_txt.text;

xmlResponse = new LoadVars();
xmlResponse.onLoad = function() {
    xml = new XML(xmlResponse.xml);
    trace("login xml: " + xml);

    user = xml.childNodes[0];
};

url_login = "api/auth/user";
req.sendAndLoad(url_login, xmlResponse, "POST");

Inquiry:

Request URL: http://localhost:3000/api/auth/user
Request Method: POST
Status Code: 200 OK
Remote Address: [::1]:3000
Referrer Policy: no-referrer-when-downgrade
username: aaaa
password: aaaa

My answer:

Connection: keep-alive
Content-Length: 58
Content-Type: application/xml; charset=utf-8
Date: Sun, 18 Mar 2018 20:19:50 GMT
ETag: W/"3a-G4M/BpWRvMgDdvlmOtNMapl/lLw"
X-Powered-By: Express
<response hello="world"><hi>howdoing</hi></response>

Problem: The flash does not receive any response, and the xml is always empty. flashlog.txt:

Warning: getClassStyleDeclaration is not a function
login xml:

Content-Type: text / xml does not work either.

What could it be?

+4
source share
2 answers

It can help you.

var my_xml = new XML(); 
var myLoginReply_xml = new XML(); 

myLoginReply_xml.ignoreWhite = true; 

myLoginReply_xml.onLoad = function(success){ 

    if (success) { 
        // xml response with success
    } else { 
        // failure
    } 

}; 

my_xml.sendAndLoad("YOUR_URL", myLoginReply_xml);
0
source

If you My response(quoted below):

My answer:

Connection: keep-alive
Content-Length: 58
Content-Type: application/xml; charset=utf-8
Date: Sun, 18 Mar 2018 20:19:50 GMT
ETag: W/"3a-G4M/BpWRvMgDdvlmOtNMapl/lLw"
X-Powered-By: Express>
<response hello="world"><hi>howdoing</hi></response>

... This is what you will return to AS2 (in String), then you can extract the XML from this line.

It looks like this part is your XML data:

<response hello="world"><hi>howdoing</hi></response>

In the code below, there is one example of XML extraction (ex: method ParseXML):

var txt_response :String = ""; //original response string
var txt_XML :String = ""; //(extracted) string to be converted into XML object

//# //////////////////////////////////////////////////////////
//# 01) Get the Response :

txt_response = "Connection: keep-alive\nContent-Length: 58\nContent-Type: application/xml; charset=utf-8\nDate: Sun, 18 Mar 2018 20:19:50 GMT\nETag: W/\"3a-G4M/BpWRvMgDdvlmOtNMapl/lLw\"\nX-Powered-By: Express\n<response hello=\"world\"><hi>howdoing</hi></response>";
trace("txt_response : \n" + txt_response);//check if expected Response text


//# //////////////////////////////////////////////////////////
//# 02) Extract XML data from Response :
//# using: substring (start_Pos:Number, END_Pos:Number);

var pos_Start :Number = 0;
var pos_End :Number = 0;

pos_Start = txt_response.indexOf("<response");
pos_End = txt_response.indexOf("/response>");

txt_XML = txt_response.substring( pos_Start, pos_End+10); //+10 to reach end of this word (include it)
trace("txt_XML : \n" + txt_XML); //check if correct extract before using as XML


//# //////////////////////////////////////////////////////////
//# 03) Convert extracted text to XML :

var my_xml:XML = new XML(txt_XML);
trace( "checking XML attribute ( hello ) : " + my_xml.firstChild.attributes.hello); //gives: world

my_xml.firstChild.attributes.hello world . , ?

0

Source: https://habr.com/ru/post/1695030/


All Articles