This is the printed SOAP Response:
<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns0:Get_People_Operation xmlns:ns0="urn:PeopleInterface" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns0:Full_Name>asdf - Full Name</ns0:Full_Name>
</ns0:Get_People_Operation>
</soapenv:Body>
</soapenv:Envelope>
Method to extract node value:
String assigneeInput = getNode(responseElementAssignee, "Full_Name");
private static String getNode(Element responseElement, String nodeValue) {
Node x = (Node) responseElement.getElementsByTagName(nodeValue);
x.getTextContent();
// Test list output
System.out.println("");
System.out.println(nodeValue + " Value: " + x.toString());
System.out.println("");
return x.getTextContent();
}
All I want is to return the text content of this node <ns0:Full_Name>asdf - Full Name</ns0:Request_ID>
.
I'm testing in SoapUI and I'm also printing the response successfully so it doesn't make sense that the value is null, unless of course I'm processing the response improperly. What should I do?
ClassCastException:
java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.DeepNodeListImpl cannot be cast to org.w3c.dom.Node
at app.controller.TableViewController.printSOAPResponse(TableViewController.java:225)
at app.controller.TableViewController.initialize(TableViewController.java:67)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
at app.Main.start(Main.java:14)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)