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://web.archive.org/web/20170918222402/http://www.textdisguise.com:80/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 GetNewWord
and 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:
POST http://ws.strikeiron.com/textdisguise/CaptchaService
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://www.textdisguise.com/TextDisguise/CaptchaService/GetNewWord"
User-Agent: Jakarta Commons-HttpClient/3.0
Host: ws.strikeiron.com
Content-Length: 723
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<ns1:LicenseInfo
xmlns:ns1="http://ws.strikeiron.com"
soapenv:actor="" soapenv:mustUnderstand="0">
<ns1:UnregisteredUser>
<ns1:EmailAddress>john.doe@dot.com</ns1:EmailAddress>
</ns1:UnregisteredUser>
<ns1:RegisteredUser>
<ns1:UserID/>
<ns1:Password/>
</ns1:RegisteredUser>
</ns1:LicenseInfo>
</soapenv:Header>
<soapenv:Body>
<GetNewWord
xmlns="http://www.textdisguise.com/TextDisguise/CaptchaService/">
<GetNewWord/>
</GetNewWord>
</soapenv:Body>
</soapenv:Envelope>
Several points are worth noticing:
http://ws.strikeiron.com/textdisguise/CaptchaService
.SOAPAction
item.soapenv:Header
element, expects an nsl:unregisteredUser
element that must contain your email address.soapenv:Body
element only contains a reference to the invoked method GetNewWord
and 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:
.
http://www.textdisguise.com/TextDisguise/CaptchaService/CaptchaService.asmx?WSDL
CaptchaServiceSoap.GetNewWord
method. Click Next.Server
and Path
elements. These elements, as mentioned earlier, have been extracted from the WSDL but can be changed to custom values. As with HTTP requests, the Path
element can been defined using NeoLoad variables.WSDL
element can equally be changed or reloaded. Reloading is particularly useful when the SOAP request and it is associated WSDL are out of sync.ContentType
and SOAPAction
. If your web service Framework requires additional HTTP header elements you can set them in the Advanced parameters dialog box.GetNewWord
method 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.UnregisteredUser
in 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.EmailAddress
element.Encoding
allows special characters such as >, <, or &'to be encoded.<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header/>
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>
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.
</faultstring>
<faultactor/>
</soap:Fault>
</soap:Body>
</soap:Envelope>
faultstring
element, 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"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Header xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<SubscriptionInfo xmlns="http://ws.strikeiron.com">
<LicenseStatusCode>1</LicenseStatusCode>
<LicenseStatus>Valid key</LicenseStatus>
<LicenseActionCode>0</LicenseActionCode>
<LicenseAction>Decremented hit count</LicenseAction>
<RemainingHits>4</RemainingHits>
<Amount>0</Amount>
</SubscriptionInfo>
</Header>
<soap:Body>
<GetNewWordResponse
xmlns="http://www.textdisguise.com/TextDisguise/CaptchaService/">
<GetNewWordResult>
<CaptchaImageGuid>
82e16912-14c1-4253-bbcb-699585e3ba63
</CaptchaImageGuid>
<Url>
http://www.textdisguise.com/TextDisguise/CaptchaService/
CaptchaImage.aspx?
guid=82e16912-14c1-4253-bbcb-699585e3ba63
</Url>
</GetNewWordResult>
</GetNewWordResponse>
</soap:Body>
</soap:Envelope>
URL
element in an HTML page. As detailed in the following section you can then use the ValidateImageWord
method and the CaptchaImageGuid
to validate a text entered by the user.