title: Java Jersey Rest Web service Client Code
body: <p>I am writing a Java code which calls a Rest web service using Jersey. Here I want to set the date as query parameter. But I am getting Exception in thread "main" com.sun.jersey.api.client.UniformInterfaceException. I am not sure this is because of the date parameter. Can you please help me resolving this. This is my code:</p>
  
  <pre><code>DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
  
      Calendar cal = Calendar.getInstance();
      System.out.println("Current Date Time : "
                      + dateFormat.format(cal.getTime()));
      cal.add(Calendar.HOUR, -1);
      System.out.println("Subtract one hour from current date : "
                      + dateFormat.format(cal.getTime()));
      String dateconverted = dateFormat.toString();       
      Client client = Client.create();
      WebResource webResource = client.resource("http://localhost/viewerportal/services/rest/vmds/programs");
      //String s = webResource.get(String.class);
      System.out.println("Got the web resource."+webResource);
      MultivaluedMap queryParams = new MultivaluedMapImpl();
      queryParams.add("availableDate", dateconverted);
         //queryParams.add("param2", "val2");
      String s = webResource.queryParams(queryParams).get(String.class);
      //System.out.println("Web resource string"+s);
      String response = webResource.get(String.class);
     System.out.println("Status -------&gt;"+response);
  </code></pre>
  
  <p>and this is my exception:</p>
  
  <pre><code>Current Date Time : 2015-07-15T19:27:38Z
  Subtract one hour from current date : 2015-07-15T18:27:38Z
  Got the web resource.http://dpev827.innovate.ibm.com:8080/viewerportal  /services/rest/vmds/programs
  Exception in thread "main" com.sun.jersey.api.client.UniformInterfaceException: GET http://dpev827.innovate.ibm.com:8080/viewerportal/services/rest/vmds/programs?availableDate=java.text.SimpleDateFormat@fe8ba6fa returned a response status of 500 Internal Server Error
  at com.sun.jersey.api.client.WebResource.handle(WebResource.java:688)
  at com.sun.jersey.api.client.WebResource.get(WebResource.java:193)
  at com.ibm.cio.mediahub.PushToW3Search.main(PushToW3Search.java:89)
  </code></pre>