I am facing an exception calling moses (Statistical Machine Translation) as a service with xmlrpc installed. I firstly open a port to the Moses server
--Listening on port 8082
but the main problem is when I send a rest request with an xml as body parameter.
<methodCall>
<methodName>translate</methodName>
<params>
<param>
<value>
<array>
<data>
<value>
<array>
<data>
<value>
<string>struct</string>
</value>
<value>
<string>struct</string>
</value>
</data>
</array>
</value>
</data>
</array>
</value>
</param>
</params>
</methodCall>
When I execute it as a POST request on http://xxx.xxx.xxx.xxx:8082/RPC2
I notice that service on port fails with exception "terminate called after throwing an instance of 'xmlrpc_c::fault' Aborted "
I think the main problem is with xml body structure but I cannot find any documentation on the web for translate method. Any suggestions? Thank you.
UPDATE
Note that if I open a port with setting
--threads all
I never get response back.
A working approach but may not the most clean and safe, is calling a python client from c# or java since does not exists library on nuget for doing this work.
ProcessStartInfo start = new ProcessStartInfo();
start.FileName = "C:\\python\\python.exe";
start.Arguments = $"C:\\python27\\client.py {word}";
start.UseShellExecute = false; // Do not use OS shell
start.CreateNoWindow = true; // We don't need new window
start.RedirectStandardOutput = true; // Any output, generated by application will be redirected back
start.RedirectStandardError = true; // Any error in standard output will be redirected back (for example exceptions)
using (Process process = Process.Start(start))
{
using (StreamReader reader = process.StandardOutput)
{
string stderr = process.StandardError.ReadToEnd(); // Here are the exceptions from our Python script
string output = process.StandardOutput.ReadToEnd();
string result = reader.ReadToEnd(); // Here is the result of StdOut(for example: print "test")
}
}
and client is something like that client.py