On Sun, Sep 25, 2011 at 9:18 AM, tatha <[email protected]> wrote:
> Hi Claus,
>
> Thanks for the response.
>
> We are using Camel 2.0.0. Yes you are right, the Tomcat runs on one JVM and
> the JUNIT needs to run on another JVM, so in short we have to do a remote
> communication to call the endpoint.
>
Camel 2.0.0 is a very old release. You may consider if possible to upgrade.

Yes that you need. For example you can use HTTP as remote communication.
Tomcat is a web server, so it can already exposes a service over HTTP.

You can use the Camel servlet component
http://camel.apache.org/servlet

You can also just create a regular servlet in Tomcat, and from the
servlet invoke the Camel direct endpoint,
using a ProducerTemplate.

For example we used to have an Axis example that shows how to use Axis
(Servlet) with Camel.
You can use that as an inspiration
https://svn.apache.org/repos/asf/camel/tags/camel-2.7.0/examples/camel-example-axis/




> The DispatcherServiceImpl is a simple stateless business class, which has
> business methods which accepts xml inputs and processes that to return a
> response xml.
>
> I hope that helps. I was able to call the end point if its running on the
> same JVM, but not in the case mentioned.
>
> Thanks,
>
> Tatha
>
> On Sat, Sep 24, 2011 at 6:56 PM, Claus Ibsen-2 [via Camel] <
> [email protected]> wrote:
>
>> Hi
>>
>> Welcome to the Camel community.
>>
>> What version of Camel are you using?
>>
>> Does your unit test run in one JVM, and Tomcat in another JMV
>> (possible on a remote server)?
>> So what you need to do is a remote communication from JVM to JVM over
>> the network?
>>
>>
>> What do you do in this bean, DispatcherServiceImpl ?
>>
>>
>>
>>
>> On Sat, Sep 24, 2011 at 1:41 PM, tatha <[hidden 
>> email]<http://user/SendEmail.jtp?type=node&node=4836572&i=0>>
>> wrote:
>>
>> > Hi All,
>> >
>> > I am a newbie in Camel and have to deliver a module in a very short
>> notice.
>> > You know how it is :).My question may be a very basic question but i
>> would
>> > really appreciate if someone could guide me on it.
>> >
>> > The requirement is to invoke a camel endpoint service deployed in a
>> tomcat
>> > server from a junit test case. The Service has been injected with the
>> > CamelContext and it has got a set of exposed methods which needs to be
>> > called.We are using Spring 2.5 and Camel 2 in our project. The Spring
>> config
>> > is below
>> >
>> >
>> > &lt;bean name="/DispatcherService"
>> >
>> class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter"&gt;
>>
>> >        &lt;property name="service" ref="dispatcherService"/&gt;
>> >        &lt;property name="serviceInterface"
>> > value="test.DispatcherService"/&gt;
>> >    &lt;/bean&gt;
>> >
>> >        &lt;camelContext id="dispatcherCamelContext" trace="true"
>> > xmlns="http://camel.apache.org/schema/spring"&gt;
>> >                &lt;route&gt;
>> >                        &lt;from uri="direct:dispatcherChannel" /&gt;
>> >                                &lt;!-- use comma as a delimiter for
>> String based values --&gt;
>> >                                &lt;recipientList delimiter=","&gt;
>> >
>>  &lt;header&gt;serviceEndpoints&lt;/header&gt;
>> >                                &lt;/recipientList&gt;
>> >                &lt;/route&gt;
>> >        &lt;/camelContext&gt;
>> >
>> >        &lt;bean id="dispatcherService"
>> class="test.DispatcherServiceImpl"&gt;
>> >                &lt;property name="context" ref="dispatcherCamelContext"
>> /&gt;
>> >        &lt;/bean&gt;
>> >
>> >
>> >
>> > what i am not able to find is to find how can we call the end point uri
>> > direct:dispatcherChannel deployed in a tomcat server (http://someIP:8080)
>>
>> > from a junit which uses spring configuration.
>> >
>> > Can some one please help me.
>> >
>> > Thanking all in advance.
>> >
>> > Thanks
>> > tatha
>> >
>> >
>> >
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> http://camel.465427.n5.nabble.com/Invoking-a-Camel-end-point-deployed-in-remote-Server-from-JUnit-test-case-tp4836420p4836420.html
>> > Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=4836572&i=1>
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://camel.465427.n5.nabble.com/Invoking-a-Camel-end-point-deployed-in-remote-Server-from-JUnit-test-case-tp4836420p4836572.html
>>  To unsubscribe from Invoking a Camel end point deployed in remote Server
>> from JUnit test case, click 
>> here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4836420&code=dGF0aGEucm95QGdtYWlsLmNvbXw0ODM2NDIwfC0xNDMwMjA5Njk5>.
>>
>>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Invoking-a-Camel-end-point-deployed-in-remote-Server-from-JUnit-test-case-tp4836420p4837929.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to