Welcome, Guest. Please login or register.
Did you miss your activation email?
05/22/12, 17:12
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  Server side Scripting and Database Support
| |-+  Web Services: XML, Soap, WSDL, UDDI, and Flash Integration (Moderators: Flash-db, Musicman, vesa kortelainen, Ronald Wernecke, Jorge Solis)
| | |-+  XML from WebServiceConnector is tracing "[object Object]"
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: XML from WebServiceConnector is tracing "[object Object]"  (Read 2222 times)
andy
Server what's that
*
Posts: 14



View Profile Email
« on: 03/16/10, 09:20 »

I'm using the WebServiceConnector in CS3 to load some XML. The trouble is, whenever I trace out the XML, all I get is "[object Object]".

Here's the code I'm using:


import mx.services.*;
import mx.data.components.WebServiceConnector;

var wscListener:Object = new Object();
wscListener.result = function(evt:Object) {
   resultsXML = new XML(evt.target.results);
   resultsXML.ignoreWhite = true;
   trace(resultsXML);
}

var wsConn:WebServiceConnector = new WebServiceConnector();
wsConn.WSDLURL = "http://my_ws_URL.asmx?wsdl";
wsConn.addEventListener("result",wscListener);

// Button action
button.onRelease = function() {
   wsConn.operation = "Login";
   wsConn.params = [loginPanel.UN.text, loginPanel.PW.text]; // Username and password from login form
   wsConn.trigger();   
}



Any help here would be greatly appreciated, I'm really tearing my hair out on this one. I'm sure the answer is buried away on one of these threads, but I'd be grateful if someone could flag it up.

Cheers
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #1 on: 03/16/10, 11:56 »

Try

trace(evt.target.results)

To see if you get something meaningful

Jorge
Logged

andy
Server what's that
*
Posts: 14



View Profile Email
« Reply #2 on: 03/17/10, 04:19 »

Same outcome, I'm afraid - traces "[object Object]".

Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #3 on: 03/17/10, 04:52 »

Now inspect the objetc, instead of

trace(resultsXML)

Use

for(var i in resultsXML) trace(i+':'+resultsXML)

Jorge
Logged

andy
Server what's that
*
Posts: 14



View Profile Email
« Reply #4 on: 03/17/10, 04:58 »

Now inspect the objetc, instead of

trace(resultsXML)

Use

for(var i in resultsXML) trace(i+':'+resultsXML)

Jorge

Returns:

unregisterNamespace:[object Object]
registerNamespace:[object Object]
getQNameFromString:[object Object]
getAttributeByQName:[object Object]
loadNSMappings:[object Object]
getNamespaceURI:[object Object]
getLocalName:[object Object]
getPrefix:[object Object]
getQualifiedName:[object Object]
setValue:[object Object]
setChildValue:[object Object]
getQName:[object Object]
namespaceURI:[object Object]
localName:[object Object]
prefix:[object Object]
previousSibling:[object Object]
parentNode:[object Object]
nodeValue:[object Object]
nodeType:[object Object]
nodeName:[object Object]
nextSibling:[object Object]
lastChild:[object Object]
firstChild:[object Object]
childNodes:[object Object]
attributes:[object Object]
getPrefixForNamespace:[object Object]
getNamespaceForPrefix:[object Object]
toString:[object Object]
hasChildNodes:[object Object]
appendChild:[object Object]
insertBefore:[object Object]
removeNode:[object Object]
cloneNode:[object Object]
getElementsByLocalName:[object Object]
getElementsByReferencedName:[object Object]
getElementsByQName:[object Object]
nscount:[object Object]
xmlDecl:[object Object]
status:[object Object]
loaded:[object Object]
ignoreWhite:[object Object]
docTypeDecl:[object Object]
contentType:[object Object]
addRequestHeader:[object Object]
getBytesTotal:[object Object]
getBytesLoaded:[object Object]
onData:[object Object]
onLoad:[object Object]
sendAndLoad:[object Object]
send:[object Object]
load:[object Object]
parseXML:[object Object]
createTextNode:[object Object]
createElement:[object Object]

Thanks for taking the time to look at this, btw

Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #5 on: 03/17/10, 05:30 »

So you get an empty XML, probably the XML is malformed, load the XML directly in the browser to see if you get some error

Jorge
Logged

andy
Server what's that
*
Posts: 14



View Profile Email
« Reply #6 on: 03/17/10, 06:07 »

We have checked the XML, and it seems to be valid.

One avenue I did explore was the use of SOAPCall.doDecoding, which aparrently can decode returned WS objects into useable XML; but in all the examples I can find, the WebService seems to be called in a different way to the method I'm using, and implementing it it hasn't been as simle as dropping in the line of code.
Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6175


View Profile WWW Email
« Reply #7 on: 03/17/10, 08:10 »

object Object is OK.
It is allready a XML-Object.

You have to read it with the XML functions childNode, getChild, getNextChild etc. - see manual for details
Logged

happy flashing
Cool
Ronald
andy
Server what's that
*
Posts: 14



View Profile Email
« Reply #8 on: 04/27/10, 04:40 »

A little belated, this, but I do hate it when I come across threads where no outcome is posted.

In the end, I used this method:

Code:
var pc1:PendingCall = wsConn.TrainingLogin(loginPanel.username.text, loginPanel.password.text);
pc1.onResult = function():Void {
//Success
trainingLoginResultsLoaded(pc1.response);
}

To be honest I am not up to speed on the differences between WebServiceConnector and PendingCall (the solution was proposed by another coder who had used it successfully), and I don't know why the XML returned by this method should have been more accessible. I'm glad it worked, though; and in the interests of furthering my understanding, I'd would be grateful if anyone could shed some light on why it worked!
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #9 on: 04/27/10, 06:23 »

The PendingCall (not used anymore in AS3) sets an onResult and onFault callbacks and was used for asynchronous calls (not only webservices, but remoting) It's not related to what you get as a result, and also not related to be accesible or not.
In your case, the trainingLoginResultsLoaded should probably parse the XML returned by your service, that's it

Jorge
Logged

Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
anything