PDA

View Full Version : XML.sendAndLoad is using GET method!!??


Litos
07-21-2004, 12:20 PM
Hello folks,

I'm trying to send XML variables from Flash MX (Professional) to a Servlet (Tomcat 5.0)... but when I send the text the doGet function is called. And I can not get anything from the message.

__________Actionscripting code__________

var loginXML = new XML();
loginXML.contentType = "text/xml";
loginXML.ignoreWhite = true;
var loginElement = loginXML.CreateElement("LOGIN");
loginElement.attributes.username = "username";
loginElement.attributes.password = "verySecret";
loginXML.appendChild(loginElement);

var loginReplyXML = new XML();
loginReplyXML.onLoad = onLoginReply;
loginXML.sendAndLoad("http://localhost:8081/Connect/sms", loginReplyXML);

___________Servlet code_______________

public void doPost (HttpServletRequest request, HttpServletResponse response) {
System.out.println("doPOST!!");
.....
}

public void doGet (HttpServletRequest request, HttpServletResponse response){
System.out.println("doGET!!");

System.out.println("---GetHeaders---");
enum = request.getHeaderNames();
while (enum.hasMoreElements()){
String key = (String)enum.nextElement();
System.out.println(" "+key+" -> "+request.getHeader(key) );
}
System.out.println("---GetParameterNames---");
enum = request.getParameterNames();
while (enum.hasMoreElements()){
String key = (String)enum.nextElement();
System.out.println(" "+key+" -> "+request.getParameter(key) );
}
System.out.println("---Reader---");
BufferedReader br = request.getReader();
String reqBody=br.readLine();
System.out.println("reqBody: "+reqBody);

......

____________My Server Output______________


doGET!! :eek:
---GetHeaders---
referer -> http://localhost:8081/Connect/sms
x-flash-version -> 7,0,14,0
content-type -> text/xml
content-length -> 0
user-agent -> Shockwave Flash
host -> localhost:8081
cache-control -> no-cache
---GetParameterNames---
---Reader---
reqBody: null


________ HELP!! :confused: ________

Ok, how can I get the XML text??
I have been looking for a response on the Internet but with no luck.

Is the Flash MX 2004 Professional a problem maybe?
I had headhaches before mixing old code with ActionScripting 2 and Flash Player version 7...
Do you know if I could send XML variables to the server (not receiving) using the XMLConnector component?

I apreciate any help you give me. Thank you.

Litos
07-22-2004, 10:20 AM
It's me again.... I solved the problem using the XMLConnector component. I guess the problem is trying to use an old compoment (XML class) into Actionscripting 2.0
So don't mix XML class with Actionscripting 2.0 and Flash 7

There is a link which guided me to solve the problem .... http://www.flash-db.com/Board/index.php?board=29;action=display;threadid=7624


Litos

Morg
04-01-2008, 12:47 PM
Hey Litos and everyone else.

I think Im having the same problem, except mine sometimes does a POST and sometime it does a GET... Its very annoying!!

Any ideas?