title: How to send byte[] and strings to a restful webservice and retrieve this information in the web method implementation
body: <p>I am trying to send a byte[] as one of the parameters from my android client and receive this information in my restful web service that i have implemented in netbeans.</p>
  
  <p>this is my Android client code:</p>
  
  <pre><code>@Override
  protected String doInBackground(String... params) {
  
      String param1 = params[0];
      String param2 = params[1];
      String param3 = params[2];
      String param4 = params[3];
      String param5 = params[4];
      String param6 = params[5];
  
     //param6 is a Base64 encoded byte array to string
  
      String url = "http://ipAdress:port/example/api/booking/Booking?";
  
      String parameters = "param1=" + param1 + "&amp;param2=" +param2+ "&amp;param3="+param3+"&amp;param4="+param4+"&amp;param5="+param5+"&amp;param6="+ URLEncoder.encode( new String(param6),"UTF-8"));
      try {
          URL Url = new URL(url);
  
          HttpURLConnection con = (HttpURLConnection) 
          Url.openConnection();
  
          con.setInstanceFollowRedirects( false );
          con.setRequestMethod( "POST" );
  
          con.setDoOutput( true );
          DataOutputStream wr = new DataOutputStream(connect2Rest.getOutputStream());
          wr.writeBytes(parameters);
          wr.flush();
          wr.close();
  
          int responseCode = con.getResponseCode();
  
  
          BufferedReader is = new BufferedReader(new InputStreamReader(connect2Rest.getInputStream()));
          String inString;
          StringBuilder sb = new StringBuilder();
          while ((inString = is.readLine()) != null) {
              sb.append(inString + "\n");
          }
  
          is.close();
          String xml = sb.toString();
  
          System.out.print(responseCode);
  
          return xml;
  
  
  
      } catch (MalformedURLException e) {
          System.out.println("MalformedURLException: " + e);
      } catch (IOException e) {
          System.out.println("IOException: " + e);
      }
      return null;
  }
  </code></pre>
  
  <p>and this is my web service implementation code for this method</p>
  
  <pre><code>@POST
  @Path("createBooking")
  @Consumes({MediaType.APPLICATION_XML})
  public Bookings createBooking(@QueryParam("param1") String param1, @QueryParam("param2") String param2, @QueryParam("param3") String param3, @QueryParam("param4") String param4, @QueryParam("param5") String param5, @QueryParam("param6") byte[] param6 ){
  
      // needs implementation
      return null;
  }
  </code></pre>
  
  <p>i have currently tried puttin the encoded byte[] into the url but it cannot hold all of the byte[] information, i have looked at using the httpurlconnection POST method but i dont quite understand how to use it in my situation.</p>
  
  <p>How would i go about doing this?</p>
  
  <p>thanks</p>