Hello Perl Monks,
I have a project where I am supposed to access a web service using XML/SOAP to check for the spelling of some texts. The web service is located at http://ws.cdyne.com/SpellChecker/check.asmx. I looked around this site and the XML protocol format that it accepts
is:
http://ws.cdyne.com/spellchecker/check.asmx?op=CheckTextBody
SOAP 1.2
The following is a sample SOAP 1.2 request and response. The placehold
+ers shown need to be replaced with actual values.
POST /spellchecker/check.asmx HTTP/1.1
Host: ws.cdyne.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://ww
+w.w3.org/2003/05/soap-envelope">
<soap12:Body>
<CheckTextBody xmlns="http://ws.cdyne.com/">
<BodyText>string</BodyText>
<LicenseKey>string</LicenseKey>
</CheckTextBody>
</soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://ww
+w.w3.org/2003/05/soap-envelope">
<soap12:Body>
<CheckTextBodyResponse xmlns="http://ws.cdyne.com/">
<DocumentSummary>
<MisspelledWord>
<Suggestions>string</Suggestions>
<Suggestions>string</Suggestions>
<word>string</word>
<SuggestionCount>int</SuggestionCount>
</MisspelledWord>
<MisspelledWord>
<Suggestions>string</Suggestions>
<Suggestions>string</Suggestions>
<word>string</word>
<SuggestionCount>int</SuggestionCount>
</MisspelledWord>
<ver>string</ver>
<body>string</body>
<MisspelledWordCount>int</MisspelledWordCount>
</DocumentSummary>
</CheckTextBodyResponse>
</soap12:Body>
</soap12:Envelope>
I have created a simple HTML interface for the user to enter the text for spell check but am not sure how to proceed on connecting to this web site and sending the text over and retrieving the XML response back. What kind of module to I need to include in my Perl script? use xml::simple? Please help. Some simple script to help me started would be appreciated.
Thanks.
Here is my html interface to take the user input:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>OS2 - Lab3 Project</title>
</head>
<body>
<center><b><font size="+3">Online Spellchecker via SOAP and XML</b></c
+enter>
<br>
<br>
<p>
<form method="post" action="cgi-bin/check.cgi">
<b>Enter text:</b><textarea cols="45" rows="5" name="text"></textarea>
<br>
<pre> <input type="submit" name="submit" value="Submit"></
+pre>
<br>
<b>Correction:</b><textarea cols="45" rows="5" name="response"></texta
+rea>
<p>
<p>
<br>
</form>
</body>
</html>