FrancesKR
FrancesKR

Reputation: 1210

Accessing ISI Web of Science through SOAP

I'm trying to write a python script that retrieves information about publications from ISI Web of Science. I found domoritz's python script wos.py on GitHub. It uses Suds to connect to the ISI Web of Science web service. I've imported it into my python script and I tried this code, following the very brief instructions in the comments:

from wos import *
soap = WokmwsSoapClient()
results = soap.search('Hallam')

I then get an error:

suds.WebFault: Server raised fault: 'line 1:1: unexpected token: Hallam'

I looked through the code in wos.py. Here is the search function:

def search(self, query):
    qparams = {
        'databaseID' : 'WOS',
        'userQuery' : query,
        'queryLanguage' : 'en',
        'editions' : [{
            'collection' : 'WOS',
            'edition' : 'SCI',
        },{
            'collection' : 'WOS',
            'edition' : 'SSCI',
        }]
    }

    rparams = {
        'count' : 5, # 1-100
        'firstRecord' : 1,
        'fields' : [{
            'name' : 'Relevance',
            'sort' : 'D',
        }],
    }

    return self.client['search'].service.search(qparams, rparams)

I thought maybe query can't be just a plain python string, as I saw in the WSDL page that userQuery is actually of type xs:string. But this page says that userQuery "Must be a valid WOKQL query statement. This requirement is enforced internally", which makes it seem like I don't have to pass in a special type. Anyway, I tried appending 'xs:string' to the beginning of query but I got the same error.

Does anybody know the proper way to use this method?

Upvotes: 5

Views: 5069

Answers (2)

enrico.bacis
enrico.bacis

Reputation: 31494

You could try to use the Wos Python Client that can be install with:

pip install wos

And then you can use it like this:

from wos import WosClient
import wos.utils

with WosClient('JohnDoe', '12345') as client:
    print(wos.utils.query(client, 'AU=Knuth Donald'))

You will also have a CLI tool to be used like:

wos -u 'JohnDoe' -p '12345' query 'AU=Knuth Donald'

*DISCLAIMER: I don't work for Web of Science but I am the author of the client. You need to have web services access (which is a paid service in addition to the normal WOS access) since Web of Science does not allow web services requests coming from normal users. You should ask your university to provide you with the username and password that WOS gave them. This is not just for my client but for anything that uses WOS web service. *

Upvotes: 4

FrancesKR
FrancesKR

Reputation: 1210

So apparently passing in a python string was fine, but I needed a string that was more like a search query. I found this example on the website I mentioned before:

<soap:Body>
  <woksearch:search xmlns:woksearch="http://woksearch.v3.wokmws.thomsonreuters.com">
  <!--  this request has the minimum required elements, 
      but contains all valid retrieve options 
      for this operation and databaseId -->
  <queryParameters>
     <databaseId>WOK</databaseId> 
     <userQuery>AU=Arce, G*</userQuery>      
     <queryLanguage>en</queryLanguage> 
  </queryParameters>
....

So I tried using results = soap.search('AU=Hallam') and that worked. I can now do things like print results.recordsFound and I get correct answers.

Upvotes: 1

Related Questions