#!/usr/bin/perl use HTML::Template; use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use SOAP::WSDL; use Data::Dumper; # config vars my $tocheck = param('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 get a soapfault containing something like 'invalid method specification'. $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 print "Content-type: text/html\n\n"; print ""; print ""; print "OS2 - Lab3 Project"; print ""; print ""; print qq{
Online Spellchecker via SOAP and XML
}; print "
"; print qq{
}; print ""; print qq{}; print qq{}; print qq{}; print qq{}; print qq{}; print qq{}; print qq{}; print "
Enter Text:Word:
}; print qq{
Suggestions:
}; print qq{
"; print "
"; print "
"; print "XML Data Received:"; print "
"; if ($som->fault) { $result = $som->faultstring; print qq{}; } else { $result = Dumper($som->paramsall); #%result1 = $som->paramsall; #%result1 = $result; #$value = $result1{'body'}; $result = subReturningHashRef (); print qq{}; } print "
"; print "
"; print ""; print "";