The first example will use a web service provided by StrikeIron, this service is a Text Disguise CAPTCHA-Image service. Provided you register your email you will be allowed to freely test the service. The WSDL is available at http://www.textdisguise.com/TextDisguise/CaptchaService/CaptchaService.asmx?WSDL.
A CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) is a program that can generate images that most humans can see, but current computer programs cannot. Many applications need the security of knowing that the "thing" interacting with them is, in fact, a real live person capable of thinking who is responsible for the interaction. Text Disguise solves this problem by embedding a word into an image, distorted and is then shown to the user. The user has to confirm the value entered into the box to continue.
The Text Disguise CAPTCHA-Image service defines two basic methods called
ValidateImageWord. The first method,
GetNewWord, expects no direct arguments. It returns a captcha image identifier and a link to that image. The image can be displayed and the user prompted to enter the text he or she sees in the image.
The second method,
ValidateImageWord, expects two arguments, the text entered by the user and the image identifier. The method returns true if the text is consistent with the image identifier and false otherwise.
The HTTP request containing a call to the
GetNewWord method looks like the following:
Content-Type: text/xml; charset=utf-8
User-Agent: Jakarta Commons-HttpClient/3.0
<?xml version="1.0" encoding="UTF-8"?>
Several points are worth noticing:
soapenv:Headerelement, expects an
nsl:unregisteredUserelement that must contain your email address.
soapenv:Bodyelement only contains a reference to the invoked method
GetNewWordand has no parameters.
The previous points are noteworthy because most of these elements are generated by NeoLoad and based on the WSDL definition, but as detailed in the following section, NeoLoad user interface will let you customize and configure all of them.
The process is composed of the following steps:
CaptchaServiceSoap.GetNewWordmethod. Click Next.
Pathelements. These elements, as mentioned earlier, have been extracted from the WSDL but can be changed to custom values. As with HTTP requests, the
Pathelement can been defined using NeoLoad variables.
WSDLelement can equally be changed or reloaded. Reloading is particularly useful when the SOAP request and it is associated WSDL are out of sync.
SOAPAction. If your web service Framework requires additional HTTP header elements you can set them in the Advanced parameters dialog box.
GetNewWordmethod expects no parameters or an empty so the tree only has one root element called
GetNewWord(an empty element as defined in the WSDL). Had there been several elements or several possible elements, NeoLoad would have displayed them in the tree. In the example no further configuration for the body is necessary.
UnregisteredUserin this case, or leaf elements such as
EmailAddress. Container elements are meant to contain other elements. Right clicking on them will pop up a menu from which you can choose to move the selected element or add and remove child elements. NeoLoad will only suggest child elements that are consistent with the WSDL definition.
Encodingallows special characters such as >, <, or &'to be encoded.
<?xml version="1.0" encoding="utf-8"?>
Thank you for your attempt to try this Web service. Before the
free trial can occur,
you must first validate your email address.
Simply click on the link in the email that was just sent to you,
and you will then be able to invoke every Web service
within the StrikeIron Web Services Marketplace, including this one.
faultstringelement, all you need to do to use the service a limited amount of times is to validate the email address you sent by following the link that StrikeIron has sent to you. Once your address is validated invoking the service should get you a response such as the one that follows (the HTML header has been omitted):
<?xml version="1.0" encoding="utf-8"?>
<LicenseAction>Decremented hit count</LicenseAction>
URLelement in an HTML page. As detailed in the following section you can then use the
ValidateImageWordmethod and the
CaptchaImageGuidto validate a text entered by the user.