Music
 

LyricWiki:SOAP/Ruby

From LyricWiki

[edit] Ruby SOAP

Example code:

require 'soap/wsdlDriver' 
require 'iconv'
driver = SOAP::WSDLDriverFactory.new("http://lyricwiki.org/server.php?wsdl").create_rpc_driver 
lyrics = Iconv.iconv("Latin1", "UTF8", driver.getSong(artist,song).lyrics)

[edit] Issues

  • Incorrect conversions
    • The ruby SOAP implementation does strange things to characters outside of ASCII. Currently the SOAP service returns lyrics encoded in ISO-8859-1 (Latin1). The lyrics are correctly encoded in Latin1, however ruby tries to do an encoding assuming a different encoding and therefore messes up the character encoding. This seems to be solved using the Iconv class.
  • Non-latin characters
    • Characters that are not defined in ISO-8859-1 (Latin1) are returned from the server as question marks (?).
    • Artist names that use characters not in Latin1 are not retrieved at all.