dboyerco Posted August 1, 2007 Share Posted August 1, 2007 I have a transporting business and I would like to be able to allow my clients to log on to my website and see where my truck is located on a google map.The company that is tracking my vihicle has a API that will allow me to log into their database and retrieve the location of my vihicle, which is returned to their website as an XML response. My question is: Is there way to send the request for the data and capture the response and place it into an XML file so I can use that data on my website. I tried talking to the company, but they don't have any tech people there. Here is the code that they have on their website as an example: <form method='post' action='https://www.sysdevx.com/api/GetAllVehicles.php'> <input type='text' name='login' value='your_login' /> <input type='text' name='password' value='your_password' /> <input type='submit'></form> And the response that is returned to their website is: <response> <status code="100" msg="Success"/> <vehicle serial="2002348" date="1170813924" lat="49.2520500" lng="-123.1108800" type="18" address="271 W 21st Ave, Vancouver, BC, V5Y" speed="0" heading="0"/> <vehicle serial="2001452" date="1157654983" lat="49.2521320" lng="-123.1111760" type="17" address="" speed="0" heading="0"/> <vehicle serial="2001450" date="1168890892" lat="32.7947333" lng="-117.1367500" type="0" address="8999 Gowdy Ave, San Diego, CA, 92123" speed="0" heading="1"/></response> Link to comment Share on other sites More sharing options...
jesh Posted August 1, 2007 Share Posted August 1, 2007 I responded to your posting in the Javascript forum. If you have any questions feel free to post them here. Link to comment Share on other sites More sharing options...
dboyerco Posted August 1, 2007 Author Share Posted August 1, 2007 Hi Jesh.Thanks for the code example. I'll give it a try.Is the code example, what I use in a proxy page or in the aspx? This is all alittle new to me and I'm alittle confused about what I'm doing so please bear with me the light might come on any minute.Thanks Link to comment Share on other sites More sharing options...
jesh Posted August 1, 2007 Share Posted August 1, 2007 This is all alittle new to me and I'm alittle confused about what I'm doing so please bear with me the light might come on any minute.Don't worry about it, it was new to me once too.The way this could work would be that you set up an AJAX request (see the AJAX tutorial) that would, in turn, POST some data to your aspx proxy page. It would be just like any other aspx page that handles posted data.Then, on the proxy page, you would create the WebClient (or HttpWebRequest, whichever works best for you) to read the data that is POSTed from the AJAX function and then pass that data, if necessary, to the third-party form. The third-party form would return a response that your WebClient (or HttpWebRequest) would read and then return to your AJAX function.As far as the AJAX (javascript) function is concerned, only your proxy page was ever contacted. All the communication with the external site would be performed on the server.Then, using the XML DOM (check out the tutorial), you could parse through the XML response and get at the data. This step could also be done in ASP.NET if you only want one particular piece of data to be returned to your AJAX function. I haven't played around with XML in .NET so I wouldn't be able to help much there. Others here would, though, I'm sure. Link to comment Share on other sites More sharing options...
dboyerco Posted August 2, 2007 Author Share Posted August 2, 2007 Hey Jesh.Ok I think I've got it.I'll play with it a bit and see if I can get it to work.Thanks Link to comment Share on other sites More sharing options...
aspnetguy Posted August 2, 2007 Share Posted August 2, 2007 parse XML in .Net is a bit tricky at first (JavaScript DOM in much more intuitive) but works great. Try this http://www.perfectxml.com/articles/xml/csharp.asp Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.