title: Issue on calling soap webservice using apache http client
body: <p>I'm using maven as my build tool.trying to call soap based webservice from my java code.But something went wrong with my query.This query string i taken from soapUI.I tested my webservice with soapUI.it was working.But now its not working while working with apache http client.someone plz help me!!</p>
  
  <pre><code>public class TestMainClient {
  
      public static void main(String[] args) {
  
          HttpClient httpObj = new HttpClient();
          httpObj.getParams().setParameter("http.useragent", "Web   Service    Test Client");
          BufferedReader br = null;
  
          String data = "&lt;soap:Envelopexmlns:soap=\"http://www.w3.org/2003/05/soap-envelope/\" xmlns:web=\"http://webservice.OrderProcessor/\""
                  + " xmlns:xsd=\"http://dto.order.cloudbill.com/xsd/\"&gt;"
  
  
                  + "&lt;soap:Header/&gt;"
                  + "&lt;soap:Body&gt;"
                  + "&lt;web:placeOrder&gt;"
                  + "&lt;web:placeOrderRequest&gt;"
                  + "&lt;xsd:orderDate&gt;2015-01-16T09:00:00&lt;/xsd:orderDate&gt;"
                  + "&lt;xsd:orderDescription&gt;order has two elements&lt;/xsd:orderDescription&gt;"
                  + "&lt;xsd:orderElementRequests&gt;"
                  + "&lt;xsd:orderElementRequest&gt;"
                  + "&lt;xsd:createdDate&gt;2015-01-16T09:00:00&lt;/xsd:createdDate&gt;"
                  + " &lt;xsd:orderElementAttributeRequests&gt;"
                  + "&lt;xsd:arrayOrderElementAttribute&gt;"
                  + "&lt;xsd:attributeName&gt;Hard disk&lt;/xsd:attributeName&gt;"
                  + "&lt;xsd:attributeValue&gt;1gb&lt;/xsd:attributeValue&gt;"
  
                  + "&lt;xsd:createdDate&gt;2015-01-16T09:00:00&lt;/xsd:createdDate&gt;"
                  + "&lt;/xsd:arrayOrderElementAttribute&gt;"
                  + "&lt;/xsd:orderElementAttributeRequests&gt;"
                  + "&lt;xsd:order_item_name&gt;Laptop&lt;/xsd:order_item_name&gt;"
                  + " &lt;xsd:order_item_price&gt;20000&lt;/xsd:order_item_price&gt;"
                  + " &lt;/xsd:orderElementRequest&gt;"
                  + "&lt;/xsd:orderElementRequests&gt;"
                  + "&lt;/web:placeOrderRequest&gt;"
                  + "&lt;/web:placeOrder&gt;"
                  + "&lt;/soap:Body&gt;"
                  + "&lt;/soap:Envelope&gt;";
  
          PostMethod methodPost = new PostMethod("http://localhost:8081/OrderManagementService/services/OrderManagementService?wsdl");
  
          methodPost.setQueryString(data);
          methodPost.setRequestHeader("Content-Type", "text/xml");
  
          try {
              int returnCode = httpObj.executeMethod(methodPost);**Line 51 **
  
              if (returnCode == HttpStatus.SC_NOT_IMPLEMENTED) {
                  System.out.println("The Post method is not implemented by this URI");
                  /*methodPost.getResponseBodyAsString();*/
  
              } else {
                  br = new BufferedReader(new InputStreamReader(methodPost.getResponseBodyAsStream()));
                  String readLine;
                  while (((readLine = br.readLine()) != null)) {
  
                      System.out.println(readLine);
                  }
              }
          } catch (Exception e) {
              e.printStackTrace();
          } finally {
              methodPost.releaseConnection();
              if (br != null)
                  try {
                      br.close();
                  } catch (Exception fe) {
                      fe.printStackTrace();
                  }
          }
      }
  }
  </code></pre>
  
  <p>=======compiler out========</p>
  
  <pre><code>org.apache.commons.httpclient.URIException: Invalid query
      at org.apache.commons.httpclient.URI.parseUriReference(URI.java:2049)
      at org.apache.commons.httpclient.URI.&lt;init&gt;(URI.java:147)
      at org.apache.commons.httpclient.HttpMethodBase.getURI(HttpMethodBase.java:265)
      at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:383)
      at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
      at com.module.model.TestMainClient.main(TestMainClient.java:51)
  </code></pre>