-
1. Re: Help with Scenario
scottdawson Jul 8, 2010 9:00 AM (in response to davidmpaz)David,
Regarding question 1, the httpgateway quickstart shows a simple example of the use of the HttpRequest object. What problem are you having?
Regards,
Scott
-
2. Re: Help with Scenario
davidmpaz Jul 9, 2010 8:18 AM (in response to scottdawson)Hi, thanks for the quick reply.
My confusion is that (founded yesterday after writing the post) message arrive as byte[], as explained in docs for http_gateway/payload decoding and I was trying to handle as HttpRequest, I think my problem now is how to extract usefull information from the message coming as byte[] since http_gateway receives a post from a php page using curl.
For make my self more clear, this is my service configfuration for the http_gateway:
{code:xml}
<service category="UclvHTTPStarterService" name="HTTPStarterService"
description="Use this service to start a process instance through http"
invmScope="GLOBAL">
<listeners>
<http-gateway name="starter" busidref="secureChanel"
urlPattern="starter/*">
<asyncResponse statusCode="202" />
</http-gateway>
</listeners>
<actions mep="RequestResponse">
<!--<action name="preproces" class="cu.edu.uclv.uchannel.http.HTTPCreateUser"
process="process" />
--><action name="http_create_new_process_instance"
>
<property name="command" value="StartProcessInstanceCommand" />
<property name="process-definition-name" value="UclvUserCreation" />
<property name="esbToBpmVars">
<mapping esb="BODY_CONTENT" bpm="theBody" />
</property>
</action>
</actions>
</service>{code}
now, when processing the message in the commented action I sucessfully get the HttpRequest like this:
{code}
HttpRequest requestInfo = HttpRequest.getRequest(message);
{code}
again, just as explained in docs, but when using the configuration above, to the service invoked by the jbpm process arrive a byte array. I could make a work around and in the gateway make send a jms message with the HttpRequest as body content but that will be another call and more unnessary processing. I have also try as you could imagine to preprocess the message in the action commented and then passing it to the other action but still getting the same message (as byte array) in the services invoked by the process. So I hope I explain my issue well, maybe I should reformulate that question (the second question remain) .
How can I extract the usefull posted data from the byte array, there is a way that does't involve converting it to string and parsing it?
thanks a lot for listen and help.
Greetings David
-
3. Help with Scenario SOLVED !!!
davidmpaz Jul 11, 2010 4:11 PM (in response to davidmpaz)Problem solved. Sorry for bothering with such a newbie question, I miss a really important part from the first quickstart about ESB JBPM integration, this line:
{code:xml}
<mapping esb="BODY_CONTENT" bpm="theBody" />
{code}
maps the message to the variable theBody but as byte[] since it is done as getContent() do
Everything works smoothly after doing required mappings for the vars I needed inside the message to pass from one service to another. the config looks now like this:
{code:xml}
<service category="UclvHTTPStarterService" name="HTTPStarterService"
description="Use this service to start a process instance through http"
invmScope="GLOBAL">
<listeners>
<http-gateway name="starter" busidref="secureChanel"
urlPattern="starter/*">
<asyncResponse statusCode="202" />
</http-gateway>
</listeners>
<actions mep="RequestResponse">
<!--extract http request and set up var needed-->
<action name="preproces" class="cu.edu.uclv.uchannel.http.HTTPCreateUser"
process="process" />
<action name="http_create_new_process_instance">
<property name="command" value="StartProcessInstanceCommand" />
<property name="process-definition-name" value="UclvUserCreation" />
<property name="esbToBpmVars">
<mapping esb="body.user_name" bpm="user_name" /><mapping esb="body.user_password" bpm="user_password" />
</property>
..........
</action>
</actions>
</service>{code}
And of course the similar things in the process definition.
Thanks a lot for listen and sorry for the time taken.
Greetings David
-
4. Help with Scenario
chuaky Mar 16, 2011 11:41 PM (in response to davidmpaz)hi David n any1,
I encountered the same problem while using http gateway to receive a Http Post and then do some business processing using jbpm in esb. What i don't understand is the byte[] in the message body used by http gateway, in how it causes problem in using "BODY_CONTENT"?
Hope some1 can help,
Thanks.
-
5. Re: Help with Scenario
davidmpaz Mar 18, 2011 4:11 PM (in response to davidmpaz)Hi,
taking a look to this:
{code:xml}<property name="esbToBpmVars"><mapping esb="BODY_CONTENT" bpm="theBody" /></property>{code}
if doing it this way then the jbpm will receive data as a byte[] and not as was the spected variables like doing it like this:
{code:xml}
<property name="esbToBpmVars">
<mapping esb="body.user_name" bpm="user_name" />
<mapping esb="body.user_password" bpm="user_password" />
..........</property>
{code}
this way in jbpm you can refer to it as it is by their names "user_password" and not as an entire byte stream. Of course mappings in jbpm to do the inverse was needed too.
I just wanted to have each var separated to work with and not as an string.
Hope this help
-
6. Help with Scenario
chuaky Mar 20, 2011 9:27 PM (in response to davidmpaz)Thanks David for the advice, will try it out.