.:] Java.Revver.XmlRpc.SSL [:.

August 8th, 2007 – 13:35:30
Tagged as: api, java, revver, xmlrpc

I have started a new project on SourceForge called RevverJ, however, it is pending approval still (just created today), so in the meantime, I thought I would share how I finally (after about a week of fighting) was able to communicate with the Revver API from Java.

NOTE: This Example requires a valid developer account and the Apache XMLRPC Library

1. Since Revver uses https, getting https to play nice with XMLRPC is a bit of a pain in the yoo-hoo, so here is the quick and easy method of getting it to work:

   HostnameVerifier hv = new HostnameVerifier() {
      public boolean verify(String arg0, SSLSession arg1) {
         return true;
      }
   };

   TrustManager[] trustAllCerts = new TrustManager[]{
         new X509TrustManager() {
            public void checkClientTrusted(java.security.cert.X509Certificate[] x509Certificates, String string)
               throws CertificateException { }

            public void checkServerTrusted(java.security.cert.X509Certificate[] x509Certificates, String string)
               throws CertificateException { }

            public java.security.cert.X509Certificate[] getAcceptedIssuers() {
               return null;
            }

            public void checkClientTrusted(X509Certificate[] certs, String authType) {
               // Trust always
            }

            public void checkServerTrusted(X509Certificate[] certs, String authType) {
               // Trust always
            }
         }
   };

** This is not the -right- way, just the easiest for this example – Read up on using XmlRpc over SSL

2. Now that you have your SSL setup, you need to implement the API itself. I will just jump right into the code here.

public class RevverVideoSearchContext  {
   private static final String LOGIN = "user";
   private static final String PASSWORD = URLEncoder.encode("secret");
   private static final String API_URL = "https://api.staging.revver.com/xml/1.0?login=" + LOGIN + "&passwd=" + PASSWORD;

   /**
    * Performs the search
    *
    * @param tags - The phrase or tags to search for
    */
   public void doSearch(String tags) {
      try {
         SSLContext sc = SSLContext.getInstance("SSL");
         sc.init(null, trustAllCerts, new java.security.SecureRandom());
         HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
         HttpsURLConnection.setDefaultHostnameVerifier(hv);

         XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
         config.setServerURL(new URL(API_URL));
         XmlRpcClient client = new XmlRpcClient( );
         client.setConfig(config);

         Object result = client.execute("video.find", new Object [] { search, 2 } );
         transform(result);
      } catch (Throwable e) {
         e.printStackTrace();
      }
   }

   private void transform(Object result) {
      /* Do whatever you need to here */
   }

Now, contrary to the API Documentation for the video.find method, I have been unable to pass anything other than an int as the second parameter, however, passing a value of 2 seems to return all the returnFields so that I why I have used it.

The other key thing to notice, you must encode your authentication information if there are any non-alpha/numeric characters in it, otherwise you will not authenticate correctly. I am obviously using the deprecated no charset version of URLEncoder.encode, however, for this example it really doesn`t matter.

3. Use it, or in this case, test it!

public class RevverVideoSearchContextTest extends TestCase
{
   RevverVideoSearchContext revverVideoSearchContext;

   public void testDoSearch() throws Exception
   {
      revverVideoSearchContext = new RevverVideoSearchContext();
      revverVideoSearchContext.doSearch( "monkey" );
   }
}

And there you have it, a functional java implementation of the Revver API.

My goal with RevverJ is to create a wrapper API to eliminate the need to code the low level xmlrpc stuff and stick to running the actual RPC.

I would love to have someone from revver on this project.

Another very helpful thing from the good people of revver would be a WSDL and the ability to use SOAP to communicate with the API.

Anyhow, hope this helps you guys out!

References and Links:
Revver API Docs – http://developer.revver.com/?page_id=4
Apache ws-xmlrpc – http://ws.apache.org/xmlrpc/

64 Comments

» Leave a comment now

» RSS feed for comments on this post
» TrackBack URI

  1. 1

    Abilify@official.site” rel=”nofollow”>.

    Buywithout prescription…

    Trackback made by ARTURO on 20.12.2010 @ 03:26:13

  2. 2

    symbicort vs advair

    Buyno prescription…

    Trackback made by GUY on 22.12.2010 @ 05:36:21

  3. 3

    Risperdal@official.site” rel=”nofollow”>..

    Buynow it…

    Trackback made by ANDREW on 07.01.2011 @ 10:30:36

  4. 4

    Buy@Cheap.Coral.Calcium” rel=”nofollow”>…

    Buywithout prescription…

    Trackback made by FREDDIE on 28.07.2011 @ 22:19:03

  5. 5

    Purchase@Coral.Calcium.Online” rel=”nofollow”>…

    Buywithout prescription…

    Trackback made by PERRY on 29.07.2011 @ 01:31:32

  6. 6

    Purchase@Abana.Online” rel=”nofollow”>..

    Buydrugs without prescription…

    Trackback made by OTIS on 29.07.2011 @ 07:17:19

  7. 7

    Purchase@Cheap.Abana” rel=”nofollow”>…

    Buygeneric pills…

    Trackback made by LEO on 29.07.2011 @ 07:47:22

  8. 8

    Cheap@Generic.Abilify.5mg.10mg.15mg.20mg.30mg” rel=”nofollow”>..

    Buygeneric pills…

    Trackback made by EDUARDO on 29.07.2011 @ 20:30:36

  9. 9

    Get@Acai.Online” rel=”nofollow”>…

    Buygeneric drugs…

    Trackback made by WALLACE on 30.07.2011 @ 18:57:35

  10. 10

    Cheap@Coral.Calcium.Online” rel=”nofollow”>..

    Buyno prescription…

    Trackback made by BRANDON on 31.07.2011 @ 15:56:01

  11. 11

    Buy@Discount.Abana” rel=”nofollow”>..

    Buygeneric meds…

    Trackback made by SALVADOR on 31.07.2011 @ 17:26:26

  12. 12

    Order@Discount.Abilify” rel=”nofollow”>..

    Buyit now…

    Trackback made by TERRENCE on 01.08.2011 @ 10:43:16

  13. 13

    Cheap@Abilify.5mg.10mg.15mg.20mg.30mg” rel=”nofollow”>..

    Buynow it…

    Trackback made by LEWIS on 01.08.2011 @ 16:11:35

  14. 14

    Buy@Cheap.Abilify” rel=”nofollow”>.

    Buynow it…

    Trackback made by EDUARDO on 02.08.2011 @ 21:26:40

  15. 15

    Buy@Abilify.5mg.10mg.15mg.20mg.30mg” rel=”nofollow”>…

    Buywithout prescription…

    Trackback made by ROY on 03.08.2011 @ 08:23:43

  16. 16

    Buy@Cheap.Acai” rel=”nofollow”>..

    Buydrugs without prescription…

    Trackback made by RICARDO on 03.08.2011 @ 14:51:25

  17. 17

    Buy@Discount.Acai” rel=”nofollow”>…

    Buyit now…

    Trackback made by FELIX on 03.08.2011 @ 15:46:39

  18. 18

    Order@Cheap.Acai” rel=”nofollow”>…

    Buywithout prescription…

    Trackback made by TRACY on 03.08.2011 @ 19:47:23

  19. 19

    Cheap@Acai.Online” rel=”nofollow”>..

    Buynow it…

    Trackback made by ALVIN on 04.08.2011 @ 03:46:35

  20. 20

    Buy@Generic.Acai” rel=”nofollow”>..

    Buywithout prescription…

    Trackback made by RUSSELL on 04.08.2011 @ 08:05:24

  21. 21

    Buy@Generic.Acai” rel=”nofollow”>..

    Buydrugs without prescription…

    Trackback made by JUAN on 04.08.2011 @ 10:10:31

  22. 22

    Cheap@Generic.Aciphex” rel=”nofollow”>.…

    Buygeneric drugs…

    Trackback made by BILLY on 08.08.2011 @ 02:25:50

  23. 23

    Order@Generic.Actonel” rel=”nofollow”>.…

    Buyno prescription…

    Trackback made by ADAM on 10.08.2011 @ 02:34:28

  24. 24

    Order@Discount.Actoplus.Met” rel=”nofollow”>..

    Buygeneric meds qmo…

    Trackback made by CLIFTON on 10.08.2011 @ 23:03:17

  25. 25

    Purchase@Cheap.Actoplus.Met” rel=”nofollow”>.

    Buygeneric drugs zfk…

    Trackback made by RAY on 11.08.2011 @ 00:09:36

  26. 26

    Purchase@Discount.Actos” rel=”nofollow”>…

    Buywithout prescription xiu…

    Trackback made by LLOYD on 11.08.2011 @ 07:15:42

  27. 27

    Cheap@Actos.Online” rel=”nofollow”>..

    Buynow it tly…

    Trackback made by JEREMIAH on 11.08.2011 @ 07:51:56

  28. 28

    Purchase@Generic.Actos.15mg.30mg” rel=”nofollow”>..

    Buygeneric pills zdg…

    Trackback made by VICTOR on 12.08.2011 @ 00:28:58

  29. 29

    Purchase@Cheap.Adalat” rel=”nofollow”>..

    Buygeneric meds abx…

    Trackback made by EVERETT on 12.08.2011 @ 13:47:54

  30. 30

    Buy@Coral.Calcium.Online” rel=”nofollow”>…

    Buyit now oil…

    Trackback made by LUIS on 12.08.2011 @ 16:26:05

  31. 31

    Order@Acai.Without.Prescription” rel=”nofollow”>.

    Buynow it lmg…

    Trackback made by MARVIN on 14.08.2011 @ 15:56:13

  32. 32

    Order@Generic.Accutane” rel=”nofollow”>…

    Buygeneric meds svb…

    Trackback made by JOHNNY on 17.08.2011 @ 08:58:11

  33. 33

    Buy@Discount.Aciphex” rel=”nofollow”>..

    Buyno prescription wkp…

    Trackback made by JOEL on 18.08.2011 @ 01:49:01

  34. 34

    Purchase@Aciphex.Online” rel=”nofollow”>…

    Buydrugs without prescription vrg…

    Trackback made by JERRY on 18.08.2011 @ 06:35:57

  35. 35

    Buy@Aciphex.Without.Prescription” rel=”nofollow”>..

    Buyno prescription tao…

    Trackback made by GLENN on 18.08.2011 @ 13:32:41

  36. 36

    Purchase@Cheap.Acomplia” rel=”nofollow”>.

    Buyit now ojb…

    Trackback made by VINCENT on 19.08.2011 @ 16:17:44

  37. 37

    Trackback made by MARION on 24.08.2011 @ 10:56:05

  38. 38

    abilify@and.gemfibrozil” rel=”nofollow”>.

    Buyno prescription…

    Trackback made by FREDRICK on 26.08.2011 @ 13:20:59

  39. 39

    amantadine@hydrochloride.tablets” rel=”nofollow”>..

    Buygeneric drugs…

    Trackback made by MAX on 27.08.2011 @ 15:22:03

  40. 40

    acular@albinism.buy” rel=”nofollow”>..

    Buygeneric meds…

    Trackback made by EDGAR on 28.08.2011 @ 13:34:05

  41. 41

    arjuna@pills.buy” rel=”nofollow”>..

    Buygeneric meds…

    Trackback made by RAFAEL on 29.08.2011 @ 09:03:26

  42. 42

    viagra order uk

    Buy_generic pills…

    Trackback made by MIKE on 18.10.2011 @ 23:26:30

  43. 43

    weight loss disclaimer law

    Buy_drugs without prescription…

    Trackback made by DUSTIN on 19.10.2011 @ 06:06:17

  44. 44

    what are the trimesters of pregnancy

    Buy_generic drugs…

    Trackback made by NORMAN on 20.10.2011 @ 16:45:53

  45. 45

    Trackback made by BRADLEY on 21.10.2011 @ 16:36:50

  46. 46

    Trackback made by ROBERTO on 25.10.2011 @ 09:00:39

  47. 47

    is flomax good for prostatitis

    Buy_generic meds…

    Trackback made by TOM on 25.10.2011 @ 20:38:07

  48. 48

    cancer of spine

    Buy_without prescription…

    Trackback made by CHRIS on 27.10.2011 @ 04:21:44

  49. 49

    Trackback made by GORDON on 27.10.2011 @ 12:37:16

  50. 50

    stress from clinical duty

    Buy_without prescription…

    Trackback made by TERRENCE on 28.10.2011 @ 20:18:19

  51. 51

    saline for nebulizer

    Buy_generic pills…

    Trackback made by MARC on 29.10.2011 @ 08:51:16

  52. 52

    how to get teens off drugs

    Buy_drugs without prescription…

    Trackback made by JOEL on 01.11.2011 @ 00:56:51

  53. 53

    office of generic drug

    Buy_generic drugs…

    Trackback made by GEORGE on 03.11.2011 @ 06:16:39

  54. 54

    Trackback made by JUAN on 03.11.2011 @ 07:58:51

  55. 55

    decreased appetite during pregnancy

    Buy_generic drugs…

    Trackback made by JEREMIAH on 03.11.2011 @ 18:47:49

  56. 56

    Trackback made by BILL on 03.11.2011 @ 22:08:42

  57. 57

    can a woman have colorectal cancer

    Buy_drugs without prescription…

    Trackback made by KURT on 04.11.2011 @ 11:30:27

  58. 58

    food low in cholesterol

    Buy_now it…

    Trackback made by ZACHARY on 04.11.2011 @ 18:09:06

  59. 59

    relief of skin itching

    Buy_now it…

    Trackback made by WALLACE on 08.11.2011 @ 15:40:37

  60. 60

    Trackback made by WADE on 08.11.2011 @ 17:19:50

  61. 61

    Trackback made by DALE on 09.11.2011 @ 18:18:10

  62. 62

    cause for morning erections

    Buy_generic meds…

    Trackback made by LESLIE on 15.11.2011 @ 17:55:37

  63. 63

    Trackback made by CHRISTIAN on 16.11.2011 @ 07:15:50

  64. 64

    acyclovir stada cream

    Buy_generic drugs…

    Trackback made by REGINALD on 17.11.2011 @ 06:39:38


Leave a Comment

You must be logged in to post a comment.