Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-437

Kie :: Camel - ClassCast exception in PreCxfTransportSoapProcessor class

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 6.1.0.Beta4
    • 6.0.1.Final
    • None
    • Hide

      Compile WAR from "droolsjbpm-integration-master/drools-camel-server-example" and send a test SOAP request (test REST service is unaffected).

      Show
      Compile WAR from "droolsjbpm-integration-master/drools-camel-server-example" and send a test SOAP request (test REST service is unaffected).

      After sending a test SOAP request to (compiled) "Drools Camel server example" from "droolsjbpm-integration-master/drools-camel-server-example", running on JBoss7 application server, the following exception occurs:
      ...
      java.lang.ClassCastException: org.apache.cxf.binding.soap.SoapMessage cannot be cast to java.lang.String
      at org.kie.jax.soap.PreCxfTransportSoapProcessor.process(PreCxfTransportSoapProcessor.java:36) [kie-camel-6.0.1.Final.jar:6.0.1.Final]
      ...

      I used the following patch (hack), to make the example work:

      diff --git a/kie-camel/src/main/java/org/kie/jax/soap/PreCxfTransportSoapProcessor.java b/kie-camel/src/main/java/or
      index c646f97..39e2afc 100644
      — a/kie-camel/src/main/java/org/kie/jax/soap/PreCxfTransportSoapProcessor.java
      +++ b/kie-camel/src/main/java/org/kie/jax/soap/PreCxfTransportSoapProcessor.java
      @@ -33,8 +33,10 @@ public class PreCxfTransportSoapProcessor
      Map<String, Object> headers = exchange.getIn().getHeaders();
      MimeHeaders mimeHeaders = new MimeHeaders();
      for ( String header : headers.keySet() ) {

      • mimeHeaders.addHeader( header,
      • (String) headers.get( header ) );
        + // hack for avoiding uncaught exceptions when SOAP message is typecast to string
        + try { mimeHeaders.addHeader( header, (String) headers.get( header ) );}


        + catch(ClassCastException e){}
        +
        }
        SOAPMessage soapMessage = MessageFactory.newInstance().createMessage( mimeHeaders,
        is );

      It seems to me that the call to:
      ...
      exchange.getIn().getHeaders()
      ...

      apart from valid MIME headers, such as host, content-type etc also (wrongly?) returns the entire SOAP request object, which then cannot be typecast to string.

              etirelli@redhat.com Edson Tirelli
              jurijk_jira Jurij Kovacic (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: