Book details by ISBN using ASP.NET from worldcat.org

Dear Friends,
In last post we have talked about ISBNDB.COM’s API and how to fetch the book detail using ISBN number from ISBNDB.com (https://indiandotnet.wordpress.com/2012/10/24/book-detail-by-isbn-number-using-asp-net/)

Now in this post we will talk about Worldcat.org, which is another famous book detail service provider.
It provides the response in XML

http://xisbn.worldcat.org/webservices/xid/isbn/1090280?method=getMetadata&format=xml&fl=*

 

So let us start with step 1

The page design is just simple an ISBN textbox and a search button.

So to access this I have created a WORLDCAT URL

Private Const WORLDCATURL As String = “http://xisbn.worldcat.org/webservices/xid/isbn/”

Now for change I have used Dataset here
Now on the search button click I did following code

If Me.txtISBN.Text <> String.Empty Then

‘Step2: Recreating the URL with specific ISBN number which provided by the end user
Dim requestURL As String
requestURL = WORLDCATURL + “/” + Me.txtISBN.Text.Trim() + “?method=getMetadata&format=xml&fl=*”

‘Step3: Created a xML document object and provided the Requested URL To it
Dim Doc As XmlDocument = New XmlDocument()
Doc.Load(requestURL)

‘ step 4: created dataset object and providing the XML reader to dataset
Dim ds As DataSet = New DataSet()
Dim xmlReader As XmlNodeReader = New XmlNodeReader(Doc)
ds.ReadXml(xmlReader)

‘Step 5: It will return 2 tables if the isbn number is correct so below is the logic to get book detail
If ds Is Nothing = False AndAlso ds.Tables(1).Rows.Count() > 0 Then
Me.lblBookName.Text = ds.Tables(1).Rows(0)(“title”).ToString()
Me.lblAuthor.Text = ds.Tables(1).Rows(0)(“author”).ToString()
Me.lblPublisher.Text = ds.Tables(1).Rows(0)(“publisher”).ToString()
Else
Me.lblMessage.Text = “Sorry ISBN Number not found, Please try different number.”
End If
Else
Me.lblMessage.Text = “Please enter the ISBN number”
End If

So in this way we get the book detail from ISBN using WorldCat.org provider.

Thanks & Best Regards,
Rajat Jaiswal