Created
October 28, 2011 04:59
-
-
Save pol/1321660 to your computer and use it in GitHub Desktop.
Web of Science API access with ruby libs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$auth_url = "http://search.isiknowledge.com/esti/wokmws/ws/WOKMWSAuthenticate?wsdl"; | |
$auth_client = @new SoapClient($auth_url); | |
$auth_response = $auth_client->authenticate(); | |
$search_url = "http://search.isiknowledge.com/esti/wokmws/ws/WokSearchLite?wsdl"; | |
$search_client = @new SoapClient($search_url); | |
$search_client->__setCookie('SID',$auth_response->return); | |
$search_array = array( | |
'queryParameters' => array( | |
'databaseID' => 'WOS', | |
'userQuery' => 'AU=Douglas T*', | |
'editions' => array( | |
array('collection' => 'WOS', 'edition' => 'SSCI'), | |
array('collection' => 'WOS', 'edition' => 'SCI') | |
), | |
'queryLanguage' => 'en' | |
), | |
'retrieveParameters' => array( | |
'count' => '5', | |
'fields' => array( | |
array('name' => 'Date', 'sort' => 'D') | |
), | |
'firstRecord' => '1' | |
) | |
); | |
try{ | |
$search_response = $search_client->search($search_array); | |
} catch (Exception $e) { | |
echo $e->getMessage(); | |
} | |
print_r($search_response); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'savon' | |
require 'handsoap' | |
require 'pp' | |
class Soapy | |
def initialize(opts) | |
@client = Savon::Client | |
@auth_url = opts[:auth_url] || | |
"http://search.isiknowledge.com/esti/wokmws/ws/WOKMWSAuthenticate?wsdl" | |
@search_url = opts[:search_url] || | |
"http://search.isiknowledge.com/esti/wokmws/ws/WokSearchLite?wsdl" | |
@search_xml = opts[:search_xml] || | |
<<-EOF | |
<queryParameters> | |
<databaseID>WOS</databaseID> | |
<userQuery>AU=Douglas T*</userQuery> | |
<editions> | |
<collection>WOS</collection> | |
<edition>SSCI</edition> | |
</editions> | |
<editions> | |
<collection>WOS</collection> | |
<edition>SCI</edition> | |
</editions> | |
<queryLanguage>en</queryLanguage> | |
</queryParameters> | |
<retrieveParameters> | |
<count>5</count> | |
<fields> | |
<name>Date</name> | |
<sort>D</sort> | |
</fields> | |
<firstRecord>1</firstRecord> | |
</retrieveParameters> | |
EOF | |
end | |
def authenticate(auth_url=@auth_url) | |
@auth_client ||= @client.new(@auth_url) | |
@auth_client.request :authenticate | |
@session_cookie = @auth_client.http.headers["Cookie"] | |
@search_client.http.headers["Cookie"] = @session_cookie if @search_client | |
end | |
def search(query=@search_xml) | |
@search_client ||= @client.new(@search_url) | |
authenticate if @session_cookie.nil? | |
@last_search = @search_client.request(:search) { soap.body = query} | |
end | |
def destroy | |
@auth_client.request :close_session | |
end | |
end | |
# Savon | |
soap = Soapy.new | |
pp soap.search | |
# Handsoap | |
# So... the Handsoap API turned out to be a pain, so let's just use Savon. |
http://ip-science.thomsonreuters.com/info/terms-ws/
Now I am a independant researcher, WOS is wonderful.
How could I have the opportunity to use it?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi,pol,
I wanna use WoS API service,but I have graduated from University. Can I apply this service using a non-school IP address?
I would appreciate if you reply my question .
Thanks a lot!