You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ode.apache.org by buddhika chamith <ch...@gmail.com> on 2009/03/30 12:17:59 UTC

Usage of MockBpelServer

Hi,

I am using the MockBpelServer to deploy and invoke a process. I was able to
deploy a simple synchronous helloworld process to it. But it seems the
invoke method doesn't return anything as a form of response from the
process.(return type is void). So I changed the method to return the object
taken from the Future class which is returned from calling invoke on
MyRoleMessageExchage. But I donot get any response from the process
invocation in that manner. It time out when I use a time duration for it to
complete. Here is my modified invoke method. Top portion is unchanged from
the original method.

 public Object invoke(QName serviceName, String opName, Element body) throws
Exception {
        try {
           // unchanged
            Future f= mex.invoke(request);
            mex.complete();
            _txManager.commit();
            return f.get(70000, TimeUnit.MILLISECONDS);
        }catch(TimeoutException e){
            e.printStackTrace();
            throw new Exception();
        }catch (Exception except) {
              _txManager.rollback();
              throw except;
        }
}

Any help in this regard is greatly appreciated. Is there a better way to
start the engine, deploy, invoke and get a response from a process using IL
API level interfaces?

Regards,
Chamith

RE: Usage of MockBpelServer

Posted by Andi Abes <aa...@progress.com>.
Take a look at:
org.apache.ode.bpel.iapi.MessageExchangeContext.
onMyRoleMessageExchangeStateChanged

Which is implemented in an anonymous inner class created in
createMessageExchangeContext().

You could probably override this to get the exchange and it's return
message.

HTH,
A.



> -----Original Message-----
> From: buddhika chamith [mailto:chamibuddhika@gmail.com]
> Sent: Monday, March 30, 2009 6:18 AM
> To: user@ode.apache.org
> Subject: Usage of MockBpelServer
> 
> Hi,
> 
> I am using the MockBpelServer to deploy and invoke a process. I was
able
> to
> deploy a simple synchronous helloworld process to it. But it seems the
> invoke method doesn't return anything as a form of response from the
> process.(return type is void). So I changed the method to return the
> object
> taken from the Future class which is returned from calling invoke on
> MyRoleMessageExchage. But I donot get any response from the process
> invocation in that manner. It time out when I use a time duration for
it
> to
> complete. Here is my modified invoke method. Top portion is unchanged
from
> the original method.
> 
>  public Object invoke(QName serviceName, String opName, Element body)
> throws
> Exception {
>         try {
>            // unchanged
>             Future f= mex.invoke(request);
>             mex.complete();
>             _txManager.commit();
>             return f.get(70000, TimeUnit.MILLISECONDS);
>         }catch(TimeoutException e){
>             e.printStackTrace();
>             throw new Exception();
>         }catch (Exception except) {
>               _txManager.rollback();
>               throw except;
>         }
> }
> 
> Any help in this regard is greatly appreciated. Is there a better way
to
> start the engine, deploy, invoke and get a response from a process
using
> IL
> API level interfaces?
> 
> Regards,
> Chamith

Re: Usage of MockBpelServer

Posted by buddhika chamith <ch...@gmail.com>.
Hi Andi,Matthieu,

Thanks for the replies. Seems like
MessageExchangeContext.onMyRoleMessageExchangeStateChanged() is not  present
in the branch. I will try this on the trunk and see. As for the Matthieu's
suggestion I used MessageExchange.getResponse(). But then I ran in to the
some other exception. I have included the trace in the attached text file. I
am not exactly sure what causes this since I am not very familiar with
OpenJPA.

Actually I am not using MockBpelServer for testing purposes. What I want to
do is to embed ODE runtime in to one of my Eclipse plugins to be able to
directly talk to it. So I don't want to use any Integration layers (Axis) to
communicate with the engine. I saw that IL API level interfaces are used in
MockBpelServer. So I thought that it would be a good start. So my final goal
is to manage server life cycle, deployment of processes, process and
instance management capabilites, debugging and event listening capabilities
by talking to ODE directly via IL level APIs. These functionalities will be
complimented by a suitable Eclipse GUI front end. I don't know what I am
trying to achieve is realistic or the if this is the best way to achieve it.
If anyone has better suggesitons I greatly appreciate them.

Best Regards,
Chamith

On Mon, Mar 30, 2009 at 8:12 PM, Matthieu Riou <ma...@gmail.com>wrote:

> Hi Chamith,
>
> First, you should probably direct those questions to dev@, we have few
> users playing with MockBpelServer :)
>
> The response isn't picked up as a direct return type from the method, it's
> actually set on the message exchange, it seems to me we're doing the correct
> thing here:
>
>
> http://svn.apache.org/repos/asf/ode/branches/APACHE_ODE_1.X/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java
>
> Your client should then extract the response from the MessageExchange. It's
> usually returned when you call MessageExchange.invoke() and use the Future
> but you can also use directly MessageExchange.getResponse().
>
> So what are you testing?
>
> Matthieu
>
>
> On Mon, Mar 30, 2009 at 3:17 AM, buddhika chamith <chamibuddhika@gmail.com
> > wrote:
>
>> Hi,
>>
>> I am using the MockBpelServer to deploy and invoke a process. I was able
>> to
>> deploy a simple synchronous helloworld process to it. But it seems the
>> invoke method doesn't return anything as a form of response from the
>> process.(return type is void). So I changed the method to return the
>> object
>> taken from the Future class which is returned from calling invoke on
>> MyRoleMessageExchage. But I donot get any response from the process
>> invocation in that manner. It time out when I use a time duration for it
>> to
>> complete. Here is my modified invoke method. Top portion is unchanged from
>> the original method.
>>
>>  public Object invoke(QName serviceName, String opName, Element body)
>> throws
>> Exception {
>>        try {
>>           // unchanged
>>            Future f= mex.invoke(request);
>>            mex.complete();
>>            _txManager.commit();
>>            return f.get(70000, TimeUnit.MILLISECONDS);
>>        }catch(TimeoutException e){
>>            e.printStackTrace();
>>            throw new Exception();
>>        }catch (Exception except) {
>>              _txManager.rollback();
>>              throw except;
>>        }
>> }
>>
>> Any help in this regard is greatly appreciated. Is there a better way to
>> start the engine, deploy, invoke and get a response from a process using
>> IL
>> API level interfaces?
>>
>> Regards,
>> Chamith
>>
>
>

Re: Usage of MockBpelServer

Posted by Matthieu Riou <ma...@gmail.com>.
Hi Chamith,

First, you should probably direct those questions to dev@, we have few users
playing with MockBpelServer :)

The response isn't picked up as a direct return type from the method, it's
actually set on the message exchange, it seems to me we're doing the correct
thing here:

http://svn.apache.org/repos/asf/ode/branches/APACHE_ODE_1.X/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java

Your client should then extract the response from the MessageExchange. It's
usually returned when you call MessageExchange.invoke() and use the Future
but you can also use directly MessageExchange.getResponse().

So what are you testing?

Matthieu

On Mon, Mar 30, 2009 at 3:17 AM, buddhika chamith
<ch...@gmail.com>wrote:

> Hi,
>
> I am using the MockBpelServer to deploy and invoke a process. I was able to
> deploy a simple synchronous helloworld process to it. But it seems the
> invoke method doesn't return anything as a form of response from the
> process.(return type is void). So I changed the method to return the object
> taken from the Future class which is returned from calling invoke on
> MyRoleMessageExchage. But I donot get any response from the process
> invocation in that manner. It time out when I use a time duration for it to
> complete. Here is my modified invoke method. Top portion is unchanged from
> the original method.
>
>  public Object invoke(QName serviceName, String opName, Element body)
> throws
> Exception {
>        try {
>           // unchanged
>            Future f= mex.invoke(request);
>            mex.complete();
>            _txManager.commit();
>            return f.get(70000, TimeUnit.MILLISECONDS);
>        }catch(TimeoutException e){
>            e.printStackTrace();
>            throw new Exception();
>        }catch (Exception except) {
>              _txManager.rollback();
>              throw except;
>        }
> }
>
> Any help in this regard is greatly appreciated. Is there a better way to
> start the engine, deploy, invoke and get a response from a process using IL
> API level interfaces?
>
> Regards,
> Chamith
>