I’m getting >Unmarshalling Error: unexpected element (uri:”http://someurl”, local:”someNewElementsFromResponse”). Expected elements are <{}> while consuming SOAP based webservice using Spring boot camel integration.
below is the sample
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.3.7</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<wsdlOptions>
<wsdlOption>
<wsdl>src/main/resources/accounts.wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
and we are using below Spring boot config for routing.
@Component
public class CamelRoute extends SpringRouteBuilder {
@Override
public void configure() throws Exception {
from("direct:fetchAccountsDetails")
.bean(AccountsRequestBuilder.class)
.setHeader(CxfConstants.OPERATION_NAME,
constant("fetchAccountDetails"))
.setHeader(CxfConstants.OPERATION_NAMESPACE,
constant("http://demo.namespace.com"))
.to("cxf://http://localhost:808/dummyUrl?serviceClass=com.demo.service.wsdl.AccountPortType&wsdlURL=accounts.wsdl")
.end()
.process("accountDetailsProcessor"); // Spring component
//..... some other routers
}
template code
public class Request {
@Autowired
private org.apache.camel.ProducerTemplate producerTemplate;
public <T> T makeCameRequest(String route, Object userDetails, Class<T> responseType) throws
Throwable {
try {
return producerTemplate.requestBody(route, userDetails, responseType);
} catch (CamelExecutionException e) {
log.error("error : {}", e);
}
}
}
// processor class
@Component(“accountDetailsProcessor”)
public class AccountDetailsProcessor implements Processor {
@Override
public void process(Exchange exchange) throws Exception {
Accounts accounts = exchange.getIn().getBody
(Accounts.class);
// .... some other codes
}
}
is there any way to ignore any unknown element in Apache Camel Spring boot.
Camel version: 3.6.0
Spring: 2.7.5
JDK11