PDA

View Full Version : web services


alexsystems
05-05-2003, 11:40 AM
How to use setQueryString()?

***.setQueryString({zip: z}); - Is this correct?

antun
05-05-2003, 01:16 PM
Hey alexsystems

I had a look at the webservicex site, and got some airport information using the following URL:

http://www.webservicex.net/airport.asmx/getAirportInformationByAirportCode?airportCode=OAK

I guess that's how you do SOAP calls on it. All the useful information it returns is actually escaped. e.g. It returns


<CityOrAirportName>OAKLAND INTL</CityOrAirportName>


instead of:


<CityOrAirportName>OAKLAND INTL</CityOrAirportName>


Having said that, what I did was took the returned string and converted it back to XML (manually) and used that as a local dataset (the file is attached):


<canvas debug="true">
<dataset name="airportData" src="localdata.xml" />

<!-- This is for debugging -->
<view datapath="airportData:/string/NewDataSet/Table[1]/AirportCode"
ondata="debug.write( this.datapath.serialize() )" />

<view datapath="airportData:/string/NewDataSet">
<simplelayout axis="y" spacing="10" />
<view datapath="Table[1]" bgcolor="0xe5e5e5">
<simplelayout axis="y" spacing="3" />
<text bgcolor="red" datapath="AirportCode/text()" />
<text bgcolor="red" datapath="CityOrAirportName/text()" />
</view>
</view>
</canvas>


Does that help? If you can explain a little more concisely what you're trying to achieve I can tell you what the best approach is.

-Antun

alexsystems
05-05-2003, 01:30 PM
Thanks antun,

right now i'm having trouble passing the parameter. how can i use setQueryString()?

antun
05-05-2003, 01:40 PM
You have the right idea here:


var zip = '94107';
setQueryString({zip: z});


But I'm not sure that the web services website you mentioned originally accepts that format.

-Antun

alexsystems
05-05-2003, 01:45 PM
i ran this url:

http://www.webservicex.net/airport.asmx/getAirportInformationByAirportCode?airportCode=LAX

and I got a result that looks like an xml document. What did you use to convert the string to xml?
I was using .setQueryString({airportCode : airportCodeView.airportcode.getText()}); but everytime I ran the getNodeCount() the result is zero - any thoughts?

alexsystems
05-05-2003, 01:47 PM
What format do you think it accepts and how should I pass the parameter in this site?

antun
05-05-2003, 02:01 PM
What did you use to convert the string to xml?


I used my favorite text editor (VIM). I had to do it manually, and then ran the dataset locally. If you wanted to do it on the fly the best way to do it would be to write a script (JSP, PHP, Perl etc.) on your server that did it for you. I wonder if there is a way to request it as XML from the webservicex.com website?

Anyway here's what I would do to get the URL you're using:


<canvas debug="true">
<dataset name="myData"
src="http://www.webservicex.net/airport.asmx/getAirportInformationByAirportCode"
type="http" autorequest="false" />

<button>Get the data
<method event="onclick">
var ac = 'LAX';
var ds = canvas.datasets.myData;
ds.setQueryString( {airportCode : ac } );
ds.doRequest();
</method>
</button>

<!-- This is just to see that something is coming back -->
<view datapath="myData:/"
ondata="debug.write( this.datapath.serialize() )" />
</canvas>


-Antun

alexsystems
05-06-2003, 08:18 AM
does anybody know any web services that returns xml format instead of strings?

antun
05-06-2003, 08:23 AM
Have you looked at these:

http://www.xmethods.net/

-Antun

antun
10-01-2003, 03:58 PM
There's also this one:

http://search-result.com/

-Antun