You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by you2005 <yp...@163.com> on 2006/07/13 09:53:24 UTC
how to use xslt invok different webservices based on SOAP message
in 3.0
i use the lastest version of servicemix
now i need use xslt to invoke different webservice based on the soap
request, this request contains the webservice method and parameters which
will be invoked.now
my soap request was:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:jbi="xalan://org.apache.servicemix.components.xslt.XalanExtension"
extension-element-prefixes="jbi"
xmlns:foo="http://servicemix.org/cheese/" version="1.0">
<xsl:template match="/*">
<xsl:choose>
<!-- lets forward the inbound message to a service -->
<xsl:when test="@a">
<jbi:forward service="foo:stockQuote"/>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
my servicemix.xml file was:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:sm="http://servicemix.apache.org/config/1.0"
xmlns:foo="http://servicemix.org/demo/">
<!-- the JBI container -->
<sm:container id="jbi"
useMBeanServer="true"
createMBeanServer="true"
dumpStats="true"
statsInterval="10">
<sm:activationSpecs>
<!-- Create a http server binding on port 8912 and have it forward to the
foo:stockQuote -->
<sm:activationSpec componentName="httpReceiver"
service="foo:httpBinding"
endpoint="httpReceiver"
destinationService="foo:transformer">
<sm:component>
<bean class="org.apache.servicemix.components.http.HttpConnector">
<property name="host" value="localhost"/>
<property name="port" value="8912"/>
</bean>
</sm:component>
</sm:activationSpec>
<sm:activationSpec componentName="transformer" service="foo:transformer">
<sm:component><bean
class="org.apache.servicemix.components.xslt.XsltComponent" >
<property name="xsltResource" value="router.xsl"/>
<!-- lets disable automatic output of the result of the transform; only
if we perform
an invoke in the XSLT will we invoke another endpoint -->
<property name="disableOutput" value="true"/>
</bean></sm:component>
</sm:activationSpec>
<!-- This just invokes another service -->
<sm:activationSpec componentName="stockQuote"
service="foo:stockQuote"
endpoint="stockQuote">
<sm:component>
<bean class="org.apache.servicemix.components.saaj.SaajBinding">
<property name="soapEndpoint">
<bean class="javax.xml.messaging.URLEndpoint">
<constructor-arg
value="http://localhost:8081/axis/services/MagicThermoDIIClient"/>
</bean>
</property>
</bean>
</sm:component>
</sm:activationSpec>
</sm:activationSpecs>
</sm:container>
</beans>
and my router.xsl file was:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:jbi="xalan://org.apache.servicemix.components.xslt.XalanExtension"
extension-element-prefixes="jbi"
xmlns:foo="http://servicemix.org/cheese/" version="1.0">
<xsl:template match="/*">
<xsl:choose>
<!-- lets forward the inbound message to a service -->
<xsl:when test="@a">
<jbi:forward service="foo:stockQuote"/>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
when i run ,there is exception:
:WARN: EXCEPTION
javax.servlet.ServletException: illegal exchange status: done
at
org.apache.servicemix.components.http.HttpInOutBinding.processInOut(H
ttpInOutBinding.java:63)
at
org.apache.servicemix.components.http.HttpInOutBinding.process(HttpIn
OutBinding.java:44)
at
org.apache.servicemix.components.http.BindingServlet.doPost(BindingSe
rvlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:615)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:423
)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:3
55)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:5
67)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:1
19)
at org.mortbay.jetty.Server.handle(Server.java:248)
at
org.mortbay.jetty.HttpConnection.handlerRequest(HttpConnection.java:3
60)
at
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnectio
n.java:628)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:611)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:197)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:288)
at
org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.
java:180)
at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool
.java:475)
pls help me solve it
--
View this message in context: http://www.nabble.com/how-to-use-xslt-invok-different-webservices-based-on-SOAP-message-in-3.0-tf1935671.html#a5303651
Sent from the ServiceMix - User forum at Nabble.com.