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>