The web-service exposes a SOAP interface, including a WSDL description of the service at:
http://ws.cdyne.com/SpellChecker/check.asmx?WSDL
To talk to the service, use SOAP::WSDL.
Something like the following should work (modify as appropriate with license key and real content to be checked):
use strict;
use warnings;
use SOAP::WSDL;
use Data::Dumper;
# config vars
my $tocheck = "you want a test?\nthars ees my boody text";
my $license = '12345yourlicensekey';
my $service = 'http://ws.cdyne.com/SpellChecker/check.asmx';
my $wsdl = "$service?WSDL";
# initialise the SOAP proxy object
my $soap = SOAP::WSDL->new();
$soap->wsdl($wsdl);
# $soap->on_action(sub { return $_[0].$_[1]; }); # uncomment if you ge
+t a soapfault containing something like 'invalid SOAPAction'.
$soap->proxy($service);
$soap->wsdlinit(caching => 1)
|| die "couldn't connect to soap service!";
# call the CheckTextBody method exposed by the web-service
my $som = $soap->CheckTextBody(
BodyText => $tocheck,
LicenseKey => $license);
# examine the result returned by the web-service
if ($som->fault) {
print "REQUEST FAILED!\n\n";
print "Soap Fault ==> ".$som->faultstring."\n";
} else {
print "REQUEST SUCCESSFUL!\n\n";
print Dumper($som->paramsall);
}
It just dumps the returned data-structure, so you'll need to have a look at what it contains to figure out what to do next.
The WSDL formally describes what will be returned in the definition of the DocumentSummary complexType.
-David
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|