title: jersey web client exception
body: <p>i have jersey client code as follow</p>
  
  <pre><code>    public static void callWebServicePost(String xml) {
  
      ClientConfig config = new DefaultClientConfig();
      Client client = Client.create(config);
      WebResource service = client.resource(getBaseURI());
  
      try {
          MultivaluedMap formData = new MultivaluedMapImpl();
          formData.add("xml", xml);
  
          System.out.println(service.path("rest").path("path1")
                  .path("path2")
                  .accept(MediaType.TEXT_PLAIN)
                  .post(String.class, formData));
      } catch (Exception e) {
          System.out.println(e.getMessage());
      }
  }
  
  private static URI getBaseURI() {
      return UriBuilder.fromUri("http://localhost:8080/store").build();
  }
  </code></pre>
  
  <p>Now when i call the method callWebServicePost and pass a xml string to it i got follow exception</p>
  
  <pre><code>java.net.SocketException: Unexpected end of file from server
  </code></pre>
  
  <p>and the stack tarace is as follow</p>
  
  <pre><code> com.sun.jersey.api.client.ClientHandlerException: java.net.SocketException: Unexpected  end of file from server
       at     com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:151)
  at com.sun.jersey.api.client.Client.handle(Client.java:648)
  at com.sun.jersey.api.client.WebResource.handle(WebResource.java:680)
  at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
  at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:568)
  at    com.tainosystems.main.WebServiceClient.callWebServicePost(WebServiceClient.java:71)
  at com.tainosystems.main.WebServiceClient.main(WebServiceClient.java:99)
      Caused by: java.net.SocketException: Unexpected end of file from server
      at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:769)
  at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
  at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:766)
  at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
  at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1195)
  at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)
  at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:249)
  at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:149)
  ... 6 more
  </code></pre>