title: Couldn't create SOAP message due to exception: XML reader error: com.ctc.wstx.exc.WstxParsingException: Undeclared namespace prefix "ws"&#xD;
body: <p>I have created the web service using JAX-WS. When I access the web service am getting following response:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8'?&gt;&lt;S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;S:Body&gt;&lt;S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope"&gt;&lt;faultcode&gt;S:Client&lt;/faultcode&gt;&lt;faultstring&gt;Couldn't create SOAP message due to exception: XML reader error: com.ctc.wstx.exc.WstxParsingException: Undeclared namespace prefix "ws"&amp;#xD;
   at [row,col {unknown-source}]: [1,169]&lt;/faultstring&gt;&lt;/S:Fault&gt;&lt;/S:Body&gt;&lt;/S:Envelope&gt;
  </code></pre>
  
  <p>My web service is:</p>
  
  <pre><code>@WebService
  public interface HelloService {
      @WebMethod
      String Hello(@WebParam(name = "name")String msg);   
  } 
  
  public class HelloServiceIml implements HelloService {
  @Override
  String Hello(String msg){
  return "Hello" + msg;
  }
  }
  
  public class Mainws {
  
      /**
       * @param args
       */
      public static void main(String[] args) {
          Endpoint.publish("http://localhost:8085/hello", new HelloServiceIml());
      }
  
  }
  </code></pre>
  
  <p>Client Program:</p>
  
  <pre><code>public class PostSoap {
      public static void main(String[] args) throws Exception {
          // Get target URL
          String strURL = "http://localhost:8085/HelloService";
          // Get SOAP action
          String strSoapAction = "SOAPAction";
          // Get file to be posted
          String strXML = "&lt;?xml version=\"1.0\" encoding=\"windows-1251\"?&gt; " +
                  "&lt;soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"&gt; " +
                  "&lt;soapenv:Header/&gt; " +              
                  "&lt;soapenv:Body&gt; &lt;ws:Hello&gt; " +
                  " &lt;name&gt;John&lt;/name&gt; " +     
                  " &lt;/ws:Hello&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; ";
  
          // Prepare HTTP post
          PostMethod post = new PostMethod(strURL);
          post.setRequestBody(strXML);
          post.setRequestHeader("Content-Type", "text/xml");
  
          // consult documentation for your web service
          post.setRequestHeader("SOAPAction", strSoapAction);
          // Get HTTP client
          HttpClient httpclient = new HttpClient();
          httpclient.getParams().setAuthenticationPreemptive(true);
          httpclient.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("user", "pwd"));
  
          // Execute request
          try {
              int result = httpclient.executeMethod(post);
              // Display status code
              System.out.println("Response status code: " + result);
              // Display response
              System.out.println("Response body: ");
              System.out.println(post.getResponseBodyAsString());
          } finally {
              // Release current connection to the connection pool once you are done
              post.releaseConnection();
          }
      }
  
  
  }
  </code></pre>
  
  <p>Please help me to solve the problem.</p>