Apache Camel 4 Marshalling UnMarshalling Issue for XML POJO

26 views Asked by At

In my code, I have updated Spring Boot to 3.x and correspondingly Apache camel from 2.23.x to 4.x But now in Route where XML POJO was getting used to send to request, there is an issue in marshalling the object.

Error is:

"No body available of type: javax.xml.transform.Source but has type: com.anz.csp.as.qas.search.QASearch on: Message. Caused by: No type converter available to convert from type: com.anz.csp.as.qas.search.QASearch to the required type: javax.xml.transform.Source. Exchange[]. Caused by: [org.apache.camel.NoTypeConversionAvailableException - No type converter available to convert from type: com.anz.csp.as.qas.search.QASearch to the required type: javax.xml.transform.Source]"

RouteBuilder:

from(ADDRESS_SEARCH_RAW_ENDPOINT_URI).bean(addressRequestMapper, "mapSearchRequest(${body})").to(httpRouteConfig.getHttpUri(Constants.SPRING_WS + qasUrl+ "?soapAction=" + SOAP_ACTION_ADDRESS_SEARCH+ "&timeout=" + addressSearchTaskTimeout))

QASearch.java

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
        "country",
        "engine",
        "layout",
        "search",
        "formattedAddressInPicklist"
})
@XmlRootElement(name = "QASearch")
public class QASearch {

    @XmlElement(name = "Country", required = true)
    protected String country;
    @XmlElement(name = "Engine", required = true)
    protected EngineType engine;
    @XmlElement(name = "Layout")
    protected String layout;
    @XmlElement(name = "Search", required = true)
    protected String search;
    @XmlElement(name = "FormattedAddressInPicklist", defaultValue = "false")
    protected Boolean formattedAddressInPicklist;

@XmlElement(name = "Country", required = true)
protected String country;
@XmlElement(name = "Engine", required = true)
protected EngineType engine;
@XmlElement(name = "Layout")
protected String layout;
@XmlElement(name = "Search", required = true)
protected String search;
@XmlElement(name = "FormattedAddressInPicklist", defaultValue = "false")
protected Boolean formattedAddressInPicklist;

What i don't understand is, above code was working with Apache camel 2.23.1 version. But now with Camel 4 version, it is not working.

If anyone can help here, to understand what change is required to make it work.

Thanks, Anu

0

There are 0 answers