title: JAXB :Need Namespace Prefix to all the elements
body: <p>I am Using Spring WebServiceTemplate to make webservice call which uses JAXB to generate request XML. My requirement needs all the elements (including root) to have a namespace prefix (there is only a single namespace) in the SOAP request.</p>
  
  <p>Ex :</p>
  
  <pre><code>&lt;ns1:Login xmlns:ns1="www.example.com/a"&gt;
      &lt;ns1:username&gt;abc&lt;/ns1:username&gt;
      &lt;ns1:password&gt;abc&lt;/ns1:password&gt;
  &lt;/ns1:Login&gt;
  </code></pre>
  
  <p>But i am getting</p>
  
  <pre><code>&lt;Login xmlns="www.example.com/a"&gt;
      &lt;username&gt;abc&lt;username&gt;
      &lt;password&gt;abc&lt;password&gt;
  &lt;/Login&gt;
  </code></pre>
  
  <p>xsd :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xs:schema targetNamespace="www.example.com/a"   xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ilreq="www.example.com/a" elementFormDefault="qualified" attributeFormDefault="unqualified"&gt;
  
  &lt;xs:complexType name="Login"&gt;
      &lt;xs:sequence&gt;
          &lt;xs:element name="username" type="xs:string"/&gt;
          &lt;xs:element name="password" type="xs:string"/&gt;
      &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  </code></pre>
  
  <p></p>
  
  <p>Generated Java Class from XSD </p>
  
  <pre><code>@XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "Login", propOrder = {
      "username",
      "password"
  })
  
  @XmlRootElement
  public class Login {
  
  @XmlElement(required = true)
  protected String username;
  @XmlElement(required = true)
  protected String password;
  ......
  }
  </code></pre>
  
  <p>package-info.java</p>
  
  <pre><code>@javax.xml.bind.annotation.XmlSchema(
      namespace = "www.example.com/a",
      elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
  package authenticator.beans.login;
  </code></pre>
  
  <p>Want to know how to generate the request XML with Namespace prefix to all elements including root.</p>