The Goal:
To retrieve information from a 3rd party database based off of a user’s query on my ASP.NET website
The Details:
I need to be able to search 3rd-party websites for information relating to pharmaceutical drugs. Basically, here’s what I’ve been tasked with: a user starts entering the name of a drug they’re using in their experiments, and while they’re typing a 3rd party website (e.g., here or here) is queried and suggestions are made based off of what they’ve typed. Once they’ve made a selection, certain properties (molecular weight, chemical structure, etc) are retrieved from the 3rd party database and stored in our database. PharmaGKB.org‘s search bar is pretty much what I need to implement, but I need to access a 3rd party db. The site that I’m working on is ASP.NET/C#.
The Problem:
I don’t really know where to start with this. There’s a downloadable Perl example at the bottom of the page here, but it didn’t really help me all that much. I’m at a loss as to how to implement this, or even find information about how to do it. The AJAX toolkit was suggested, but I’m not sure if that will solve the issue. JavaScript is also being considered, but again, I’m not sure if that will be sufficient, either.
Perl Example Connection
As a mentioned, here is a snippet from the Perl example given on the Pharmgkb.org site:
my $call = SOAP::Lite
-> readable (1)
-> uri('SearchService')
-> proxy('http://www.pharmgkb.org/services/SearchService')
-> search ($ARGV[0]);
However, I’m not sure how to implement this is C#/ASP.NET/JavaScript. There’s a question on Stack Overflow about embedding Perl in C#, but it require a C wrapper as well, and I don’t think that three languages is necessary or wise to solve this issue.
Continuing from the comments to your post, here’s what I think you can do:
Then, you can use the service reference like:
Also, considering the whole scenario of your problem, you would want this service to be run on text changed event of javascript/jQuery. You can learn how to call code-behind methods from jQuery using ajax in this article: jquery ajax calling Wcf service or some method in Code behind from Client Side