Helllo I'm new to ofbiz (12.04.02) I'm trying to implement my first groovy service.According to the documentationOFBiz DSL for Groovy Services and Events <https://cwiki.apache.org/confluence/display/OFBIZ/OFBiz+DSL+for+Groovy+Services+and+Events>
I have my service method implemented as
def myMethod() { return success() } when success() is executed in org.ofbiz.service.engine.GroovyBaseScript a MissingPropertyException is triggered def success(String message) {// TODO: implement some clever i18n mechanism based on the userLogin and locale in the binding
if (this.binding.getVariable('request')) { // the script is invoked as an "event"'request' is not in the binding as the script is called as a service instead of as event.
Shouldn't the line be as if (this.binding.hasVariable('request')) { so do not throw Missing exception ? Am I doing something wrong or it is worth to file an issue ? At the moment I have patched the code as below: ===================================================================--- framework/service/src/org/ofbiz/service/engine/GroovyBaseScript.groovy (revision 1569402) +++ framework/service/src/org/ofbiz/service/engine/GroovyBaseScript.groovy (revision )
@@ -55,7 +55,7 @@ def success(String message) {// TODO: implement some clever i18n mechanism based on the userLogin and locale in the binding
- if (this.binding.getVariable('request')) { + if (this.binding.hasVariable('request')) { // the script is invoked as an "event" return 'success'; } else { @@ -77,7 +77,7 @@ } def error(String message) {// TODO: implement some clever i18n mechanism based on the userLogin and locale in the binding
- if (this.binding.getVariable('request')) { + if (this.binding.hasVariable('request')) { // the script is invoked as an "event" if (message) { this.binding.getVariable('request').setAttribute("_ERROR_MESSAGE_", message) Thank you for yor attention. Paolo Piersanti -- Signature for Rent - Questo spazio si affitta Paolo Piersanti Software Developer & System Admininistrator
smime.p7s
Description: S/MIME Cryptographic Signature