title: Cannot unmarshall response body with resttemplate jaxb
body: <p>I want to generate java class from xsd and then with resttemplate unmarshal it. I figure out how to generate it. But after I got a response I resttemplate throw an error. </p>
  
  <p>This is my xsd: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
      &lt;xs:element name="GameIdentifier"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element name="UniqueGameID" type="xs:string" maxOccurs="1" minOccurs="1"/&gt;
              &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>This is how looks my pom.xml</p>
  
  <pre><code>&lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.1.0.RELEASE&lt;/version&gt;
          &lt;relativePath/&gt;
      &lt;/parent&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
              &lt;artifactId&gt;jaxb2-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.2&lt;/version&gt;
              &lt;type&gt;maven-plugin&lt;/type&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;javax.xml.bind&lt;/groupId&gt;
              &lt;artifactId&gt;jaxb-api&lt;/artifactId&gt;
              &lt;version&gt;2.2.12&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.sun.xml.bind&lt;/groupId&gt;
              &lt;artifactId&gt;jaxb-impl&lt;/artifactId&gt;
              &lt;version&gt;2.2.11&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
              &lt;version&gt;5.1.2.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.8&lt;/source&gt;
                      &lt;target&gt;1.8&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
  
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.8&lt;/source&gt;
                      &lt;target&gt;1.8&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                  &lt;artifactId&gt;jaxb2-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;1.5&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;xjc&lt;/id&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;xjc&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
                  &lt;configuration&gt;
  
                      &lt;outputDirectory&gt;src/main/java&lt;/outputDirectory&gt;
                      &lt;clearOutputDir&gt;false&lt;/clearOutputDir&gt;
                      &lt;packageName&gt;swe.game.model&lt;/packageName&gt;
                      &lt;schemaDirectory&gt;src/main/resources/xsd/&lt;/schemaDirectory&gt;
                      &lt;schemaFiles&gt;gameId.xsd&lt;/schemaFiles&gt;
                      &lt;schemaFiles&gt;gameState.xsd&lt;/schemaFiles&gt;
                      &lt;schemaFiles&gt;halfMap.xsd&lt;/schemaFiles&gt;
                      &lt;schemaFiles&gt;playerRegistration.xsd&lt;/schemaFiles&gt;
                      &lt;schemaFiles&gt;responseEnvelope.xsd&lt;/schemaFiles&gt;
                      &lt;schemaFiles&gt;responseEnvelopeUniqueId.xsd&lt;/schemaFiles&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
  
          &lt;/plugins&gt;
      &lt;/build&gt;
  </code></pre>
  
  <p>This is how I looks my generated class: </p>
  
  <pre><code>@XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "", propOrder = {
      "uniqueGameID"
  })
  @XmlRootElement(name = "GameIdentifier")
  public class GameIdentifier {
  
      @XmlElement(name = "UniqueGameID", required = true)
      protected String uniqueGameID;
  
      /**
       * Gets the value of the uniqueGameID property.
       * 
       * @return
       *     possible object is
       *     {@link String }
       *     
       */
      public String getUniqueGameID() {
          return uniqueGameID;
      }
  
      /**
       * Sets the value of the uniqueGameID property.
       * 
       * @param value
       *     allowed object is
       *     {@link String }
       *     
       */
      public void setUniqueGameID(String value) {
          this.uniqueGameID = value;
      }
  }
  </code></pre>
  
  <p>And this is how I call it: </p>
  
  <p>private static final Logger log = LoggerFactory.getLogger(NetworkManager.class);</p>
  
  <p>public void gameId() {
      GameIdentifier gameIdentifierMessage = null;</p>
  
  <pre><code>try {
    URL url = new URL(BASE + PORT + "game/new");
    log.info("" + url.toURI());
    RestTemplate restTemplate = new RestTemplate();
  
    gameIdentifierMessage = restTemplate.getForObject(url.toURI(), GameIdentifier.class);
  
    log.info(gameIdentifierMessage.toString());
  } catch (Exception e) {
    log.error(e.getLocalizedMessage());
  }
  </code></pre>
  
  <p>And this is my logs</p>
  
  <blockquote>
    <p>http://****************/game/new HTTP GET
    <a href="http://swe.wst.univie.ac.at:18235/game/new" rel="nofollow noreferrer">http://swe.wst.univie.ac.at:18235/game/new</a> Accept=[application/xml,
    text/xml, application/*+xml] Response 200 OK Reading to
    [swe.game.model.GameIdentifier] as "application/xml" Error while
    extracting response for type [class swe.game.model.GameIdentifier] and
    content type [application/xml]; nested exception is
    org.springframework.http.converter.HttpMessageNotReadableException:
    Could not unmarshal to [class swe.game.model.GameIdentifier]:
    unexpected element (uri:"", local:"uniqueGameIdentifier"). Expected
    elements are &lt;{}GameIdentifier>; nested exception is
    javax.xml.bind.UnmarshalException: unexpected element (uri:"",
    local:"uniqueGameIdentifier"). Expected elements are
    &lt;{}GameIdentifier></p>
  </blockquote>