Guillaume,

I have attached the configuration below. 

The problem is cause becuase the underlying transformer used by eip that
executes the xpath expression, reads the InputStream associated with the
NormalizedMessage StreamSource content, and once read it closes that stream
(this is normal input stream behaviour). This means that the next object
that tries to read from that stream gets a reference to a closed
InputStream, in this case it happens in the Saaj component when transforming
to a soap message. You get the same problem if you use a SAXSource for
anything because this is also based on an underlying InputStream. DOMSource
is not base on InputStream does not, so it does not suffer from this
problem.

Regards, 

Tim

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xbean.org/schemas/spring/1.0";
        xmlns:spring="http://xbean.org/schemas/spring/1.0";
        xmlns:sm="http://servicemix.apache.org/config/1.0";
        xmlns:eip="http://servicemix.apache.org/eip/1.0";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xsi:schemaLocation="http://xbean.org/schemas/spring/1.0
../../conf/spring-beans.xsd http://servicemix.org/config/1.0
../../conf/servicemix.xsd"
    xmlns:my="http://my.com/esb/";>
    
  <!-- the JBI container -->
  <sm:container spring:id="jbi"
                useMBeanServer="false"
                createMBeanServer="false"
                dumpStats="true"
                statsInterval="10">
                
        <sm:activationSpecs>
                <!-- ESB client activation specs -->
        
                <!-- Http based client recieve/send html request/response 
passes message
to a router component-->
                <sm:activationSpec componentName="httpReceiver" 
service="my:httpBinding"
endpoint="httpReceiver"
                        destinationService="my:router">
                        <sm:component>
                                <bean 
xmlns="http://xbean.org/schemas/spring/1.0";
class="org.apache.servicemix.components.http.HttpConnector">
                                        <property name="host" value="localhost" 
/>
                                        <property name="port" value="8912" />
                                        <property name="marshaler">
                                                <bean 
class="com.my.esb.components.http.HttpMarshaler" />
                                        </property>
                                </bean>
                        </sm:component>
                </sm:activationSpec>
                <!-- End client activation specs -->

                <!-- Trace component - used for debugging -->
                <sm:activationSpec componentName="trace" service="my:trace">
                        <sm:component>
                                <bean 
xmlns="http://xbean.org/schemas/spring/1.0";
class="com.my.esb.components.util.TraceComponent"></bean>
                        </sm:component>
                </sm:activationSpec>
                <!-- End trace component - used for debugging -->
                
                
                
                <!--  Enterprise Integration Patterns -->
                <sm:activationSpec>
                  <sm:component>
          <eip:component>
                <eip:endpoints>

                        <!-- Router specs -->
                        <eip:content-based-router service="my:router"
endpoint="endpoint">
                                <eip:rules>
                                        <eip:routing-rule>
                                                <eip:predicate>
                                                        <eip:xpath-predicate 
xpath="count(/externalws:productSearch)
= 1" namespaceContext="#nsexternalws" />
                                                </eip:predicate>
                                                <eip:target>
                                                        <eip:exchange-target 
service="my:search" />
                                                </eip:target>
                                        </eip:routing-rule>
                                        <eip:routing-rule>
                                                <!--
                                                        there is no predicate, 
so this is the default destination       
                                                -->
                                                <eip:target>
                                                        <eip:exchange-target 
service="my:trace" />
                                                </eip:target>
                                        </eip:routing-rule>
                                </eip:rules>
                        </eip:content-based-router>
                        <!-- End router specs -->

                </eip:endpoints>
          </eip:component>
                  </sm:component>
      </sm:activationSpec>
                <!--  End EIPs -->

                <!-- externalws webservice -->
                <sm:activationSpec componentName="search"       
                                                   service="my:search"
                                                   endpoint="search">
                 <sm:component>
                    <bean xmlns="http://xbean.org/schemas/spring/1.0";
                          
class="org.apache.servicemix.components.saaj.SaajBinding">
                        <property name="soapEndpoint" ref="externalwsUrl"/>
                        <property name="soapAction"
value="http://www.externalwswebservices.com/productSearch"/>
                        <property name="marshaller" ref="saajMarshaller"/>
                    </bean>
                  </sm:component>
                </sm:activationSpec>
                                
                <!-- End externalws webservice -->
                

        </sm:activationSpecs>
  </sm:container>

        <!-- Bean definitions -->
        <eip:namespace-context id="nsexternalws">
                <eip:namespaces>
                        <eip:namespace
prefix="externalws">http://www.externalwswebservices.com/</eip:namespace>
                </eip:namespaces>
        </eip:namespace-context>

        <bean id="externalwsUrl" class="javax.xml.messaging.URLEndpoint">
                <constructor-arg value="http://localhost:6789/search.asmx"; />
        </bean>

        <bean id="saajMarshaller"
class="com.my.esb.components.saaj.SaajMarshaller">
                <property name="excludedHeaderTypes">
                        <list>
                                <value>cgi.headers</value>
                                <value>Host</value>
                                <value>User-Agent</value>
                                <value>Accept</value>
                                <value>Content-Type</value>
                        </list>
                </property>
        </bean>

</beans>

--
View this message in context: 
http://www.nabble.com/XsltComponent+routing+problem-t1687094.html#a4658167
Sent from the ServiceMix - User forum at Nabble.com.

Reply via email to