This feature is only available to Enterprise editions of screen-scraper.
SOAP is a common protocol used for accessing web services based on XML. There are several libraries available in most popular programming languages which allow for the rapid development of SOAP clients.
Many of the libraries available include some method of generating the code necessary to interact with a specific SOAP interface when given a WSDL file. We have also provided two examples using a SOAP client for screen-scraper: Java and .NET.
string getLog(string filename) - Return the content of a given log file.
string getLog(string filename, boolean start, int lines) - Returns a portion of the content of a given log file.
string[] getLogNames() - Returns the names of all the files in the log directory of the remote server.
long getLogSize(string filename) - Return the size of the given logfile in bytes.
int removeLog(string filename) - Remove a log file from the log directory on the remote server.
string[] getCompletedScrapingSessions() - Returns the ID's of the completed scraping sessions.
string[] getDataRecord(string id, string var) - Get a data record for the given variable.
string[][] getDataSet(string id, string var) - Get the data set contained in a variable in a scraping session.
string[] getRunningScrapingSessions() - Return the ID's of the currently running scraping sessions.
string getScrapingSessionName(string id) - Returns the name of the scraping session where its key is id.
string[] getScrapingSessionNames() - Returns an array of names of scraping sessions which this server currently has.
long getScrapingSessionStartTime(string id) - Returns the starting time of a particular scraping session as a long.
string[] getScriptNames() - Returns the names of scripts in this server.
string getVariable(string id, string var) - Get the value of a certain variable in a scraping session.
string initializeScrapingSession(string name) - Initialize this scraping session to allow it to be scraped.
int isFinished(string id) - Returns if the session with key=id is finished.
int removeCompletedScrapingSession(string id) - Remove the scraping session given by id from the list of completed scraping sessions.
int removeScrapingSession(string name) - Remove a scraping session from the remote server and from it's database.
int removeScript(string name) - Remove a script from the remote server and it's database.
int scrape(string id) - Scrape the session given by this ID.
int setTimeout(string id, int minutes) - Set the time out minutes of a scraping session to scrape.
int setVariable(string id, string var, string value) - Set a variable within a scraping session.
int stopScrapingSession(string id) - Stop a scraping session in progress.
int update(string xml) - Update the remote server with an exported scraping session or script.
boolean isAcceptingConnections() - Returns the value to acceptingConnections, which is the value which dictates if the server is handling remote requests to scrape.
int setAcceptingConnections(boolean accepting) - Sets the value for acceptingConnections, which will either stop the server from handling requests for remote scrapes or allow them.
public static boolean isAcceptingConnections()
Returns the value to acceptingConnections, which is the value which dictates if the server is handling remote requests to scrape.
Returns: true if the server is will accept requests to scrape.
public static int setAcceptingConnections(boolean accepting)
Sets the value for acceptingConnections, which will either stop the server from handling requests for remote scrapes or allow them.
Returns: int which represents success or a specific error code.
public string[] getScrapingSessionNames()
Returns an array of names of scraping sessions which this server currently has.
Returns: names of scraping sessions.
public string[] getScriptNames()
Returns the names of scripts in this server.
Returns: names of scripts.
public string[] getRunningScrapingSessions()
Return the ID's of the currently running scraping sessions.
Returns: An array of Strings, which are the ID's.
public string[] getCompletedScrapingSessions()
Returns the ID's of the completed scraping sessions. (Also, updates the list.)
Returns: the ID's of completed scraping sessions.
public int removeCompletedScrapingSession(string id)
Remove the scraping session given by id from the list of completed scraping sessions.
Returns: an int representing success or a failure code.
public int isFinished(string id)
Returns if the session with key=id is finished.
Returns: an int representing finished (1), not finished (0) or error (0)
public string getScrapingSessionName(string id)
Returns the name of the scraping session where its key is id.
Returns: the name of a scraping session, or "-1" if not found.
public long getScrapingSessionStartTime(string id)
Returns the starting time of a particular scraping session as a long.
Returns: the starting time of the scraping session, -1 if not yet started, or 0 if session not found.
public string initializeScrapingSession(string name)
Initialize this scraping session to allow it to be scraped.
Returns: if success then the ID of this scraping session is returned, otherwise "-1".
public int scrape(string id)
Scrape the session given by this ID.
Returns: 0 if an error occurred or 1 if successfully started.
public int setVariable(string id, string var, string value)
Set a variable within a scraping session. Disallowed if acceptingConnections is false.
Returns: 1 if successfully set, 0 otherwise.
public int setTimeout(string id, int minutes)
Set the time out minutes of a scraping session to scrape.
Returns: 1 if successful, 0 otherwise.
public int stopScrapingSession(string id)
Stop a scraping session in progress.
Returns: 1 if successful, 0 otherwise.
public string getVariable(string id, string var)
Get the value of a certain variable in a scraping session. Note that currently only Strings, DataRecords, and DataSets can be accessed by this method.
Returns: if this is a valid scraping session and the value of this variable is a string, then - the value is returned, "NULL" if the value is null, and "-1" otherwise.
public string[] getDataRecord(string id, string var)
Get a data record for the given variable.
Returns: an array of String objectss like key=value or an empty array if an error happened or the variable is empty.
public string[][] getDataSet(string id, string var)
Get the data set contained in a variable in a scraping session.
Returns: an array of data records as translated to arrays of String objects.
public int update(string xml)
Update the remote server with an exported scraping session or script. As a warning, if the version of screen-scraper this xml was exported from is different from the version of screen-scraper which is running as a server, then the update may not work.
Returns: 0 for failure, 1 for success.
public int removeScrapingSession(string name)
Remove a scraping session from the remote server and from it's database.
Returns: 0 for failure, 1 for success.
public int removeScript(string name)
Remove a script from the remote server and it's database.
Returns: 0 for failure, 1 for success.
public string[] getLogNames()
Returns the names of all the files in the log directory of the remote server.
Returns: an array of the names of the log files, or null - if there is no log directory.
public long getLogSize(string filename)
Return the size of the given logfile in bytes.
Returns: a long representing the length in bytes of this file, or 0 if the file - does not exist or is empty.
public string getLog(string filename)
Return the content of a given log file.
Returns: a String of the contents of the file, or "" if not possible.
public string getLog(string filename, boolean start, int lines)
Returns a portion of the content of a given log file.
Returns: a portion of the content of the given log file, or "" if anything goes wrong.
The .NET SDK includes an executable that can automatically generate the files necessary to access screen-scraper's SOAP interface as an object.
The first step in the process is getting screen-scraper running as a server.
Next we will generate the service class to do the actual communication in SOAP for us. There is a wsdl.exe in the Bin directory of the .NET SDK. Find it on your computer. Using v1.1 type this command:
To see the options available when using wsdl.exe like the output language being Visual Basic, try the flag /?.
After creating the SOAPInterfaceService class, it is possible that there is a mistake in the code. Find the getDataSet method. If the method returns String[], then change it to String[][] and also the casting of the returned object.
The following is an example class which uses the generated class from above to call on the scraping session created in Tutorial 2.
Be sure that the newly created class is part of the compilation process.
The Axis Library included with screen-scraper makes creating a SOAP client quite easy. Using the WSDL file created from the remote procedures on the screen-scraper server, Axis can create the stubs to make calling the methods in SOAP a matter of just using an object.
The first step in the process is getting screen-scraper running as a server.
The next step is to call the WSDL2Java class in the Axis library. To do so there are six jar files which need to be in the class path to run the class. All of these files are included in the lib directory of screen-scraper.
You also need to call the correct class org.apache.axis.wsdl.WSDL2Java. We also recommend changing the output package that the created Java files go to so that it is com.screenscraper.soapclient. This can be done using the --package option.
Here is an example command-line usage of options just specified above from inside the screen-scraper directory on Windows.
This will create a new directory com where the command was issued containing the necessary stubs.
The following is an example class which uses the generated classes from above to call on the scraping session created in Tutorial 2.
Be sure that the newly created files compile with this one and that the above mentioned jars are in your CLASSPATH. Also, make sure that screen-scraper is running as a server.