title: Why is this simple SOAP client not working (org.apache.http)?
body: <p>I want to send an XML file as a request to a SOAP server.
  Here is the code I have: (modified from <a href="https://stackoverflow.com/questions/10671494/sending-http-post-request-with-soap-action-using-org-apache-http">Sending HTTP Post request with SOAP action using org.apache.http</a> )</p>
  
  <pre><code>import org.apache.http.client.*;
  import org.apache.http.client.methods.*;
  import org.apache.http.impl.client.*;
  import org.apache.http.entity.StringEntity;
  import org.apache.http.protocol.HTTP;
  import org.apache.http.HttpResponse;
  import java.net.URI;
  
  public static void req()   {
          try {
              HttpClient httpclient = new DefaultHttpClient();
              String body="xml here";
              String bodyLength=new Integer(body.length()).toString();
  
              URI uri=new URI("http://1.1.1.1:100/Service");
              HttpPost httpPost = new HttpPost(uri);
              httpPost.setHeader( "SOAPAction", "MonitoringService" );
              httpPost.setHeader("Content-Type", "text/xml;charset=UTF-8");
  
  
              StringEntity entity = new StringEntity(body, "text/xml",HTTP.DEFAULT_CONTENT_CHARSET);
              httpPost.setEntity(entity);
  
              RequestWrapper requestWrapper=new RequestWrapper(httpPost);
              requestWrapper.setMethod("POST");
  
  
              requestWrapper.setHeader("Content-Length",bodyLength);
              HttpResponse response = httpclient.execute(requestWrapper);
              System.out.println(response);
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
  </code></pre>
  
  <p>Before this I was getting error 'http 500' (internal server error) from the server , but now Im not getting any reply at all. I know that the server works right because with other clients there is no problem. </p>
  
  <p>Thanks.</p>