-
1. Re: In the quickstart "camel-service", how do I call another (external) service?
splatch Apr 17, 2013 4:55 AM (in response to puttime)If you have MyServiceInterface defined in one place in all places where you try to reffer it you need "sca:reference" element. Your switchyard.xml where you have camel implementation defined you need something like this:
<sca:reference name="MyServiceInterface"> <sca:interface.java interface="com.acme.MyServiceInterface"/> </sca:reference>
-
2. Re: In the quickstart "camel-service", how do I call another (external) service?
puttime Apr 17, 2013 6:03 AM (in response to splatch)I tried it, added the following three lines to switchyard.xml, like this::
<sca:reference name="MyServiceInterface">
<sca:interface.java interface="com.my.whatever.somename.MyServiceInterface" />
</sca:reference>
But I get this error: The prefix "sca" for element "sca:reference" is not bound. switchyard.xml
If I do this,
<interface.java interface="com.my.whatever.somename.MyServiceInterface" />
</reference>
then I get this error:
<reference name="MyServiceInterface">
Unresolved Reference: The component reference "MyServiceInterface" cannot be resolved to a service. switchyard.xml
-
3. Re: In the quickstart "camel-service", how do I call another (external) service?
splatch Apr 17, 2013 5:58 AM (in response to puttime)It depends what's the default namespace for your configuration - you may not need sca: prefix if xmlns for your composite element points to http://docs.oasis-open.org/ns/opencsa/sca/200912:
<composite .... xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"> <!-- skip unecessary part --> <component> <reference name="MyServiceInterface"> <interface.java interface="com.my.whatever.somename.MyServiceInterface" /> </reference> </component> </sca:composite>
Feel free to post your configuration for review if you will still have problems.
-
4. Re: In the quickstart "camel-service", how do I call another (external) service?
puttime Apr 17, 2013 6:08 AM (in response to splatch)ok, here is the content of switchyard.xml from camel-service.
Note that I have added the "MyServiceInterface" in here.
<?xml version="1.0" encoding="UTF-8"?> <switchyard xmlns="urn:switchyard-config:switchyard:1.0" xmlns:file="urn:switchyard-component-camel-file:config:1.0" xmlns:swyd="urn:switchyard-config:switchyard:1.0"> <composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" name="camel-service" targetNamespace="urn:switchyard-quickstart:camel-service:0.1.0"> <service name="JavaDSL" promote="JavaDSLBuilder/JavaDSL"> <file:binding.file> <file:directory>data/</file:directory> </file:binding.file> </service> <component name="JavaDSLBuilder"> <implementation.camel xmlns="urn:switchyard-component-camel:config:1.0"> <java class="org.switchyard.quickstarts.camel.service.JavaDSLBuilder"/> </implementation.camel> <service name="JavaDSL"> <interface.java interface="org.switchyard.quickstarts.camel.service.JavaDSL"/> </service> <reference name="XMLService"> <swyd:interface.esb xmlns:swyd="urn:switchyard-config:switchyard:1.0" inputType="java:java.lang.String"/> </reference> <reference name="MyServiceInterface"> <interface.java interface="com.my.whatever.somename.MyServiceInterface"/> </reference> </component> <component name="XMLComponent"> <implementation.camel xmlns="urn:switchyard-component-camel:config:1.0"> <xml path="META-INF/route.xml"/> </implementation.camel> <service name="XMLService"> <swyd:interface.esb xmlns:swyd="urn:switchyard-config:switchyard:1.0" inputType="java:java.lang.String"/> </service> </component> </composite> </switchyard>
-
5. Re: In the quickstart "camel-service", how do I call another (external) service?
splatch Apr 17, 2013 6:08 AM (in response to puttime)You don't have sca: prefix so you don't need prefix reference elements too. You are good to go as long as you have service with MyServiceInterface deployed.
-
6. Re: In the quickstart "camel-service", how do I call another (external) service?
puttime Apr 17, 2013 6:22 AM (in response to splatch)then I get this error:
Unresolved Reference: The component reference "MyServiceInterface" cannot be resolved to a service. switchyard.xml
If I still go ahead and deploy the application on the server, then I get this error on the server::
15:42:51,826 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.deployment.unit."switchyard-quickstart-camel-service.jar".SwitchYardService:
org.jboss.msc.service.StartException in service jboss.deployment.unit."switchyard-quickstart-camel-service.jar".SwitchYardService: org.switchyard.exception.SwitchYardException: Failed to load Service interface class 'com.my.whatever.somename.MyServiceInterface'.