Good morning,
I have the following choreography: two participants, a client and a server. There's an interaction in which the client sends a request message to the server, then there's a "Perform" action, which performs an enclosed choreography containing a silentAction of the server participant. When I generate the java code, in the receive.java class, generated for the server, I set a variable in which I put the content of the message received:
In the ActionActivity.java class generated for the server, that is in the enclosed choreography, I would want to read the variable containing the message:
context.getVariable("serverVariable");
But when I launch the test, it gives me an error:
GRAVE: Converting service exception 'org.pi4soa.service.VariableUnavailableException: Variable unavailable: serverVariable' into exception event
I think this is because I would have to add a bindVariable in the perform activity, but I can't do in this way, because I don't know previously the name and the type of the variable.
There's a way so that I could read the content of a variable from an enclosed choreography through something like context.getVariable, even if the variable is created out of the enclosed choreography?
Thanks in advance.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The problem, as you have suggested, is that you would require a bind variable. At the moment it is not possible for the Java code to interrogate the variables in the context of a parent sub-choreography.
Although this may be a useful thing to do, it is potentially dangerous when there are transactional implications of modifying information.
I would suggest storing this type of information outside of the scope of the choreography session management mechanism - i.e. in a separate storage mechanism accessible by both the extension code.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Good morning,
I have the following choreography: two participants, a client and a server. There's an interaction in which the client sends a request message to the server, then there's a "Perform" action, which performs an enclosed choreography containing a silentAction of the server participant. When I generate the java code, in the receive.java class, generated for the server, I set a variable in which I put the content of the message received:
context.setVariable("serverVariable", message.getValue());
In the ActionActivity.java class generated for the server, that is in the enclosed choreography, I would want to read the variable containing the message:
context.getVariable("serverVariable");
But when I launch the test, it gives me an error:
GRAVE: Converting service exception 'org.pi4soa.service.VariableUnavailableException: Variable unavailable: serverVariable' into exception event
I think this is because I would have to add a bindVariable in the perform activity, but I can't do in this way, because I don't know previously the name and the type of the variable.
There's a way so that I could read the content of a variable from an enclosed choreography through something like context.getVariable, even if the variable is created out of the enclosed choreography?
Thanks in advance.
The problem, as you have suggested, is that you would require a bind variable. At the moment it is not possible for the Java code to interrogate the variables in the context of a parent sub-choreography.
Although this may be a useful thing to do, it is potentially dangerous when there are transactional implications of modifying information.
I would suggest storing this type of information outside of the scope of the choreography session management mechanism - i.e. in a separate storage mechanism accessible by both the extension code.