I have an activemq queue generating messages with this structure:
<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<places>
   <parking>
      <idParking>AAA</idParking>
      <type>TEST</type>
    </parking>
    <parking>
       <idParking>BBB</idParking>
      <type>TEST</type>
    </parking>
</places>

and i have this code to transform the structure into java objects:

JaxbDataFormat searchXmlRequestJaxb= new JaxbDataFormat(); 
       
searchXmlRequestJaxb.setContext(JAXBContext.newInstance(xxx.yyy.PlacesResponse.class));
        
                
from("activemq:topic:"+topic).autoStartup(true).autoStartup(startup)
                        .split(xpath("//places"))
                        .marshal(searchXmlRequestJaxb);

Having structures defined this way:

public class PlacesResponse {

@SerializedName("places")
private String places;

@SerializedName("parking")
private ArrayList<ParkingResponse> parkingResponse;

public String getPlaces() {
return places;
}

public void setPlaces(String places) {
this.places = places;
}

public ArrayList<ParkingResponse> getParkingResponse() {
return parkingResponse;
}

public void setParkingResponse(ArrayList<ParkingResponse> parkingResponse) {
this.parkingResponse = parkingResponse;
}
}

and 
public class ParkingResponse {

@SerializedName("idParking")
private String idParking;

@SerializedName("type")
private String type;

public String getIdParking() {
return idParking;
}

public void setIdParking(String idParking) {
this.idParking = idParking;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}


}


but returns me the error:

java.io.IOException: org.apache.camel.InvalidPayloadException: No body
available of type: javax.xml.bind.JAXBElement but has value: [places: null]
of type: com.sun.org.apache.xerces.internal.dom.DeferredElementNSImpl on:
Message: <places>


What i'm doing wrong?
                        



--
View this message in context: 
http://camel.465427.n5.nabble.com/Insert-activemq-data-into-complex-java-object-tp5803464.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to