callWebService

This extension comes handy if you need to call a WebService during the test.
Also you can develop simple web service (python, .Net, ...) to do some 'utility work' - clean up a database, execute sql, etc. and use it in your tests.

attached file contains required js code (tested with selenium 0.8.0). The second version works in 1.0b2 and probably needs improvement (wasn't sure how to declare helper function getWebServiceResponse).

callWebService returns the data from the first node of the result XML.

callWebServiceForValues takes the comma-separated list of names, takes the nodeValues from the first elements with the matching names, and stores the value in variables of the same names (see second example below).

callWebServiceForXML simply returns the result XML if you need to deal with something that has more structure than that.

Examples of implemented commands:

resetWebServiceParameters    
addWebServiceParameter user_name Doe
addWebServiceParameter pass ${password}
addWebServiceParameter timeout ${timeout}
callWebService http://somewebsite/webapp/_qa_/test_automation_svc.asmx/get_email result
.. do something with ${result}    

In the next example, the responseXML from the web method is something like:
<user>
<username>bob</username>
<password>pass1234</password>
<first>bob</first>
<last>smith</last>
</user>

resetWebServiceParameters    
callWebServiceForValues http://somewebsite/webapp/_qa_/test_automation_svc.asmx/get_user_object username, password
type username_field ${username}
type password_field ${password}
clickAndWait login_button  
resetWebServiceParameters    
callWebServiceForXML http://somewebsite/webapp/_qa_/test_automation_svc.asmx/get_user_object responseXML
... do something with responseXML which is an XMLDocument    

P.S. thanks to fellow MetaCommunications' developers for providing me with working code for the extension.

Here is a practical example I was able to make work by using a free public web service (http://free-web-services.com/web-services/unit-convertors/temparature/te...):

Example Web Service Call

File: 

AttachmentSize
Plain text icon callWebService.js.txt2.53 KB

Type: 

User-Extension