Hi Willem,

Thank you for your reply!

I changed my code in order to use a SEI to describe the Web Service. Now it
is working fine but I am having problems when I add an endpoint between the
cxf endpoints.

The (working) code looks like this:

--------------------------------------------------------
package com.tc.eai;

import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.spring.Main;
import org.apache.commons.lang.StringUtils;

public class MyRouteBuilder extends RouteBuilder {

        private static String ROUTER_ADDRESS =
"http://localhost:9003/pedidoService";;
        private static String DATA_FORMAT = "dataFormat=MESSAGE";
        private static String SERVICE_NAME =
"serviceName=%7bhttp://www.tc.com/pedido%7dpedido";;
        private static String SERVICE_CLASS =
"serviceClass=com.tc.eai.PedidoService";
        private static String PORT_NAME =
"portName=%7bhttp://www.tc.com/pedido%7dpedidoSOAP";;
        private static String SERVICE_ADDRESS =
"http://localhost:9000/pedidoService";;
        
    /**
     * A main() so we can easily run these routing rules in our IDE
     */
    public static void main(String... args) {
        Main.main(args);
    }

    /**
     * Lets configure the Camel routing rules using Java code...
     */
    public void configure() {
        //-- Router receives requests from external clients and send to channel
        String[] cxfRouterURI = {
                "cxf://"
                ,ROUTER_ADDRESS
                ,"?"
                ,DATA_FORMAT
                ,"&"
                ,SERVICE_NAME
                ,"&"
                ,SERVICE_CLASS
                ,"&"
                ,PORT_NAME
        };

        //-- Service points to external web service. The request routed by the
Router 
        //-- is send to the external service provider
        String[] cxfServiceURI = {
                "cxf://"
                ,SERVICE_ADDRESS
                ,"?"
                ,DATA_FORMAT
                ,"&"
                ,SERVICE_NAME
                ,"&"
                ,SERVICE_CLASS
                ,"&"
                ,PORT_NAME
        };

       
from(StringUtils.join(cxfRouterURI)).to(StringUtils.join(cxfServiceURI));
    }
}
--------------------------------------------------------

When change the route this way:

        String anyEndpoint = "log:org.apache.camel?level=DEBUG";
        
       
from(StringUtils.join(cxfRouterURI)).to(anyEndpoint).to(StringUtils.join(cxfServiceURI));

I get this error:

------Exception Begin----------------------------
09/01/2008 18:32:40 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault
        at
org.apache.camel.component.cxf.interceptors.RawMessageContentRedirectInterceptor.handleMessage(RawMessageContentRedirectInterceptor.java:43)
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
        at
org.apache.camel.component.cxf.invoker.CxfClient.invokeWithMessageStream(CxfClient.java:137)
        at
org.apache.camel.component.cxf.invoker.CxfClient.dispatch(CxfClient.java:89)
        at
org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:202)
        at
org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:152)
        at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsynProcessorBridge.process(AsyncProcessorTypeConverter.java:44)
        at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:73)
        at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:143)
        at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:87)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:85)
        at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:40)
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:44)
        at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:68)
        at
org.apache.camel.component.cxf.CamelInvoker.invoke(CamelInvoker.java:71)
        at
org.apache.camel.component.cxf.interceptors.AbstractInvokerInterceptor.handleMessage(AbstractInvokerInterceptor.java:65)
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
        at
org.apache.camel.component.cxf.CxfMessageObserver.onMessage(CxfMessageObserver.java:83)
        at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:284)
        at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:240)
        at
org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:54)
        at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
        at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
        at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
        at org.mortbay.jetty.Server.handle(Server.java:313)
        at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
        at
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:844)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:726)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
        at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
        at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
Caused by: java.lang.NullPointerException
        at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1025)
        at org.apache.commons.io.IOUtils.copy(IOUtils.java:999)
        at
org.apache.camel.component.cxf.interceptors.RawMessageContentRedirectInterceptor.handleMessage(RawMessageContentRedirectInterceptor.java:39)
        ... 32 more
------Exception End----------------------------

The same problem happens with seda and activemq endpoints.

Thank you,

Wilson


Hi Wilson,

I am afraid you need to provide the SEI  class for camel-cxf component 
to initiate the endpoint.
If you do not want to unmarshal the request message , I think you could 
use soap message or raw message data formate.
Now I am thinking to do some refactoring  work to enable the web 
services endpoint without SEI class.

Willem.


-- 
View this message in context: 
http://www.nabble.com/About-JIRA-issue-CAMEL-180-tp14702992s22882p14720958.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to