60 likes | 70 Views
Use SOAP and WSDL to access and invoke methods of web services. Construct special URLs for REST requests, receive information in XML format, and parse XML. API integration with Last.fm and Rhapsody.
E N D
Web Services SOAP and WSDL Simple Object Access Protocol Web Services Description Language To use SOAP Generate stub classes from the WSDL document Call methods from the stubs to invoke methods of web service (Remote Procedure Invocation) http://www.xmlme.com/WSShakespeare.asmx
Web Services REST (Representation State Transfer) Request information by constructing special URLs Receive information in XML format Parse XML http://www.last.fm/api http://webservices.rhapsody.com/rwssdk/rwssdk_v1_0.pdf
Main Application (MIDlet) Thread LoadArtists LoadAlbum LoadTracks Artist Album Track Thread DefaultHandler FetchXML FetchImage ArtistHandler TrackHandler AlbumHandler
Main Points Keep in mind the user and user interface Check the response codes after making a connection Reconnect on failure Follow redirect URL hc.getResponseCode() == HttpConnection.HTTP_MOVED_PERM hc.getHeaderField("Location“)
Main Application (MIDlet) Thread LoadArtists LoadAlbum LoadTracks Artist Album Track Thread DefaultHandler FetchXML FetchImage ArtistHandler TrackHandler AlbumHandler