Reply to this topic  Start new topic
> Getting & Sending XML objects--Flash or JavaScript?
bspachman
post Mar 16 2003, 08:33 PM
Post #1






Posts: 2
Joined: 16-March 03
Member No.: 1,214



I've dived into the deep end in starting to work on my first widget.

The problem I'm banging my head against is that I need to query a server whose response will return an XML document to me. I'm willing to write the parser I need (until K gives us access to its own parser), but I cannot even retrieve the appropriate object.

I believe I need to send something like:

CODE
xmlhttp = new XMLHttpRequest();

xmlhttp.open("GET", "192.168.123.133:8080",true);


or something like:

CODE
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")

xmlhttp.open("GET", "192.168.123.133:8080",true);


but I get an error in my debug window when using these statements. The error is: "Global/OnLoad:5: ReferenceError: XMLHttpRequest is not defined"

I have a working example of what I'm trying to do--but it's written as a Flash object, using lots of ActionScript.

An example of the ActionScript construct for initialization is:

CODE
socket.send(new XML ("<?xml version='1.0'?>rn<REQUEST command='initialize' value=''/>rnrn"));


So...is there currently any way to replicate a "socket" ActionScript command or perform "XMLHttpRequest" in a way that K will understand?

Best,
Brad
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Arlo Rose
post Mar 16 2003, 10:08 PM
Post #2


I have a television.



Posts: 3,789
Joined: 25-August 02
From: California - Bay Area
Member No.: 2



Have you had a peak at our reference guide? We don't support doing either of those examples above.

You might want to use a combo of CURL and runCommand.


Cheers,
Arlo Rose
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
bspachman
post Mar 17 2003, 05:36 AM
Post #3






Posts: 2
Joined: 16-March 03
Member No.: 1,214



QUOTE
Have you had a peek at our reference guide?  We don't support doing either of those examples above.

Arlo,

Thanks for the response. I've seen the documentation--the only method built into K appears to be "URL.fetch". smile.gif

I'm quite a newbie when it comes to this...I'm not even up to speed on what the ActionScript example does. I'm only knowledgable enough to be a little dangerous--hence my question & need for a work-around

QUOTE
You might want to use a combo of CURL and runCommand.

Right...the CURL command looks fiendishly complicated. I found this in the documentation:
CODE
What about SOAP, WebDAV, XML-RPC or similar protocols over HTTP?



Curl adheres to the HTTP spec, which basically means you can play with *any* protocol that is built on top of HTTP. Protocols such as SOAP, WEBDAV and XML-RPC are all such ones. You can use -X to set custom requests and -H to set custom headers (or replace internally generated ones).


I'm assuming both the "X" and "H" switches for curl are going to be important to me. Any pointers on how to decipher this to accomplish my task?

Best,
Brad
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
blalor
post Jan 22 2005, 11:57 AM
Post #4






Posts: 30
Joined: 19-May 04
From: Indpls, IN
Member No.: 2,556



QUOTE(bspachman @ Mar 17 2003, 12:36 AM)
Arlo,
Thanks for the response. I've seen the documentation--the only method built into K appears to be "URL.fetch". smile.gif

[ ... snip ... ]

I'm assuming both the "X" and "H" switches for curl are going to be important to me. Any pointers on how to decipher this to accomplish my task?
*



I'm fairly shocked to see nobody else clamoring for XMLHttpRequest. I want to write some (cross-platform) web service-enabled widgets, but I don't stand a snowball's chance doing it with just URL.fetch; there just isn't enough control over the request. Without the ability to set additional headers and POST data, I can't do SOAP or XML-RPC, or anything else that requires *real* communication with a server. REST only takes you so far, and I don't feel that I should have to write, maintain, and make available a server-based entity to proxy requests for K.

Why are we still waiting for a native XML parser and first-class HTTP support in a product actively being developed in 2005?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Lars1024
post Jan 22 2005, 07:01 PM
Post #5






Posts: 695
Joined: 4-March 03
From: Stockholm, Sweden
Member No.: 1,074



Harsh words, blalor. Personally, I have always regarded the idea and design of the Konfabulator API to first and foremost be easy to grasp for non-professionals, and not primarily intended to give skilled programmers a fully-fledged development framework.

The API evolves over time and it's probably quite possible that we will see a built in XML parser and perhaps something in the lines of JavaScript XMLHttpRequest or a more powerful URL object in the future. But I believe it's a good thing if Perry & co. keeps balancing new features with continued ease of understanding the code in widgets, so that Konfabulator won't alienate skilled programmers or scripting rookies.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
blalor
post Jan 22 2005, 08:00 PM
Post #6






Posts: 30
Joined: 19-May 04
From: Indpls, IN
Member No.: 2,556



QUOTE(Lars1024 @ Jan 22 2005, 02:01 PM)
Harsh words, blalor. Personally, I have always regarded the idea and design of the Konfabulator API to first and foremost be easy to grasp for non-professionals, and not primarily intended to give skilled programmers a fully-fledged development framework.


Then what's the point? There's a limit to what you can do without consuming data, and Konfabulator isn't providing the tools to consume the data. Powerful frameworks don't negate ease of use. JavaScript already has a low entry threshold. There are dozens of books and websites dedicated to showing folks with limited programming chops how to develop powerful, interactive software. It's great that K allows people to make widgets that sing, dance, pulse and glow, but now it's time to enhance things a bit.

QUOTE(Lars1024 @ Jan 22 2005, 02:01 PM)
The API evolves over time and it's probably quite possible that we will see a built in XML parser and perhaps something in the lines of JavaScript XMLHttpRequest or a more powerful URL object in the future. But I believe it's a good thing if Perry & co. keeps balancing new features with continued ease of understanding the code in widgets, so that Konfabulator won't alienate skilled programmers or scripting rookies.
*



Eh? "Let's dumb it down for the newbies?" That just doesn't fly. How does not providing robust, high-performance capabilities of the JavaScript engine make code easier to read? This thread is TWO YEARS old! How much more time is needed to provide these features? Without them, they might as well just close up the Mac side of the business and concentrate on the Windows side, because Tiger will provide these capabilities RSN.

Konfabulator is a great start, but I haven't seen much in the way of innovation since Windows support came to town.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Jools
post Jan 23 2005, 12:00 PM
Post #7






Posts: 722
Joined: 16-November 04
From: London, UK
Member No.: 3,856



have you checked out http://xmljs.sourceforge.net/ for the javascript help on decoding XML natively, I haven't tried using openURL or url.fetch for non port 80 addresses, but have you tried something along the lines of :

CODE
contents = url.fetch("http://192.168.123.133:8080/")


I'd guess that using that with some javascript XML processing would solve the problem you've currently got.

There are quite a few XML processing scripts out there that are fairly easy to use.




Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. - Douglas Adams
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
blalor
post Jan 23 2005, 01:05 PM
Post #8






Posts: 30
Joined: 19-May 04
From: Indpls, IN
Member No.: 2,556



QUOTE(Jools @ Jan 23 2005, 07:00 AM)
have you checked out http://xmljs.sourceforge.net/ for the javascript help on decoding XML natively,
*



Yes, I have seen and used it. It's quite good, in fact (lest folks here think I have *nothing* positive to say... wink.gif). Unfortunately, there's still no way to POST data to a remote host or manipulate headers. Both are required, at least in part, to have XML-RPC and SOAP implementations. XMLJS also claims to be a "parser" and not a "generator", but I haven't verified that. If it can't generate XML, then you're left to doing it by hand.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Jools
post Jan 23 2005, 01:21 PM
Post #9






Posts: 722
Joined: 16-November 04
From: London, UK
Member No.: 3,856



QUOTE(blalor @ Jan 23 2005, 01:05 PM)
Unfortunately, there's still no way to POST data to a remote host or manipulate headers.
*



Ah, I see - I didn't know it was the post that was causing the problem. Have you tried using
CODE
curl -d
or
CODE
curl --data




Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. - Douglas Adams
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
blalor
post Jan 23 2005, 03:16 PM
Post #10






Posts: 30
Joined: 19-May 04
From: Indpls, IN
Member No.: 2,556



QUOTE(Jools @ Jan 23 2005, 08:21 AM)
Ah, I see - I didn't know it was the post that was causing the problem.  Have you tried using 
CODE
curl -d
or
CODE
curl --data

*



No; that's really pretty kludgy, IMO, and also not cross-platform. I think K should provide that functionality. smile.gif

What I will do, if I decide to persue anything that requires XML-RPC or SOAP, is use Python. Still not x-plat, but sooo easy to code.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Jools
post Jan 23 2005, 03:26 PM
Post #11






Posts: 722
Joined: 16-November 04
From: London, UK
Member No.: 3,856



QUOTE(blalor @ Jan 23 2005, 03:16 PM)
No; that's really pretty kludgy, IMO, and also not cross-platform.  I think K should provide that functionality. smile.gif

What I will do, if I decide to persue anything that requires XML-RPC or SOAP, is use Python.  Still not x-plat, but sooo easy to code.
*


curl is provided for both platforms, and therefore it is cross-platform. I believe that there may be a problem with the ssl libraries in the windows one, but as long as you're using http and not https, there should be no problem.

Would it be more useful if it was supported in K - yes. Is it necessary - nope, IMHO there at a lot of other things that could be added first (including simple socket access).




Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. - Douglas Adams
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
dcarroll
post Jun 8 2005, 04:55 AM
Post #12






Posts: 2
Joined: 6-June 05
From: San Francisco, CA
Member No.: 6,442



QUOTE(Jools @ Jan 23 2005, 08:26 AM)
curl is provided for both platforms, and therefore it is cross-platform.  I believe that there may be a problem with the ssl libraries in the windows one, but as long as you're using http and not https, there should be no problem. 

Would it be more useful if it was supported in K - yes.  Is it necessary - nope, IMHO there at a lot of other things that could be added first (including simple socket access).
*



With more web services and SOA applications coming to market, the need for XMLHttpRequest as grown. Having a lightweight widget that can com with the hosted application is huge.

Please consider this enhancement. Please?

I would love to create widget after widget for the sforce web service and demo these at every one of our events, but... no SOAP.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Arlo Rose
post Jun 8 2005, 04:59 AM
Post #13


I have a television.



Posts: 3,789
Joined: 25-August 02
From: California - Bay Area
Member No.: 2



SOAP and XML-RPC are on our roadmap. Can't tell you when they'll show up though... but hopefully sooner rather than later.


Arlo




User is offlineProfile CardPM
Go to the top of the page
+Quote Post
dcarroll
post Jun 8 2005, 01:45 PM
Post #14






Posts: 2
Joined: 6-June 05
From: San Francisco, CA
Member No.: 6,442



QUOTE(Arlo Rose @ Jun 7 2005, 09:59 PM)
SOAP and XML-RPC are on our roadmap.  Can't tell you when they'll show up though... but hopefully sooner rather than later.
Arlo
*




That's great to hear, and thanks for a timely response. I'll be here waiting patiently. I understand roadmaps and releases and committments, but it's great to know that you have non-rest web services in mind.

Thanks!

wink.gif
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Fast Reply  Reply to this topic    Start new topic  
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: