Re: [rules-users] drools-server empty response body
In my test, I posted the set-global command along with the rule execution commands, like this (snippet): List commands = new ArrayList(); commands.add(CommandFactory.newSetGlobal("logger", logger)); commands.add(CommandFactory.newInsert(fact, "outId")); commands.add(CommandFactory.newFireAllRules()); BatchExecutionCommand batchCommand = CommandFactory.newBatchExecution(commands, "ksession"); .etc. (I had configured the ksession as stateless) -- View this message in context: http://drools.46999.n3.nabble.com/drools-server-empty-response-body-tp3192475p3367046.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] drools-server empty response body
you'd do something like this... in your Java code, instantiate an instance of your logger (of whatever class) import org.apache.commons.Log; // or whatever logger class you are using private Log mylogger = new Log(); then create your command list and add the logger instance as a global: List commands = new ArrayList(); commands.add(CommandFactory.newSetGlobal("logger", mylogger)); then in your rule you declare the global: global org.apache.commons.Log logger; -- View this message in context: http://drools.46999.n3.nabble.com/drools-server-empty-response-body-tp3192475p3365538.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] drools-server empty response body
I added that return($step) in my series of attempts to get the stuff to work - I don't normally use that statement. It did not change the rule behaviour. But yes, it did compile (I'm at 5.2 Final). -- View this message in context: http://drools.46999.n3.nabble.com/drools-server-empty-response-body-tp3192475p3194042.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] drools-server empty response body
Could you really compile that rule with "return($step)" as its last statment? Rule bodies result in void methods, so... Anyway, you'll need to provide an "out" identifier with the "insert" command to get the inserted object back in your results: The CommandFactory provides a separate call for that. -W On 22 July 2011 23:52, lhorton wrote: > I am new to calling Rest services and using drools-server. I configured > the > camel-server.xml and knowledge-services.xml rest service to use xstream > marshalling, added my rules and pojo model to the war, and deployed it on > tomcat. I wrote a java http client to run the rest service. This is the > batch command that I'm sending: > > > > > com.abclegal.rules.integration.StatusChangeTestIntegration > > > > > 0 > 0 > PENDING > false > false > false > > > > > > this is the rule: > > rule "Activate VenueValidationStep" > dialect "mvel" >when >$step : VenueValidationStep(activatable == false, status == > Status.PENDING) >then >logger.debug("activating VenueValidationStep"); >modify($step) { >setActivatable(true), >setStatus(Status.ACTIVE); >}; >return($step); > end > > when I run the client, I can see on the server log that the global was set > and the correct rule is running (it writes to the log using the global > logger), and i get a 200 response on the http post. However, the response > body is empty except for the enclosing xml tags. it contains only: > > > > The behaviour I would like to happen is that the modified $step would be > returned from the http post. > > Apologies if this is another dumb noob question - I hope it's just > something > simple I've missed. thanks for the help. > > > -- > View this message in context: > http://drools.46999.n3.nabble.com/drools-server-empty-response-body-tp3192475p3192475.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] drools-server empty response body
I'm answering my own questions today... the solution here was that the insert object command MUST have an outIdentifier or results won't be returned. it doesn't work to just set the returnObject boolean to true (true is supposed to be the default). Once I set the outIdentifier when i created the insert object command, I got results. the xml for the insert looks like this now: -- View this message in context: http://drools.46999.n3.nabble.com/drools-server-empty-response-body-tp3192475p3192626.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] drools-server empty response body
also realized i missed a bit of the command xml when i pasted it above. at the top should be: -- View this message in context: http://drools.46999.n3.nabble.com/drools-server-empty-response-body-tp3192475p3192518.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] drools-server empty response body
I should have said that I tried adding a Get Objects command to the batch, but that did not change the behaviour. com.abclegal.rules.integration.StatusChangeTestIntegration 0 0 PENDING false false false -- View this message in context: http://drools.46999.n3.nabble.com/drools-server-empty-response-body-tp3192475p3192500.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users