Skip to content

Instantly share code, notes, and snippets.

@sankichi92
Last active July 17, 2016 04:14
Show Gist options
  • Save sankichi92/846b9cc4ad3f4959581631c962b3d150 to your computer and use it in GitHub Desktop.
Save sankichi92/846b9cc4ad3f4959581631c962b3d150 to your computer and use it in GitHub Desktop.
Service Computing Assignment 3 - Practice of Information Systems
require 'savon'
source_lang, target_lang, source = ARGV
wsdl = 'http://langrid.org/service_manager/wsdl/KyotoUJServer'
auth = %w(username password) # TODO: replace username and password with yours
client = Savon.client(wsdl: wsdl, basic_auth: auth)
response = client.call(:translate) do
message sourceLang: source_lang, targetLang: target_lang, source: source
end
# p response.body
puts response.body[:translate_response][:translate_return]
@sankichi92
Copy link
Author

sankichi92 commented Jul 8, 2016

Requirement

I used Savon (2.11.1).

$ gem install savon

Usage

  1. Replace the contents of the variable "auth" with your username and password.
  2. Give a "source language", "target language" and "source" as arguments at execution.
$ ruby jserver.rb en ja 'Hello, world!'

Then you can get following results.

こんにちは世界!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment