title: Cannot parse XML message with JAXB org.springframework.oxm.UnmarshallingFailureException
body: <p>I am using following code to parse soap response but I am receiving UnmarshallingFailureException, I changed @XmlSeeAlso to @XMLRootElement but the problem still persists. WSDL is <a href="http://www5v80.elsyarres.net/service.asmx?wsdl" rel="nofollow noreferrer">here</a>.</p>
  
  <pre><code>  Caused by: javax.xml.bind.UnmarshalException: unexpected element 
         (uri:"ElsyArres.API", local:"SearchFlightsResponse"). Expected elements are 
         &lt;{ElsyArres.API}Inbound&gt;,&lt;{ElsyArres.API}Leg&gt;,&lt;{ElsyArres.API}Legs&gt;,
         &lt;{ElsyArres.API}Outbound&gt;,&lt;{ElsyArres.API}Request&gt;,&lt;{ElsyArres.API}Response&gt;,
         &lt;{ElsyArres.API}SearchFlights&gt;,&lt;{ElsyArres.API}SoapMessage&gt;
  </code></pre>
  
  <p><strong>Code</strong></p>
  
  <pre><code>   @XmlRootElement(name = "SoapMessage")
     @XmlAccessorType(XmlAccessType.FIELD)
     public class WegoloSoapMessageResponse {
         @XmlElement(name = "Username")
         private String username;
         @XmlElement(name = "Password")
         private String password;
         @XmlElement(name = "LanguageCode")
         private String languageCode;
         @XmlElement(name = "ErrorMessage")
         private String errorMessage;
         @XmlElement(name = "ErrorCode")
         private int errorCode;
         @XmlElement(name = "AppVersion")
         private String appVersion;
         @XmlElement(name = "Request")
         private Request request;
         @XmlElement(name = "Response")
         private Response response;
  
         getters and setters
  
  
     @XmlRootElement(name = "Request")
     @XmlAccessorType(XmlAccessType.FIELD)
     public class Request {
         @XmlElement(name = "Departure")
         private String departure;
         @XmlElement(name = "Destination")
         private String destination;
         @XmlElement(name = "DepartureDate")
         private String departureDate;
         @XmlElement(name = "ReturnDate")
         private String returnDate;
         @XmlElement(name = "NumADT")
         private int numADT;
         @XmlElement(name = "NumINF")
         private int numInf;
         @XmlElement(name = "NumCHD")
         private int numCHD;
         @XmlElement(name = "CurrencyCode")
         private String currencyCode;
         @XmlElement(name = "WaitForResult")
         private boolean waitForResult;
         @XmlElement(name = "NearByDepartures")
         private boolean nearByDepartures;
         @XmlElement(name = "NearByDestinations")
         private boolean nearByDestinations;
         @XmlElement(name = "RROnly")
         private boolean rronly;
         @XmlElement(name = "MetaSearch")
         private boolean metaSearch;
  
         getters and setters
  
  
     @XmlRootElement(name="Response")
     @XmlAccessorType(XmlAccessType.FIELD)
     public class Response {
         @XmlElement(name="SearchFlightId")
         private String searchFlightId;
         @XmlElement(name="Roundtrip")
         private boolean roundTrip;
         @XmlElement(name="CurrencyCode")
         private String currencyCode;
         @XmlElement(name="Flights")
         private Flights flights;
  
         getters and setters
  
  
  
      @XmlSeeAlso(Flight.class)
      @XmlAccessorType(XmlAccessType.FIELD)
      public class Flights {
         @XmlElement(name="Flight")
         private List&lt;Flight&gt; flight;
  
         getter and setter
  
  
  
     @XmlSeeAlso(Outbound.class)
     @XmlAccessorType(XmlAccessType.FIELD)
     public class Flight {
  
         @XmlElement(name = "Outbound")
         private Outbound outbound;
         @XmlElement(name="Inbound")
         private Inbound inbound;
         @XmlElement(name = "BagFee")
         private int bagFee;
         @XmlElement(name = "CcFee")
         private int ccFee;
         @XmlElement(name = "HandlingFee")
         private int handlingFee;
         @XmlElement(name = "TotalFare")
         private int totalFare;
         @XmlElement(name = "FlightId")
         private String flightId;
         @XmlElement(name = "Link2Book")
         private String link2Book;
         @XmlElement(name = "Provider")
         private String provider;
  
         getters and setters
  
  
  
  
     @XmlRootElement(name = "Outbound")
     @XmlAccessorType(XmlAccessType.FIELD)
     public class Outbound {
  
         @XmlElement(name="CarName")
         private String carName;
         @XmlElement(name="CarCode")
         private String carCode;
         @XmlElement(name="DepName")
         private String depName;
         @XmlElement(name="DepCode")
         private String depCode;
         @XmlElement(name="DestName")
         private String destName;
         @XmlElement(name="DestCode")
         private String destCode;
         @XmlElement(name="Duration")
         private String duration;
         @XmlElement(name="FlightNo")
         private String flightNo;
         @XmlElement(name="DepDateTime")
         private Date dapDateTime;
         @XmlElement(name="ArrDateTime")
         private Date arrDateTime;
         @XmlElement(name="Legs")
         private Legs legs;
         @XmlElement(name="Taxes")
         private int taxes;
         @XmlElement(name="FareADT")
         private int fareADT;
         @XmlElement(name="FareCHD")
         private int fareCHD;
         @XmlElement(name="FareINF")
         private int fareInf;
         @XmlElement(name="MiscFees")
         private int miscFees;
         @XmlElement(name="Idx")
         private int idx;
         @XmlElement(name="FareClass")
         private String fareClass;
         @XmlElement(name="FareType")
         private String fareType;
         @XmlElement(name="FareId")
         private String fareId;
  
         getters and setters
  
  
  
     @XmlRootElement(name="Legs")
     @XmlAccessorType(XmlAccessType.FIELD)
     public class Legs {
         @XmlElement(name="Leg")
         private Leg leg;
  
         getter and setter
  
  
  
     @XmlRootElement(name="Leg")
     @XmlAccessorType(XmlAccessType.FIELD)
     public class Leg {
         @XmlElement(name="Sequence")
         private int sequence;
         @XmlElement(name="FlightNo")
         private String flightNo;
         @XmlElement(name="DepCode")
         private String depCode;
         @XmlElement(name="DepName")
         private String depName;
         @XmlElement(name="DestCode")
         private String destCode;
         @XmlElement(name="DestName")
         private String destName;
         @XmlElement(name="DepTime")
         private String depTime;
         @XmlElement(name="ArrTime")
         private String arrTime;
         @XmlElement(name="CarCode")
         private String carCode;
         @XmlElement(name="CarName")
         private String carName;
         @XmlElement(name="FareClass")
         private String fareClass;
         @XmlElement(name="ArrDateTime")
         private Date arrDateTime;
         @XmlElement(name="DepDateTime")
         private Date depDateTime;
  
         getters and setters
  
  
  
      @XmlRootElement(name = "Inbound")
      @XmlAccessorType(XmlAccessType.FIELD)
      public class Inbound {
          @XmlElement(name="CarName")
          private String carName;
          @XmlElement(name="CarCode")
          private String carCode;
          @XmlElement(name="DepName")
          private String depName;
          @XmlElement(name="DepCode")
          private String depCode;
          @XmlElement(name="DestName")
          private String destName;
          @XmlElement(name="DestCode")
          private String destCode;
          @XmlElement(name="Duration")
          private String duration;
          @XmlElement(name="FlightNo")
          private String flightNo;
          @XmlElement(name="DepDateTime")
          private Date dapDateTime;
          @XmlElement(name="ArrDateTime")
          private Date arrDateTime;
          @XmlElement(name="Legs")
          private Legs legs;
          @XmlElement(name="Taxes")
          private int taxes;
          @XmlElement(name="FareADT")
          private int fareADT;
          @XmlElement(name="FareCHD")
          private int fareCHD;
          @XmlElement(name="FareINF")
          private int fareInf;
          @XmlElement(name="MiscFees")
          private int miscFees;
          @XmlElement(name="Idx")
          private int idx;
          @XmlElement(name="FareClass")
          private String fareClass;
          @XmlElement(name="FareType")
          private String fareType;
          @XmlElement(name="FareId")
          private String fareId;
  
          gettes and setters
  </code></pre>
  
  <p><strong>jaxb.index</strong></p>
  
  <pre><code>SearchFlights
  Flight
  Flights
  Leg
  Legs
  Outbound
  Request
  Response
  WegoloSoapMessage
  </code></pre>
  
  <p><strong>package-info.java</strong></p>
  
  <pre><code>@XmlSchema( 
      namespace = "ElsyArres.API",
      elementFormDefault = XmlNsForm.QUALIFIED) 
  package com.myproject.flights.wegolo;
  
  import javax.xml.bind.annotation.XmlNsForm;
  import javax.xml.bind.annotation.XmlSchema;
  </code></pre>
  
  <p><strong>Response</strong></p>
  
  <p>1</p>
  
  <p><a href="https://i.stack.imgur.com/Rnt6F.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rnt6F.png" alt="enter image description here"></a></p>
  
  <p>2</p>
  
  <p><a href="https://i.stack.imgur.com/tqpQ7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tqpQ7.png" alt="enter image description here"></a></p>
  
  <p>3</p>
  
  <p><a href="https://i.stack.imgur.com/p9dl0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p9dl0.png" alt="enter image description here"></a></p>
  
  <p>4</p>
  
  <p><a href="https://i.stack.imgur.com/CZXrJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CZXrJ.png" alt="enter image description here"></a></p>
  
  <p>5</p>
  
  <p><a href="https://i.stack.imgur.com/28Lxx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/28Lxx.png" alt="enter image description here"></a></p>
  
  <p>6</p>
  
  <p><a href="https://i.stack.imgur.com/tSJ7k.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tSJ7k.png" alt="enter image description here"></a></p>