SOAP
SOAP is Simple Object Access Protocol. ApniUrdu.com offers RPC through SOAP.
In short, you can use our translation engine from your own software. You can send
SOAP calls through Java, C#, VB, VC, Perl, PHP etc. Our SOAP server runs on Perl (SOAP::Lite).
I wonder how many people will actually use this, but please let me know if you are
using it. Here's the first release info:
6/16/2002 12:27PM (PK, DST) - SOAP v1.01, First Urdu Web Service released. You can use our engine
in your Perl/Java/PHP/Python/VB/ASP/etc apps.
Methods
Name | Input | Output | Version | Description |
GetWords | String | Integer | 1.01 | Returns the total number of words in dictionary. The input parameter
is not of any use right now, but in the future you will be able to supply the type of words to count. For example
'N' or 'noun' to get a count of all the nouns etc. |
Translate | String | String | 1.01 | Translates the input English sentence into roman Urdu |
TransliterateEnglish | String | String | 1.01 | Transliterates English text into Urdu and returns Urdu mapping (use GetUnicode to get Urdu characters) |
TransliterateUrdu | String | String | 1.01 | Transliterates Roman Urdu text into Urdu and returns Urdu mapping (use GetUnicode to get Urdu characters) |
GetMapping | String | String | 1.01 | Translates the input English sentence into ApniUrdu's Keyboard Mapping |
GetUnicode | String | String (UTF-8) | 1.01 | Translates the input ApniUrdu Keyboard Mapping into Unicoded Urdu equivalent |
There will be more methods in the future!
Examples
Perl
NOTE: You must have SOAP::Lite installed. If you are on Unix/Linux use:
perl -MCPAN -e 'install SOAP::Lite'.
For ActivePerl:
ppm install SOAP-Lite. Perl 5.6+ supports unicode natively.
use strict;
use warnings;
use SOAP::Lite;
my $soap = SOAP::Lite -> service('http://apniurdu.com/SOAP/Urdu2.wsdl');
my $data = SOAP::Data -> value ( 'Urdu is a great language' ) -> type ( 'string' );
my $dict = $soap -> GetWords ('');
my $text = $soap -> Translate ( $data );
my $urdu = $soap -> GetMapping ( $data );
my $utf8 = $soap -> GetUnicode ( $urdu );
print <<EOT;
Words in Dictionary: $dict
Translated Text : $text
ApniUrdu Urdu Map : $urdu
Unicode Urdu text : $utf8
EOT
PHP
NOTE: You must have
php-soap installed and running.
<?
$s = new SoapObject ('http://apniurdu.com/SOAP/Urdu2.wsdl');
$dict = $s -> GetWords ();
$text = $s -> Translate ( 'Urdu is a great language' );
echo "Words in Dictionary: $dict\n";
echo "Translated into: $text\n";
?>
Visual Basic/VBScript/ASP
NOTE: You must have Microsoft SOAP library installed.
Set urduservice = CreateObject("MSSOAP.SoapClient")
urduservice.mssoapinit "http://apniurdu.com/SOAP/Urdu2.wsdl"
MsgBox urduservice.GetWords ("")
MsgBox urduservice.Translate ("Urdu is a great language")
For VB, you may add Microsoft Soap Type Library as a Reference and
do
Dim urduservice As New SoapClient instead of
CreateObject.
For ASP, change
MsgBox to something else, e.g.
Response.Write.
There are many Java SOAP implementations. Please contribute code
samples for different languages.