0

AXL 12.5, Apache CXF 3.3.6, OpenJDK 14, Spring Boot 2.3.0, executing a SQL query

String sqlStmt = "SELECT name FROM typeuserlocale";

ExecuteSQLQueryReq executeSQLQueryReq = new ExecuteSQLQueryReq();
executeSQLQueryReq.setSql(sqlStmt);

ExecuteSQLQueryRes executeSQLQueryRes = axlPort.executeSQLQuery(executeSQLQueryReq);

List<Object> rows = executeSQLQueryRes.getReturn().getRow();

gives a response of List<Object>, how to parse the result? To what to cast the Object?

Debugging shows that it is a ElementNSImpl. Trying to cast it to ElementNSImpl led to the IDE adding the dependency:

<dependency>
    <groupId>xerces</groupId>
    <artifactId>xercesImpl</artifactId>
    <version>2.9.1</version>
</dependency>

But casting it led to an exception:

java.lang.ClassCastException: 
class com.sun.org.apache.xerces.internal.dom.ElementNSImpl cannot be cast to class org.apache.xerces.dom.ElementNSImpl (com.sun.org.apache.xerces.internal.dom.ElementNSImpl is in module java.xml of loader 'bootstrap'; 
org.apache.xerces.dom.ElementNSImpl is in unnamed module of loader 'app')
neblaz
  • 683
  • 10
  • 32

2 Answers2

0

Is it possible that the AXL service stubs were generated using the Oracle JDK version of wsimport, while your app is running with OpenJDK? In which case, you can try regenerating using OpenJDK wsdl2java (not sure if there would be any resulting changes in the client code.)

There is a working Cisco DevNet sample here which demonstrates parsing: https://github.com/CiscoDevNet/axl-java-samples , however it is based on Oracle JDK 1.8

David Staudt
  • 361
  • 2
  • 2
0

Cast has to be done to org.w3c.dom.Element, and it works fine.

neblaz
  • 683
  • 10
  • 32