Take a look at
http://svn.servicemix.codehaus.org/trunk/servicemix-core/src/test/resources/org/servicemix/components/util/chained-router.xml?rev=1042&view=auto

The org.servicemix.components.util.ChainedComponent does the same job as the
groovy script, but in a much simplier way.

Guillaume


Julio Faerman wrote:

Thanks Angel,

The proposed solution is to script routing using groovy, as shown in

http://svn.servicemix.codehaus.org/trunk/components/base/src/test/resources/org/servicemix/components/groovy/groovy-chain.xml?rev=693&view=auto

Thou i think it is a bit complex way to do simple services chaining.
I am having a hard time understanding routing.

- Is there any source of information on routing more complete than the
wiki and more understandable than the source code ?

- What the destinationService attribute means, if not service chaining ?

- Is there a simpler way to do service chaining ?

Best regards,
Julio

On 12/8/05, Angel Gomez <[EMAIL PROTECTED]> wrote:
Well, as JB pointed out in another thread ( userlist, mail archives,
200510, XSQL Component ), The HTTPComponent is an inout binding, and invokes
and returns the next service in the chain. Since you are wanting to go one
component past this chain, it will never reach it.

Regards.


On 12/7/05, Julio Faerman <[EMAIL PROTECTED]> wrote:
Hello,

I have a question about ServiceMix Routing.

I am trying to alter the http binding exampe so that instead of doing:

 HTTPClient -> httpReceiver -> stockQuote

I want it to do:

 HTTPClient -> myServiceUsingXMLText -> httpReceiver -> stockQuote

where "myServiceUsingXMLText" builds the request instead of reading
the request.xml file.

My attempt was:

Change routing using destinationService attributes on tags.

The problem is:

the client receives the answer from myServiceUsingXMLText (which is the
request)
instead of getting the stock quote.


What was my mistake ?


Thanks a lot,
Julio Faerman

relevant source code ( ... means equals to original http binding example)
------------------
HTTPClient :
main(){
..
InputStream fis = new
ByteArrayInputStream("".getBytes()); //sends empty request
..
}
:

servicemix.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans...>
 <!-- the JBI container -->
 <sm:container spring:id="jbi" ...>
   <sm:activationSpecs>
     <!-- Create a http server binding on port 8912  and have it
forward to the foo:stockQuote -->
     <sm:activationSpec componentName="httpReceiver" ...
destinationService="foo:myServiceUsingXMLText">
       ...
     </sm:activationSpec>

     <!-- START SNIPPET: xmlText -->
     <sm:activationSpec
componentName="myServiceUsingXMLText"
service="foo:myServiceUsingXMLText"
destinationService="foo:stockQuote">
       <sm:component>
         <bean
class="org.servicemix.components.groovy.GroovyComponent">
           <property name="scriptText">
             <value>
               <![CDATA[
outMessage.bodyText = """
<ns1:getQuote xmlns:ns1="urn:xmethods-delayed-quotes"
xmlns:xsi=" http://www.w3.org/1999/XMLSchema-instance";
xmlns:se="http://schemas.xmlsoap.org/soap/envelope/";
se:encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/";>
 <symbol xsi:type="xsd:string">SUNW</symbol>

</ns1:getQuote>
""" ]]>
                           </value>
           </property>
         </bean>
       </sm:component>
     </sm:activationSpec>
     <!-- END SNIPPET: xmlText -->

     <!-- This just invokes another service -->
     <sm:activationSpec componentName="stockQuote"
         service="foo:stockQuote"
         endpoint="stockQuote">
       <sm:component>
         <bean xmlns="
http://xbean.org/schemas/spring/1.0";
class="org.servicemix.components.saaj.SaajBinding">
           <property name="soapEndpoint">
             <bean class="javax.xml.messaging.URLEndpoint">
               <constructor-arg
value="http://64.124.140.30/soap"/>
             </bean>
           </property>
         </bean>
       </sm:component>
     </sm:activationSpec>
   </sm:activationSpecs>
 </sm:container>
</beans>




Reply via email to