LyricWiki talk:SOAP/Archive/2007 1
From LyricWiki
[edit] Server returning response in iso-8859-1
The server seems to be returning responses in ISO-8859-1 even if I request UTF-8. This seems to be causing some signs like "'" to be messed up, even though not all the time. I see the wiki is using UTF-8 encoding when talking to the browser and the characters are displayed correctly then. Any ideas? Remiss 04:15, 10 January 2007 (EST)
- Uhm, ' works ok I think, but more special signs like ‘ and ’ are problematic. Remiss 04:25, 10 January 2007 (EST)
- Yet another thought, if you still need a solution on the soap page failures not being removed when the pages are created you could check for it when you are updating the cached version of the soap page failures. Sorry if I'm not making much sense, but I've been up for 24 hours Remiss 04:43, 10 January 2007 (EST)
- Hi, you said even if I request UTF-8... how is that done? I don't know how to change encodings in nuSOAP yet, but I might be able to figure that out, or at the very least throw a utf8_encode() around the results before I return them.
- -Sean Colombo 23:31, 15 January 2007 (EST)
- I was setting all kind of headers and specifying that the request was encoded in utf-8 as well. The correct header to set would be Accept-Charset [1] and put the encoding name for utf-8 there (can't remember what it is right now) when one wants UTF-8 -- Anyway, I believe the soap-script always should return result in UTF-8 or reencode them in the charset it is sending it back in as they (as far as I can figure out) is stored in an UTF-8 database. The correct header to set when sending back the reply is Content-Type
Know you're probably busy with pedlr, but any progress on this? Remiss 08:34, 21 February 2007 (EST)
- I think it's fixed now but have limited abilities to test it. Let me know if it's still messed up
- -Sean Colombo 14:35, 10 April 2007 (EDT)
Hi guys! Im also having trouble with encoding. Swedish charcters becomes messed up. I have tried converting from iso-8859-1 to UTF-8 with no success. If I lookup the song on lyricwiki.org the lyrics are all fine. It seems to be an issue on the actual webservice. Im coding in vb.net in VS 2005. My request (also containing swedish characters) works just fine. Heres my call:
Dim lw As LyricWiki
Dim lr As LyricsResult
lw = New LyricWiki
lr = lw.getSong("Staffan Hellstrand ", "Lilla Fågel Blå")
Debug.Print(lr.lyrics)
Any ideas on this? --Pär 15:45, 7 October 2007 (EDT)
- Hi,
- What is the result of that call? Can you paste the XML result (if vb.net lets you see the whole thing)?
- Thanks,
- -Sean Colombo 18:42, 7 October 2007 (EDT)
Hi Sean, Sorry, my fault, that song did not look ok on the website either and needs to be fixed. The following code converts from ISO-8859-1 to UTF8 so that swedish characters work ok.
Dim Lyrics As String
Dim lw As LyricWiki = New LyricWiki
Dim lr As LyricsResult = lw.getSong(Artist, Song)
Dim iso8859 As Encoding = Encoding.GetEncoding("ISO-8859-1")
Lyrics = Encoding.UTF8.GetString(iso8859.GetBytes(lr.lyrics))
Thanks, --Pär 16:53, 8 October 2007 (EDT)
I am still stuck with this problem. If I request songs in utf-8, I get ISO-8859-1 back. If I request this song: http://lyricwiki.org/%D0%A1%D0%BF%D0%BB%D0%B8%D0%BD:%D0%A4%D0%B5%D0%BB%D0%BB%D0%B8%D0%BD%D0%B8 in utf-8, I get in the response all ?????? instead of artist/title. So how do I request (using soap) the above song? and how (in what encoding) do I get the result back. In short: Why doesn't it just work with utf-8, and why don't I get utf-8 back?
- I've been working on the encoding the last few days, and ran into some interesting problems. For some reason, I can't just take the data out of the database, encode it a certain way and serve it. It appears that I have to encode it differently based on how it was stored (this boggles my mind!). Interestingly, the API seems to handle your example really well as a REST request [2]. I see what you're talking about w/the SOAP version though. I'll look into that.
- Thanks for the bug-report
- -Sean Colombo (talk|contribs) 08:55, 12 June 2008 (EDT)
- It is a soap request I do. And there it fails,
Request: <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:LyricWiki"> <SOAP-ENV:Body> <tns:getSong xmlns:tns="urn:LyricWiki"> <artist xsi:type="xsd:string">Феллини</artist><song xsi:type="xsd:string">Сплин</song></tns:getSong></SOAP-ENV:Body></SOAP-ENV:Envelope> This is valid, utf-8 request (I hope wiki does not mangle it to much) request.response: <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:si="http://soapinterop.org/xsd" xmlns:tns="urn:LyricWiki"><SOAP-ENV:Body><ns1:getSongResponse xmlns:ns1="urn:LyricWiki"><return xsi:type="tns:LyricsResult"><artist xsi:type="xsd:string">?????</artist><song xsi:type="xsd:string">???????</song><lyrics xsi:type="xsd:string">Not found</lyrics><url xsi:type="xsd:string">http://lyricwiki.org</url></return></ns1:getSongResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
- It seems REST with xml also goes wrong: [3]
More proof that rest isn't liking this either, this is what I get from libxml: http://lyricwiki.org/api.php?artist=Queensrÿche&song=Take%20Hold%20Of%20The%20Flame&fmt=xml Entity: line 3: parser error : Input is not proper UTF-8, indicate encoding ! Bytes: 0xFF 0x63 0x68 0x65 <artist>Queensr�che</artist>
Please, if you say you output to UTF-8, output UTF-8.
It looks like every request made where the artist/title can be encoded using a ISO-8859-1 is not displayed in the result as utf-8. if the artist/title contains f.e. russian or japanese characters it works, but queensrÿche and a few others don't. I hope this helps tracking down the issue?
[edit] Returning empty lyrics though song exists (probably redirect !?)
The webservice returned an empty string (not "Not found") when I was querying for A-ha:Dark_Is_The_Night_For_All. The article exists and redirects to A-ha:Dark_Is_The_Night_For_All For All. This is an undesired behaviour. The webservice should return the lyrics for the redirected article or at least a "Not found" and not an empty string. -Ronson 11:28, 20 January 2007 (EST)
- I've seen the same bug in some other pages that are on Special:Soapfailures. For example, Nirvana:Smells Like Teens Spirit (note the extra "s" in "Teens"). Not sure what I did wrong there, but I'll look into it.
- -Sean Colombo 18:25, 22 January 2007 (EST)
- Fixed. I actually didn't do any explicit fixes for this, but it works now. This must have been fixed by something else I did.
- -Sean Colombo 18:28, 23 January 2007 (EST)
[edit] About those questionmarks...
FYI... the questionmarks on the SOAP failures are probably just foreign characters... but they might be actual question marks (if that turns out to be the case, I'll ignore them automatically)... still looking into it.
-Sean Colombo 18:39, 23 January 2007 (EST)
- BTW, forgot to mention... turned out that they were not foreign characters. So now the "???" artists/titles have been ignored, so they don't show up in the SOAP failures anymore.
- -Sean Colombo 22:01, 29 January 2007 (EST)
- When using ruby, i get questionmarks instead of umlauds é's á's and other special chars
- Using:
- require 'soap/wsdlDriver'
- driver = SOAP::WSDLDriverFactory.new("http://lyricwiki.org/server.php?wsdl").create_rpc_driver
- driver.getSong("coldplay","talk")
- What I've heard from multiple other testers (after spending a lot of time trying to "fix" our end of it) is that it turns out that Ruby (or maybe just the SOAP client?) just doesn't do UTF8 correctly yet, and it's apparently a known issue. Now that Rails is popular, I think people are working on it, but I haven't heard a planned date to release fixes or anything.
- Sorry,
- -Sean Colombo 10:35, 23 April 2007 (EDT)
- Ruby and Rails can indeed use UTF8 quite well as I have a RoR project that uses it right now. So I suspect the problem lies in the SOAP client. (anon guy just passing through looking for API info)
[edit] SOAP Page Failures - (report as fixed) problem
One of the songs listed in the failure list is The All American Rejects - Can't Take It. When I try to report as fixed, it gives this (emphasis added): Sorry, but The All American Rejects:Can song still failed. It looks like it is getting cut off at the apostrophe. There is probably a problem with escaping the string for the database lookup. This is somewhat of a problem, because it may also represent a security problem, specifically SQL injection.
- teknomunk (talk,E) 18:43, 23 January 2007 (EST)
- Thanks for the heads-up! I looked into it, and everything is still safe server-side from a mysql-injection... when I was making the link to report the song as fixed, I had forgotten to urlencode() the artist and song name, so only "The All American Rejects:Can" was being taken as the URL and the rest was just trash in the HTML tag. So the link works now, but oddly the song still isn't showing up as fixed :-/
- Thanks again,
- -Sean Colombo 09:23, 25 January 2007 (EST)
- Could you please give me an explanation or a link to an explanation, what this "fixed" link for failed SOAP requests means and causes? What's the purpose? Thanks.
- Ronson 12:07, 25 January 2007 (EST)
- Oops, I should have put that on there before. There is now an explanation on Special:Soapfailures
- -Sean Colombo 22:11, 29 January 2007 (EST)
[edit] No results for Janet Jackson:Got 'Til It's Gone
Could not get a result for Janet Jackson:Got 'Til It's Gone. Any guesses why? - Ronson 16:00, 11 February 2007 (EST)
- My guess is something with those single-quotes. I'll look into it.
- -Sean Colombo 13:55, 26 February 2007 (EST)
- Verified to be working properly.
- Spacejens 15:31, 4 December 2008 (UTC)
[edit] Ampersands
There were a bunch of failed requests for Cassie:Me & U when the real song name is Cassie:Me & U & U. Has anyone else noticed issues with ampersands, or might this just be someone's mislabeled song in their player?
-Sean Colombo 13:56, 26 February 2007 (EST)
[edit] Additional notes-to-self
- The all-caps exception for artists isn't there for songs, so Foo Fighters:DOA doesn't work through the SOAP.
- Maybe there should be another page for seeing the artists with the most failed requests? Use this query:
- select request_artist,sum(numRequests) as requests from lw_soap_failures group by request_artist order by requests desc limit 50;
- Benny Benassi:Who's Your Daddy? doesn't work... probably because the Who's is parsing to Who'S. Revisit the rules for this.
[edit] Status
I tested, and all the songs listed here work now. The suggestion for listing artists with the most failed requests has been copied to LyricWiki_talk:SOAP#Page_listing_artists_with_the_most_failed_requests. Spacejens 10:08, 30 January 2009 (UTC)
[edit] Song not working using SOAP
Hello All, Thanks for the great service. I found this problem today using SOAP getSong method, the
song: Joaquin Sabina:Esta Boca Es MíA artist: Joaquin Sabina
Is not returning any lyrics. I though was the "í" char, but there are other accentuated chars that are working great.
Thanks in advance --Raul
- Hi, the problem was that the A on the end was capitalized and the SOAP makes assumptions about capitalization (to try to be able to find the songs no matter how they are given to it. I've moved the page and put a redirect in from the old capitalization so it should work now.
- For more info, please see Page Names.
- Thanks,
- -Sean Colombo 10:31, 23 April 2007 (EDT)
[edit] Search Functions
I'm working on a PHP app, just a personal project, to do album/artist/song searches and displaying them on a web site.
Are the functions mentioned under Current Progress the only functions currently complete? I noticed for example that the searchArtists function returns wrong values; I made a search for Nightwish and got Pink Floyd.
Technically, I could do a check if the artist exists or is valid by using the getArtist function, but that seems like a waste of resources, since if the artist exists, it would return a boat load of information. e.g. Nightwish or Metallica. It would be easier if a search function, like searchArtist could do the job for me and just return TRUE or FALSE values. Then another query could be used to get the actual data.
Is this the original purpose of the search functions or am I way off? --Datamike 04:19, 5 June 2007 (EDT)
- Yeah, the SOAP (interface / documentation) is a little behind :) There is a checkSongExists() so it would make sense also to have a checkArtistExists(). Also, the getSOTD() suggests creating a getAOTW() as well. Sounds like a project :) --Mischko <img src="/images/3/31/Talkicon.png" alt="Talk to me" /> <img src="/images/1/1e/EsperanzaIcon.png" alt="Esperanza Member" /> 13:39, 5 June 2007 (EDT) PS that's a hint :)
[edit] api.php
SOAP is still a bit incomplete, why standard MediaWiki http://lyricwiki.org/api.php does not work? exe 04:51, 23 November 2007 (EST)
- At the time that we made our api.php file, MediaWiki did not have a normal api.php yet (and we didn't know they were planning on making one).
- -Sean Colombo (talk|contribs) 09:03, 14 June 2008 (EDT)
- A note on this topic has been added to LyricWiki:SOAP.
- Spacejens 10:19, 14 January 2009 (UTC)
[edit] getArtist for Britney Spears
When I try and return an array of albums from Britney Spears, it just returns 1 array with songs in it and no albums. It'll work with every other artist I've tried though.
$artist = 'Britney Spears';
$result = $client->call('getArtist', array('artist' => $artist ));
print_r($result);
Am I doing something wrong?— The preceding unsigned comment was added by 216.143.51.66 (talk), 18:21, 27 November 2007.
- This fault occurred because the page for that artist was not divided into albums. This is sometimes the case, and is not an error on the part of the API user. In any case, the page for Britney Spears does no longer have this problem. I will archive this entry soon.
- Spacejens 09:16, 14 January 2009 (UTC)

