title: How to pass InputStream to REST service POST method
body: <p>How to pass <code>InputStream</code> to <code>createParcel()</code> method using Java REST client? How to call <code>POST</code> request using POSTMAN?    </p>
  
  <pre class="lang-java prettyprint-override"><code>@POST
  @Consumes(MediaType.APPLICATION_XML)
  @Produces(MediaType.TEXT_PLAIN)
  public int createParcel(InputStream is) {
      int awbNo = 0;
      try {
          ParcelInfo parcelInfo = null;
          parcelInfo = buildParcelInfo(is);
          awbNo = index.incrementAndGet();
          parcelInfo.setAwbNo(awbNo);
          parcelInfo.setStatus("new");
          parcelDataMap.put(awbNo, parcelInfo);
     } catch(Exception ex) {
          logger.error("Getting some exception for creating parcel : "+ex.getMessage(), ex);
     }
     return awbNo;
  }
  
  @GET
  @Produces(MediaType.APPLICATION_XML)
  public StreamingOutput getParcelInfo(@QueryParam("awbNo") int awbNo) {
      ParcelInfo parcelInfo = null;
      String xml = null;
      parcelInfo = parcelDataMap.get(awbNo);
  
      if (parcelInfo != null) {
          xml = convert(parcelInfo);
      }
      return new ParcelInfoWriter(xml);
  }
  </code></pre>