Results 1 to 8 of 8

Thread: processing remote data (ASP.Net)

  1. #1
    IBM
    IBM is offline
    there but for the grace of God, go I IBM's Avatar
    Join Date
    Dec 2003
    Location
    West London
    Posts
    4,187
    Thanks
    149
    Thanked
    244 times in 145 posts
    • IBM's system
      • Motherboard:
      • Asus P5K Deluxe
      • CPU:
      • Intel E6600 Core2Duo 2.40GHz
      • Memory:
      • 2x2GB kit (1GBx2), Ballistix 240-pin DIMM, DDR2 PC2-6400
      • Storage:
      • 150G WD SATA 10k RAPTOR, 500GB WD SATA Enterprise
      • Graphics card(s):
      • Leadtek NVIDIA GeForce PX8800GTS 640MB
      • PSU:
      • CORSAIR HX 620W MODULAR PSU
      • Case:
      • Antec P182 Black Case
      • Monitor(s):
      • Dell 2407WPF A04
      • Internet:
      • domestic zoom

    processing remote data (ASP.Net)

    I want to code a page which fires off a url to a website which handles isbn requests and then parse the XML response.

    Any ideas how to go about it?

    Here's the URL of the service http://isbndb.com/

    I've got a feeling I'm missing something obvious, but I'm at a loss.
    sig removed by Zak33

  2. #2
    Large Member
    Join Date
    Apr 2004
    Posts
    3,720
    Thanks
    47
    Thanked
    99 times in 64 posts
    Really not sure what you're after at all.

    You mean you're application will have prior knowledge of the isbn number and therefore URL's will be like this (for e.g.):

    http://isbndb.com/search-all.html?kw=0812523008

    If so you can read that page via HTTP with relative ease, I won't bother explaining that here. As for parsing that page as XML, well, that will be a bit more tricky seeing as the document isn't XML. You'd have to use an XML parser with interfaces that don't validate the document, if the code is uniformaly reasonable on each page you request than you shouldnt have too many problems. If that's not suitable though you could just search the page for a particular keyword and just parse out the stuff you dont need with some basic string manipulation.
    Last edited by yamangman; 01-01-2007 at 10:56 AM.
    To err is human. To really foul things up ... you need a computer.

  3. #3
    Large Member
    Join Date
    Apr 2004
    Posts
    3,720
    Thanks
    47
    Thanked
    99 times in 64 posts
    If you just wanted to retrieve the book information say, it seems uniform on every page the book info is contained within a div tag with the class "bookInfo". Now it may be more noddy to retrieve this information via XML parsing but the fact is if that's all the information you want (bearing in mind it seems you'll be querying a single item at a time) the parsing will have comparatively huge overheads rather than just looking for that string (or use some other algorithm).
    To err is human. To really foul things up ... you need a computer.

  4. #4
    IBM
    IBM is offline
    there but for the grace of God, go I IBM's Avatar
    Join Date
    Dec 2003
    Location
    West London
    Posts
    4,187
    Thanks
    149
    Thanked
    244 times in 145 posts
    • IBM's system
      • Motherboard:
      • Asus P5K Deluxe
      • CPU:
      • Intel E6600 Core2Duo 2.40GHz
      • Memory:
      • 2x2GB kit (1GBx2), Ballistix 240-pin DIMM, DDR2 PC2-6400
      • Storage:
      • 150G WD SATA 10k RAPTOR, 500GB WD SATA Enterprise
      • Graphics card(s):
      • Leadtek NVIDIA GeForce PX8800GTS 640MB
      • PSU:
      • CORSAIR HX 620W MODULAR PSU
      • Case:
      • Antec P182 Black Case
      • Monitor(s):
      • Dell 2407WPF A04
      • Internet:
      • domestic zoom
    Sorry, forgot you had to sign up for all the access protocol details.

    Basically you send the site a URL like this one

    http://isbndb.com/api/books.xml?acce...ue1=0596002068

    and the site responds with something like this

    <?xml version="1.0" encoding="UTF-8"?>
    <ISBNdb server_time="2005-02-25T23:03:41">
    <BookList total_results="1" page_size="10" page_number="1" shown_results="1">
    <BookData book_id="somebook" isbn="0123456789">
    <Title>Interesting Book</Title>
    <TitleLong>Interesting Book: Read it or else..</TitleLong>
    <AuthorsText>John Doe</AuthorsText>
    <PublisherText>Acme Publishing</PublisherText>
    </BookData>
    </BookList>
    </ISBNdb>

    What I want to know is what's the procedure for sending a URL from within my code, and then handling the response from the site? Is there a server component which allows you to set a url as a parameter, and then handle the response? Is it something you can handle using GET? Or do I have to look into things like SOAP?

    Thanks for the help though yamangman...any input is appreciated.
    sig removed by Zak33

  5. #5
    Large Member
    Join Date
    Apr 2004
    Posts
    3,720
    Thanks
    47
    Thanked
    99 times in 64 posts
    No soap is unnecessary, not to mention your isbn service is hardly likely to be running it. What i'd do is open a socket connection to your resource and then perform a GET request ('GET / HTTP/1.1\r\n') and read the contents into a var ready for your parsing manipulation. Beef up on the HTTP protocol so you can handle the transaction cleanly (i.e. 'Connection: Close\r\n\r\n').
    To err is human. To really foul things up ... you need a computer.

  6. #6
    IBM
    IBM is offline
    there but for the grace of God, go I IBM's Avatar
    Join Date
    Dec 2003
    Location
    West London
    Posts
    4,187
    Thanks
    149
    Thanked
    244 times in 145 posts
    • IBM's system
      • Motherboard:
      • Asus P5K Deluxe
      • CPU:
      • Intel E6600 Core2Duo 2.40GHz
      • Memory:
      • 2x2GB kit (1GBx2), Ballistix 240-pin DIMM, DDR2 PC2-6400
      • Storage:
      • 150G WD SATA 10k RAPTOR, 500GB WD SATA Enterprise
      • Graphics card(s):
      • Leadtek NVIDIA GeForce PX8800GTS 640MB
      • PSU:
      • CORSAIR HX 620W MODULAR PSU
      • Case:
      • Antec P182 Black Case
      • Monitor(s):
      • Dell 2407WPF A04
      • Internet:
      • domestic zoom
    Sorry, you've lost me. When you say 'open a socket connection to your resource and then perform a GET request ('GET / HTTP/1.1\r\n') and read the contents into a var' do you have any idea of the syntax in ASP.Net (VB) on how to do that? Or even any suggested links on where to find more information on it?

    In fact, where does '('GET / HTTP/1.1\r\n')' come from?
    sig removed by Zak33

  7. #7
    Large Member
    Join Date
    Apr 2004
    Posts
    3,720
    Thanks
    47
    Thanked
    99 times in 64 posts
    It's what a raw GET HTTP request looks like. I'm not too familiar with .NET VB, but I know there is a XML DOM component that you could use - Microsoft.XMLHTTP.

    Code:
    Dim xml
    
    xml = Server.CreateObject("MSXML2.ServerXMLHTTP")
    xml.Open("GET", "http://isbndb.com/api/books.xml?access_key=12345678&index1=isbn&value1=0596002068", False)
    xml.Send()
    Probably not very .NET friendly. It's very much COM. Look up the 'WebRequest' class in .NET, much nicer: http://msdn2.microsoft.com/en-us/lib...ebrequest.aspx
    Last edited by yamangman; 01-01-2007 at 08:56 PM.
    To err is human. To really foul things up ... you need a computer.

  8. #8
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,164
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts
    its worth saying that there are webservices for this sort of thing.

    http://xmethods.net/ve2/ViewListing.po?serviceid=7

    is one of the top search results i find for this.

    Using webservices in .Net is REALLY easy, not to mention it can be made too wrap them up asynconously for you, which if your using AJAX can lead to a very good user experiance!
    throw new ArgumentException (String, String, Exception)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. ISP PlusNet Accidentally Deletes 700GB of Email
    By Tobeman in forum Networking and Broadband
    Replies: 21
    Last Post: 19-08-2006, 08:53 PM
  2. Privacy concern - Scan orders being reported to 3rd parties.
    By Paranoid2000 in forum SCAN.care@HEXUS
    Replies: 35
    Last Post: 09-06-2006, 07:35 PM
  3. Data Recovery
    By LayZeh in forum PC Hardware and Components
    Replies: 8
    Last Post: 04-08-2005, 11:00 PM
  4. Remote Desktop help with IP address
    By Proplus in forum Networking and Broadband
    Replies: 3
    Last Post: 28-03-2004, 05:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •