Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-4755

WS SOAP Response with WS-A Headers results in ClassCastException

    • Hide

      Build the attached ws-a web application: jaxws-adressing (it has client and service you need to build the 2nd and then deploy it)

      JDV-MultiSource-Project is the JDV project and you can use the WSA-Models VDB

      The request I send is
      SELECT *
      FROM ADDRESSINGSERVICEVIEW_5.SAYHELLO
      WHERE MESSAGEID = 'UUID-100' AND SAYHELLO = 'STELARA SKISTOUS THN KOLARA'
      AND ADDRESSINGSERVICEVIEW_5.SAYHELLO.To = 'http://www.w3.org/2005/08/addressing/anonymous'
      AND ADDRESSINGSERVICEVIEW_5.SAYHELLO.ReplyTo = 'http://www.w3.org/2005/08/addressing/anonymous'
      AND ADDRESSINGSERVICEVIEW_5.SAYHELLO.Action = 'http://www.w3.org/2005/08/addressing/ServiceIface/sayHello'

      from SQL Scratchbook connecting to TEIID via JDBC

      The server adapter has only got

      <resource-adapter id="AddressingService_5">
      <module slot="main" id="org.jboss.teiid.resource-adapter.webservice"/>
      <transaction-support>NoTransaction</transaction-support>
      <connection-definitions>
      <connection-definition class-name="org.teiid.resource.adapter.ws.WSManagedConnectionFactory" jndi-name="java:/AddressingService_5" enabled="true" pool-name="AddressingService_5">
      <config-property name="SecurityType">
      None
      </config-property>
      <config-property name="EndPoint">
      http://localhost:8080/jboss-jaxws-addressing/AddressingService
      </config-property>
      </connection-definition>
      </connection-definitions>
      </resource-adapter>

      Show
      Build the attached ws-a web application: jaxws-adressing (it has client and service you need to build the 2nd and then deploy it) JDV-MultiSource-Project is the JDV project and you can use the WSA-Models VDB The request I send is SELECT * FROM ADDRESSINGSERVICEVIEW_5.SAYHELLO WHERE MESSAGEID = 'UUID-100' AND SAYHELLO = 'STELARA SKISTOUS THN KOLARA' AND ADDRESSINGSERVICEVIEW_5.SAYHELLO.To = 'http://www.w3.org/2005/08/addressing/anonymous' AND ADDRESSINGSERVICEVIEW_5.SAYHELLO.ReplyTo = 'http://www.w3.org/2005/08/addressing/anonymous' AND ADDRESSINGSERVICEVIEW_5.SAYHELLO.Action = 'http://www.w3.org/2005/08/addressing/ServiceIface/sayHello' from SQL Scratchbook connecting to TEIID via JDBC The server adapter has only got <resource-adapter id="AddressingService_5"> <module slot="main" id="org.jboss.teiid.resource-adapter.webservice"/> <transaction-support>NoTransaction</transaction-support> <connection-definitions> <connection-definition class-name="org.teiid.resource.adapter.ws.WSManagedConnectionFactory" jndi-name="java:/AddressingService_5" enabled="true" pool-name="AddressingService_5"> <config-property name="SecurityType"> None </config-property> <config-property name="EndPoint"> http://localhost:8080/jboss-jaxws-addressing/AddressingService </config-property> </connection-definition> </connection-definitions> </resource-adapter>

      When sending a WS-A SOAP request successfully the service responds with WS-A Headers. The result is a ClassCastException as the fornat the XML is parsed in is javax.xml.transform.dom.DOMSource rather than the expected javax.xml.transform.stax.StAXSource

      D: 5
      Address: http://localhost:8080/jboss-jaxws-addressing/AddressingService
      Encoding: UTF-8
      Http-Method: POST
      Content-Type: text/xml; charset=UTF-8
      Headers:

      {Accept=[*/*], cache-control=[no-cache], connection=[keep-alive], Content-Length=[573], content-type=[text/xml; charset=UTF-8], host=[localhost:8080], pragma=[no-cache], SOAPAction=[""], user-agent=[Apache CXF 2.7.14.redhat-1]}

      Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://www.jboss.org/jbossws/ws-extensions/wsaddressing" xmlns:wsa="http://www.w3.org/2005/08/addressing">
      <soap:Header>
      <wsa:MessageID>UUID-100</wsa:MessageID>
      <wsa:To>http://www.w3.org/2005/08/addressing/anonymous</wsa:To>
      <wsa:ReplyTo>http://www.w3.org/2005/08/addressing/anonymous</wsa:ReplyTo>
      <wsa:Action>http://www.w3.org/2005/08/addressing/ServiceIface/sayHelloToName</wsa:Action>
      </soap:Header>
      <soap:Body>
      <tns:sayHello>Stelios</tns:sayHello>
      </soap:Body>
      </soap:Envelope>

      --------------------------------------
      19:04:45,385 INFO [org.apache.cxf.services.AddressingService.AddressingServicePort.ServiceIface] (http-localhost/127.0.0.1:8080-1) Outbound Message
      ---------------------------
      ID: 5
      Response-Code: 200
      Encoding: UTF-8
      Content-Type: text/xml
      Headers: {}
      Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Header>
      <Action xmlns="http://www.w3.org/2005/08/addressing">http://www.jboss.org/jbossws/ws-extensions/wsaddressing/ServiceIface/sayHelloResponse</Action>
      <MessageID xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:747217df-668e-4152-acb4-360d2b40a967</MessageID>
      <RelatesTo xmlns="http://www.w3.org/2005/08/addressing">UUID-100</RelatesTo>
      </soap:Header>
      <soap:Body>
      <ns2:sayHelloResponse xmlns:ns2="http://www.jboss.org/jbossws/ws-extensions/wsaddressing">
      <return>Hello World!</return>
      </ns2:sayHelloResponse>
      </soap:Body>
      </soap:Envelope>

      --------------------------------------
      19:04:45,390 ERROR [org.teiid.CONNECTOR] (Worker11_QueryProcessorQueue20) Connector worker process failed for atomic-request=KoRkVR60P+Nr.0.9.4: java.lang.ClassCastException: javax.xml.transform.dom.DOMSource cannot be cast to javax.xml.transform.stax.StAXSource
      at org.teiid.translator.ws.WSProcedureExecution.execute(WSProcedureExecution.java:136) [translator-ws-8.12.5.redhat-8.jar:8.12.5.redhat-8]
      at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWorkItem.java:364) [teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_65]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_65]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_65]
      at java.lang.reflect.Method.invoke(Method.java:497) [rt.jar:1.8.0_65]
      at org.teiid.dqp.internal.datamgr.ConnectorManager$1.invoke(ConnectorManager.java:211) [teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
      at com.sun.proxy.$Proxy159.execute(Unknown Source)
      at org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTierTupleSource.java:306) [teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
      at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:112) [teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
      at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:108) [teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
      at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0_65]
      at org.teiid.dqp.internal.process.FutureWork.run(FutureWork.java:65) [teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
      at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:276) [teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
      at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119) [teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
      at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:210) [teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_65]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_65]
      at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_65]

      19:04:45,394 ERROR [org.teiid.PROCESSOR] (Worker10_QueryProcessorQueue21) TEIID30019 Unexpected exception for request KoRkVR60P+Nr.0: java.lang.ClassCastException: javax.xml.transform.dom.DOMSource cannot be cast to javax.xml.transform.stax.StAXSource
      at org.teiid.translator.ws.WSProcedureExecution.execute(WSProcedureExecution.java:136)
      at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWorkItem.java:364) [teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_65]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_65]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_65]
      at java.lang.reflect.Method.invoke(Method.java:497) [rt.jar:1.8.0_65]
      at org.teiid.dqp.internal.datamgr.ConnectorManager$1.invoke(ConnectorManager.java:211) [teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
      at com.sun.proxy.$Proxy159.execute(Unknown Source)
      at org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTierTupleSource.java:306) [teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
      at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:112) [teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
      at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:108) [teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
      at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0_65]
      at org.teiid.dqp.internal.process.FutureWork.run(FutureWork.java:65) [teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
      at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:276) [teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
      at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119) [teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
      at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:210) [teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_65]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_65]
      at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_65]

            [TEIID-4755] WS SOAP Response with WS-A Headers results in ClassCastException

            It is not ideal to use the DOMSource considering the memory issues with large documents, however CXF does not give good choices here. They supported SAXSource but even that did not work well in my testing.

            Converted Teiid invocation in the case of MESSAGE mode to use DOMSource based return.

            Ramesh Reddy added a comment - It is not ideal to use the DOMSource considering the memory issues with large documents, however CXF does not give good choices here. They supported SAXSource but even that did not work well in my testing. Converted Teiid invocation in the case of MESSAGE mode to use DOMSource based return.

            When Mode is set to MESSAGE, CXF does not recognize or adhere to Dispatch interface is set to StAXSource, and returns DomSource. Looking deep into the code of CXF, it seems like in the case of MESSAGE mode, it allows SAXSource and DOMSource. So, there is no possible way without CXF code change to convert to StAXSource. Reading as DOMSource is quickest ways to fix it.

            Ramesh Reddy added a comment - When Mode is set to MESSAGE, CXF does not recognize or adhere to Dispatch interface is set to StAXSource, and returns DomSource. Looking deep into the code of CXF, it seems like in the case of MESSAGE mode, it allows SAXSource and DOMSource. So, there is no possible way without CXF code change to convert to StAXSource. Reading as DOMSource is quickest ways to fix it.

              rhn-engineering-rareddy Ramesh Reddy
              rhn-gps-stkousso STYLIANOS Kousouris
              rhn-engineering-rareddy#1
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: