filtering router

View: New views
3 Messages — Rating Filter:   Alert me  

filtering router

by Marco Mascia-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, I have the following outbound filtering router. If I use jaxen-filter and have a match I get a NPE as shown in the stack trace below. Matching on payload-type-filter works fine.

                    <outbound>
                        <filtering-router>
                                <cxf:outbound-endpoint address="http://localhost:8888/services/CustomerService"
                proxy="true" synchronous="true" >
        </cxf:outbound-endpoint>
        <!-- payload-type-filter expectedType="org.apache.cxf.staxutils.DepthXMLStreamReader" / --> // works
        <mulexml:jaxen-filter pattern="//request/Id" expectedValue="101" />  // throws exception
  </filtering-router>
                    </outbound>

I noticed in tcpmon that my end point with jaxen-filter, the <soap:Body /> part of the payload is blanked out.
Any ideas or workaround would be appreciated. Thanks

org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Interceptor has thrown exception, unwinding now
java.lang.NullPointerException
        at org.apache.cxf.frontend.SimpleMethodDispatcher.getMethod(SimpleMethodDispatcher.java:96)
        at org.mule.transport.cxf.MuleInvoker.invoke(MuleInvoker.java:67)
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:57)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:95)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:226)
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:89)
        at org.mule.transport.cxf.CxfServiceComponent.sendToDestination(CxfServiceComponent.java:284)
        at org.mule.transport.cxf.CxfServiceComponent.onCall(CxfServiceComponent.java:112)
        at org.mule.model.resolvers.CallableEntryPointResolver.invoke(CallableEntryPointResolver.java:52)
        at org.mule.model.resolvers.DefaultEntryPointResolverSet.invoke(DefaultEntryPointResolverSet.java:50)
        at org.mule.component.DefaultLifecycleAdapter.invoke(DefaultLifecycleAdapter.java:205)
        at org.mule.component.AbstractJavaComponent.invokeComponentInstance(AbstractJavaComponent.java:83)
        at org.mule.component.AbstractJavaComponent.doInvoke(AbstractJavaComponent.java:74)
        at org.mule.component.AbstractComponent.invokeInternal(AbstractComponent.java:133)
        at org.mule.component.AbstractComponent.invoke(AbstractComponent.java:161)
        at org.mule.service.AbstractService.invokeComponent(AbstractService.java:929)
        at org.mule.model.seda.SedaService.doSend(SedaService.java:260)
        at org.mule.service.AbstractService.sendEvent(AbstractService.java:500)
        at org.mule.DefaultMuleSession.sendEvent(DefaultMuleSession.java:354)
        at org.mule.routing.inbound.DefaultInboundRouterCollection.send(DefaultInboundRouterCollection.java:228)
        at org.mule.routing.inbound.DefaultInboundRouterCollection.route(DefaultInboundRouterCollection.java:188)
        at org.mule.transport.AbstractMessageReceiver$DefaultInternalMessageListener.onMessage(AbstractMessageReceiver.java:359)
        at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:252)
        at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:193)
        at org.mule.transport.http.HttpMessageReceiver$HttpWorker.doRequest(HttpMessageReceiver.java:275)

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: filtering router

by Blaise Tuffet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Your problem may be related to the DepthXMLStreamReader you use. since  
this object is a consumable stream, if you apply a transformer or a  
filter that consume it, you will lose the content of your message. I  
can't tell whether the filter consumes the stream or not but you  
should try the same when having your StreamReader transformed to a  
String for instance in the inbound endpoint.

Hope this help.

Blaise

Quoting colvaman <mule.dev.relay@...>:

> Hi, I have the following outbound filtering router. If I use  
> jaxen-filter and have a match I get a NPE as shown in the stack  
> trace below. Matching on payload-type-filter works fine.
>
>    <outbound>
>        <filtering-router>
> <cxf:outbound-endpoint  
> address="http://localhost:8888/services/CustomerService"
>                 proxy="true" synchronous="true" >
>         </cxf:outbound-endpoint>
>         <!-- payload-type-filter  
> expectedType="org.apache.cxf.staxutils.DepthXMLStreamReader" / -->  
> // works
>         <mulexml:jaxen-filter pattern="//request/Id"  
> expectedValue="101" />  // throws exception
>   </filtering-router>
>    </outbound>
>
> I noticed in tcpmon that my end point with jaxen-filter, the  
> <soap:Body /> part of the payload is blanked out.
> Any ideas or workaround would be appreciated. Thanks
>
> org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> INFO: Interceptor has thrown exception, unwinding now
> java.lang.NullPointerException
> at  
> org.apache.cxf.frontend.SimpleMethodDispatcher.getMethod(SimpleMethodDispatcher.java:96)
> at org.mule.transport.cxf.MuleInvoker.invoke(MuleInvoker.java:67)
> at  
> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:57)
> at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
> at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
> at java.util.concurrent.FutureTask.run(Unknown Source)
> at  
> org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
> at  
> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:95)
> at  
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:226)
> at  
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:89)
> at  
> org.mule.transport.cxf.CxfServiceComponent.sendToDestination(CxfServiceComponent.java:284)
> at  
> org.mule.transport.cxf.CxfServiceComponent.onCall(CxfServiceComponent.java:112)
> at  
> org.mule.model.resolvers.CallableEntryPointResolver.invoke(CallableEntryPointResolver.java:52)
> at  
> org.mule.model.resolvers.DefaultEntryPointResolverSet.invoke(DefaultEntryPointResolverSet.java:50)
> at  
> org.mule.component.DefaultLifecycleAdapter.invoke(DefaultLifecycleAdapter.java:205)
> at  
> org.mule.component.AbstractJavaComponent.invokeComponentInstance(AbstractJavaComponent.java:83)
> at  
> org.mule.component.AbstractJavaComponent.doInvoke(AbstractJavaComponent.java:74)
> at  
> org.mule.component.AbstractComponent.invokeInternal(AbstractComponent.java:133)
> at org.mule.component.AbstractComponent.invoke(AbstractComponent.java:161)
> at  
> org.mule.service.AbstractService.invokeComponent(AbstractService.java:929)
> at org.mule.model.seda.SedaService.doSend(SedaService.java:260)
> at org.mule.service.AbstractService.sendEvent(AbstractService.java:500)
> at org.mule.DefaultMuleSession.sendEvent(DefaultMuleSession.java:354)
> at  
> org.mule.routing.inbound.DefaultInboundRouterCollection.send(DefaultInboundRouterCollection.java:228)
> at  
> org.mule.routing.inbound.DefaultInboundRouterCollection.route(DefaultInboundRouterCollection.java:188)
> at  
> org.mule.transport.AbstractMessageReceiver$DefaultInternalMessageListener.onMessage(AbstractMessageReceiver.java:359)
> at  
> org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:252)
> at  
> org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:193)
> at  
> org.mule.transport.http.HttpMessageReceiver$HttpWorker.doRequest(HttpMessageReceiver.java:275)
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>






---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: filtering router

by Marco Mascia-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks, you are correct.
This issue has being identified in the following links:
http://www.mulesoft.org/jira/browse/MULE-4096 
http://old.nabble.com/filtering-router-does-not-support-streaming--td21736130.html

I did a quick test using "message-property-filter" and this seems to work.
So I created a component that pulls out the destination id and save it in a mule message property.
My component implements Callable
        public Object onCall(MuleEventContext context) throws Exception {

                // Get the payload
                String payload = context.getMessageAsString();
                // get destinatation id from payload.
               
                // set message properties
                context.getMessage().setStringProperty("destinationId", destinationid);
               
                return context.getMessage();
        }

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email