#!/usr/bin/env ruby # This code comes from http://ruby-it.org/pages/Client+SOAP+da+WSDL # Check the page for copyright notice and explanations >> require "soap/wsdlDriver" => true >> url="http://java.rus.uni-stuttgart.de/quiz/quiz.wsdl" => "http://java.rus.uni-stuttgart.de/quiz/quiz.wsdl" >> client = SOAP::WSDLDriverFactory.new(url).createDriver => # >> puts client.methods(false) checkCorrectAnswerById addNewEntry getRandomQuestionByDifficultyLevel getRandomQuestion getCorrectAnswerForQuestionById => nil >> dom= client.getRandomQuestion => # require "soap/wsdlDriver" url="http://java.rus.uni-stuttgart.de/quiz/quiz.wsdl" client = SOAP::WSDLDriverFactory.new(url).createDriver while true d= client.getRandomQuestion puts '========' puts d.question puts 'a: '+d.answerA puts 'b: '+d.answerB puts 'c: '+d.answerC puts 'd: '+d.answerD puts 'Premi invio per la risposta giusta..' gets puts client.getCorrectAnswerForQuestionById(d.id) puts 'vuoi proseguire?[s/n]' break unless gets.chomp=='s' end >> client.getCorrectAnswerForQuestionById 1000 SOAP::FaultError: The Id for the Question you provided doesn't exist witin this service.