java - Cannot parse XML message with JAXB org.springframework.oxm.UnmarshallingFailureException -


i using following code parse soap response receiving unmarshallingfailureexception, changed @xmlseealso @xmlrootelement problem still persists. wsdl here.

  caused by: javax.xml.bind.unmarshalexception: unexpected element         (uri:"elsyarres.api", local:"searchflightsresponse"). expected elements         <{elsyarres.api}inbound>,<{elsyarres.api}leg>,<{elsyarres.api}legs>,        <{elsyarres.api}outbound>,<{elsyarres.api}request>,<{elsyarres.api}response>,        <{elsyarres.api}searchflights>,<{elsyarres.api}soapmessage> 

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 , 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 , 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 , setters        @xmlseealso(flight.class)     @xmlaccessortype(xmlaccesstype.field)     public class flights {        @xmlelement(name="flight")        private list<flight> flight;         getter , 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 , 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 , setters       @xmlrootelement(name="legs")    @xmlaccessortype(xmlaccesstype.field)    public class legs {        @xmlelement(name="leg")        private leg leg;         getter , 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 , 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 , setters 

jaxb.index

searchflights flight flights leg legs outbound request response wegolosoapmessage 

package-info.java

@xmlschema(      namespace = "elsyarres.api",     elementformdefault = xmlnsform.qualified)  package com.myproject.flights.wegolo;  import javax.xml.bind.annotation.xmlnsform; import javax.xml.bind.annotation.xmlschema; 

response

1

enter image description here

2

enter image description here

3

enter image description here

4

enter image description here

5

enter image description here

6

enter image description here

it seems creating beans manually or @ least editing them. both cases should avoided. instead should try use available tools generate jaxb classes , soap clients you. 2 common options spring webservices or known apache cxf framework.


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -