problem in calling a service from bsh

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

problem in calling a service from bsh

shree-3
Hi all,
I am trying to call a service from a bsh file.

The service is as follows..


 <simple-method method-name="updateProductPrice" short-description="Update an ProductPrice">
        <set field="callingMethodName" value="updateProductPrice" />
        <set field="checkAction" value="UPDATE" />
        <call-simple-method method-name="checkProductRelatedPermission" xml-resource="org/ofbiz/product/product/ProductServices.xml"/>
        <check-permission permission="PRODUCT_ADMIN"><fail-property resource="ProductUiLabels" property="ProductPriceMaintPermissionError"/></check-permission>
        <check-errors/>

        <entity-one entity-name="ProductPrice" value-name="lookedUpValue"/>

       
        <field-to-result map-name="lookedUpValue" field-name="price" result-name="oldPrice"/>

        <set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
                <now-timestamp-to-env env-name="nowTimestamp"/>
        <set field="lookedUpValue.lastModifiedDate" from-field="nowTimestamp" />
       

        <store-value value-name="lookedUpValue"/>
    </simple-method>

I am calling the service like below...


Timestamp currentTimeStamp=new Timestamp(today.getTime());
parameters.put("productId",productId);
parameters.put("userLogin",userLogin);
parameters.put("currencyUomId",currency);
parameters.put("price",Double.valueOf(price));
parameters.put("fromDate",currentTimeStamp);
result=dispatcher.runSync("updateProductPrice",parameters);


I am getting the following exception...


Exception: java.lang.Exception
Message: Error in simple-method [Update an ProductPrice [file:/C:/ofbiz/ofb/ofb/DEV/1.0.0/ofb/applications/product/script/org/ofbiz/product/price/PriceServices.xml#updateProductPrice]]: In set-nonpk-fields a value was not found with the specified valueAcsr: lookedUpValue, not setting fields
---- stack trace ---------------------------------------------------------------
java.lang.Exception: Error in simple-method [Update an ProductPrice [file:/C:/ofbiz/ofb/ofb/DEV/1.0.0/ofb/applications/product/script/org/ofbiz/product/price/PriceServices.xml#updateProductPrice]]: In set-nonpk-fields a value was not found with the specified valueAcsr: lookedUpValue, not setting fields
org.ofbiz.entity.transaction.TransactionUtil.setRollbackOnly(TransactionUtil.java:291)
org.ofbiz.entity.transaction.TransactionUtil.rollback(TransactionUtil.java:238)
org.ofbiz.minilang.SimpleMethod.exec(SimpleMethod.java:699)
org.ofbiz.minilang.SimpleMethod.runSimpleMethod(SimpleMethod.java:105)
org.ofbiz.minilang.SimpleMethod.runSimpleService(SimpleMethod.java:87)
org.ofbiz.minilang.SimpleServiceEngine.serviceInvoker(SimpleServiceEngine.java:76)
org.ofbiz.minilang.SimpleServiceEngine.runSync(SimpleServiceEngine.java:51)
org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:335)
org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:210)
org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136)
sun.reflect.GeneratedMethodAccessor159.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
bsh.Reflect.invokeMethod(Unknown Source)
bsh.Reflect.invokeObjectMethod(Unknown Source)
bsh.Name.invokeMethod(Unknown Source)
bsh.BSHMethodInvocation.eval(Unknown Source)
bsh.BSHPrimaryExpression.eval(Unknown Source)
bsh.BSHPrimaryExpression.eval(Unknown Source)
bsh.BSHAssignment.eval(Unknown Source)
bsh.BSHBlock.evalBlock(Unknown Source)
bsh.BSHBlock.eval(Unknown Source)
bsh.BSHBlock.eval(Unknown Source)
bsh.BSHIfStatement.eval(Unknown Source)
bsh.BSHIfStatement.eval(Unknown Source)
bsh.BSHBlock.evalBlock(Unknown Source)
bsh.BSHBlock.eval(Unknown Source)
bsh.BSHBlock.eval(Unknown Source)
bsh.BSHForStatement.eval(Unknown Source)
bsh.BSHBlock.evalBlock(Unknown Source)
bsh.BSHBlock.eval(Unknown Source)
bsh.BSHBlock.eval(Unknown Source)
bsh.BSHIfStatement.eval(Unknown Source)
bsh.Interpreter.evalParsedScript(Unknown Source)
bsh.Interpreter.evalParsedScript(Unknown Source)
org.ofbiz.base.util.OfbizBshBsfEngine.eval(OfbizBshBsfEngine.java:189)
org.apache.bsf.BSFManager$5.run(BSFManager.java:445)
java.security.AccessController.doPrivileged(Native Method)
org.apache.bsf.BSFManager.eval(BSFManager.java:442)
org.ofbiz.webapp.event.BsfEventHandler.invoke(BsfEventHandler.java:106)
org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:470)
org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:278)
org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:193)
javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:248)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:542)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
java.lang.Thread.run(Thread.java:595)


somebody plz help me out...

thanks in advance,
Sree.
Reply | Threaded
Open this post in threaded view
|

Re: problem in calling a service from bsh

hans_bakker
The fromDate should be an existing value from the data base on the
productPrice record so definitly not the todays Date.

On Sun, 2007-12-16 at 23:56 -0800, shree wrote:

> Hi all,
> I am trying to call a service from a bsh file.
>
> The service is as follows..
>
>
>  <simple-method method-name="updateProductPrice" short-description="Update
> an ProductPrice">
>         <set field="callingMethodName" value="updateProductPrice" />
>         <set field="checkAction" value="UPDATE" />
>         <call-simple-method method-name="checkProductRelatedPermission"
> xml-resource="org/ofbiz/product/product/ProductServices.xml"/>
>         <check-permission permission="PRODUCT_ADMIN"><fail-property
> resource="ProductUiLabels"
> property="ProductPriceMaintPermissionError"/></check-permission>
>         <check-errors/>
>
>         <entity-one entity-name="ProductPrice" value-name="lookedUpValue"/>
>
>         <!-- grab the old price value before setting nonpk parameter fields
> -->
>         <field-to-result map-name="lookedUpValue" field-name="price"
> result-name="oldPrice"/>
>
>         <set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
> <now-timestamp-to-env env-name="nowTimestamp"/>
>         <set field="lookedUpValue.lastModifiedDate"
> from-field="nowTimestamp" />
>         <!--<set field="lookedUpValue.lastModifiedByUserLogin"
> from-field="userLogin.userLoginId" />-->
>
>         <store-value value-name="lookedUpValue"/>
>     </simple-method>
>
> I am calling the service like below...
>
>
> Timestamp currentTimeStamp=new Timestamp(today.getTime());
> parameters.put("productId",productId);
> parameters.put("userLogin",userLogin);
> parameters.put("currencyUomId",currency);
> parameters.put("price",Double.valueOf(price));
> parameters.put("fromDate",currentTimeStamp);
> result=dispatcher.runSync("updateProductPrice",parameters);
>
>
> I am getting the following exception...
>
>
> Exception: java.lang.Exception
> Message: Error in simple-method [Update an ProductPrice
> [file:/C:/ofbiz/ofb/ofb/DEV/1.0.0/ofb/applications/product/script/org/ofbiz/product/price/PriceServices.xml#updateProductPrice]]:
> In set-nonpk-fields a value was not found with the specified valueAcsr:
> lookedUpValue, not setting fields
> ---- stack trace
> ---------------------------------------------------------------
> java.lang.Exception: Error in simple-method [Update an ProductPrice
> [file:/C:/ofbiz/ofb/ofb/DEV/1.0.0/ofb/applications/product/script/org/ofbiz/product/price/PriceServices.xml#updateProductPrice]]:
> In set-nonpk-fields a value was not found with the specified valueAcsr:
> lookedUpValue, not setting fields
> org.ofbiz.entity.transaction.TransactionUtil.setRollbackOnly(TransactionUtil.java:291)
> org.ofbiz.entity.transaction.TransactionUtil.rollback(TransactionUtil.java:238)
> org.ofbiz.minilang.SimpleMethod.exec(SimpleMethod.java:699)
> org.ofbiz.minilang.SimpleMethod.runSimpleMethod(SimpleMethod.java:105)
> org.ofbiz.minilang.SimpleMethod.runSimpleService(SimpleMethod.java:87)
> org.ofbiz.minilang.SimpleServiceEngine.serviceInvoker(SimpleServiceEngine.java:76)
> org.ofbiz.minilang.SimpleServiceEngine.runSync(SimpleServiceEngine.java:51)
> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:335)
> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:210)
> org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136)
> sun.reflect.GeneratedMethodAccessor159.invoke(Unknown Source)
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> java.lang.reflect.Method.invoke(Method.java:585)
> bsh.Reflect.invokeMethod(Unknown Source)
> bsh.Reflect.invokeObjectMethod(Unknown Source)
> bsh.Name.invokeMethod(Unknown Source)
> bsh.BSHMethodInvocation.eval(Unknown Source)
> bsh.BSHPrimaryExpression.eval(Unknown Source)
> bsh.BSHPrimaryExpression.eval(Unknown Source)
> bsh.BSHAssignment.eval(Unknown Source)
> bsh.BSHBlock.evalBlock(Unknown Source)
> bsh.BSHBlock.eval(Unknown Source)
> bsh.BSHBlock.eval(Unknown Source)
> bsh.BSHIfStatement.eval(Unknown Source)
> bsh.BSHIfStatement.eval(Unknown Source)
> bsh.BSHBlock.evalBlock(Unknown Source)
> bsh.BSHBlock.eval(Unknown Source)
> bsh.BSHBlock.eval(Unknown Source)
> bsh.BSHForStatement.eval(Unknown Source)
> bsh.BSHBlock.evalBlock(Unknown Source)
> bsh.BSHBlock.eval(Unknown Source)
> bsh.BSHBlock.eval(Unknown Source)
> bsh.BSHIfStatement.eval(Unknown Source)
> bsh.Interpreter.evalParsedScript(Unknown Source)
> bsh.Interpreter.evalParsedScript(Unknown Source)
> org.ofbiz.base.util.OfbizBshBsfEngine.eval(OfbizBshBsfEngine.java:189)
> org.apache.bsf.BSFManager$5.run(BSFManager.java:445)
> java.security.AccessController.doPrivileged(Native Method)
> org.apache.bsf.BSFManager.eval(BSFManager.java:442)
> org.ofbiz.webapp.event.BsfEventHandler.invoke(BsfEventHandler.java:106)
> org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:470)
> org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:278)
> org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:193)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
> org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:248)
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:542)
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
> java.lang.Thread.run(Thread.java:595)
>
>
> somebody plz help me out...
>
> thanks in advance,
> Sree.
--
http://Antwebsystems.com : OFBiz Quality support for competitive rates.



Reply | Threaded
Open this post in threaded view
|

Re: problem in calling a service from bsh

Scott Gray
Also you need to supply all of the primary key fields of the ProductPrice
entity so that the service can find the ProductPrice that you want to
update.

Regards
Scott

On 17/12/2007, Hans Bakker <[hidden email]> wrote:

>
> The fromDate should be an existing value from the data base on the
> productPrice record so definitly not the todays Date.
>
> On Sun, 2007-12-16 at 23:56 -0800, shree wrote:
> > Hi all,
> > I am trying to call a service from a bsh file.
> >
> > The service is as follows..
> >
> >
> >  <simple-method method-name="updateProductPrice"
> short-description="Update
> > an ProductPrice">
> >         <set field="callingMethodName" value="updateProductPrice" />
> >         <set field="checkAction" value="UPDATE" />
> >         <call-simple-method method-name="checkProductRelatedPermission"
> > xml-resource="org/ofbiz/product/product/ProductServices.xml"/>
> >         <check-permission permission="PRODUCT_ADMIN"><fail-property
> > resource="ProductUiLabels"
> > property="ProductPriceMaintPermissionError"/></check-permission>
> >         <check-errors/>
> >
> >         <entity-one entity-name="ProductPrice"
> value-name="lookedUpValue"/>
> >
> >         <!-- grab the old price value before setting nonpk parameter
> fields
> > -->
> >         <field-to-result map-name="lookedUpValue" field-name="price"
> > result-name="oldPrice"/>
> >
> >         <set-nonpk-fields map-name="parameters"
> value-name="lookedUpValue"/>
> >               <now-timestamp-to-env env-name="nowTimestamp"/>
> >         <set field="lookedUpValue.lastModifiedDate"
> > from-field="nowTimestamp" />
> >         <!--<set field="lookedUpValue.lastModifiedByUserLogin"
> > from-field="userLogin.userLoginId" />-->
> >
> >         <store-value value-name="lookedUpValue"/>
> >     </simple-method>
> >
> > I am calling the service like below...
> >
> >
> > Timestamp currentTimeStamp=new Timestamp(today.getTime());
> > parameters.put("productId",productId);
> > parameters.put("userLogin",userLogin);
> > parameters.put("currencyUomId",currency);
> > parameters.put("price",Double.valueOf(price));
> > parameters.put("fromDate",currentTimeStamp);
> > result=dispatcher.runSync("updateProductPrice",parameters);
> >
> >
> > I am getting the following exception...
> >
> >
> > Exception: java.lang.Exception
> > Message: Error in simple-method [Update an ProductPrice
> >
> [file:/C:/ofbiz/ofb/ofb/DEV/1.0.0/ofb/applications/product/script/org/ofbiz/product/price/PriceServices.xml#updateProductPrice]]:
> > In set-nonpk-fields a value was not found with the specified valueAcsr:
> > lookedUpValue, not setting fields
> > ---- stack trace
> > ---------------------------------------------------------------
> > java.lang.Exception: Error in simple-method [Update an ProductPrice
> >
> [file:/C:/ofbiz/ofb/ofb/DEV/1.0.0/ofb/applications/product/script/org/ofbiz/product/price/PriceServices.xml#updateProductPrice]]:
> > In set-nonpk-fields a value was not found with the specified valueAcsr:
> > lookedUpValue, not setting fields
> > org.ofbiz.entity.transaction.TransactionUtil.setRollbackOnly(
> TransactionUtil.java:291)
> > org.ofbiz.entity.transaction.TransactionUtil.rollback(
> TransactionUtil.java:238)
> > org.ofbiz.minilang.SimpleMethod.exec(SimpleMethod.java:699)
> > org.ofbiz.minilang.SimpleMethod.runSimpleMethod(SimpleMethod.java:105)
> > org.ofbiz.minilang.SimpleMethod.runSimpleService(SimpleMethod.java:87)
> > org.ofbiz.minilang.SimpleServiceEngine.serviceInvoker(
> SimpleServiceEngine.java:76)
> > org.ofbiz.minilang.SimpleServiceEngine.runSync(SimpleServiceEngine.java
> :51)
> > org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:335)
> > org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:210)
> > org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136)
> > sun.reflect.GeneratedMethodAccessor159.invoke(Unknown Source)
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
> > java.lang.reflect.Method.invoke(Method.java:585)
> > bsh.Reflect.invokeMethod(Unknown Source)
> > bsh.Reflect.invokeObjectMethod(Unknown Source)
> > bsh.Name.invokeMethod(Unknown Source)
> > bsh.BSHMethodInvocation.eval(Unknown Source)
> > bsh.BSHPrimaryExpression.eval(Unknown Source)
> > bsh.BSHPrimaryExpression.eval(Unknown Source)
> > bsh.BSHAssignment.eval(Unknown Source)
> > bsh.BSHBlock.evalBlock(Unknown Source)
> > bsh.BSHBlock.eval(Unknown Source)
> > bsh.BSHBlock.eval(Unknown Source)
> > bsh.BSHIfStatement.eval(Unknown Source)
> > bsh.BSHIfStatement.eval(Unknown Source)
> > bsh.BSHBlock.evalBlock(Unknown Source)
> > bsh.BSHBlock.eval(Unknown Source)
> > bsh.BSHBlock.eval(Unknown Source)
> > bsh.BSHForStatement.eval(Unknown Source)
> > bsh.BSHBlock.evalBlock(Unknown Source)
> > bsh.BSHBlock.eval(Unknown Source)
> > bsh.BSHBlock.eval(Unknown Source)
> > bsh.BSHIfStatement.eval(Unknown Source)
> > bsh.Interpreter.evalParsedScript(Unknown Source)
> > bsh.Interpreter.evalParsedScript(Unknown Source)
> > org.ofbiz.base.util.OfbizBshBsfEngine.eval(OfbizBshBsfEngine.java:189)
> > org.apache.bsf.BSFManager$5.run(BSFManager.java:445)
> > java.security.AccessController.doPrivileged(Native Method)
> > org.apache.bsf.BSFManager.eval(BSFManager.java:442)
> > org.ofbiz.webapp.event.BsfEventHandler.invoke(BsfEventHandler.java:106)
> > org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java
> :470)
> > org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java
> :278)
> > org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:193)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:269)
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java:188)
> > org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:248)
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:215)
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java:188)
> > org.apache.catalina.core.StandardWrapperValve.invoke(
> StandardWrapperValve.java:210)
> > org.apache.catalina.core.StandardContextValve.invoke(
> StandardContextValve.java:174)
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
> :127)
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
> :117)
> > org.apache.catalina.core.StandardEngineValve.invoke(
> StandardEngineValve.java:108)
> > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java
> :542)
> > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java
> :151)
> > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
> :870)
> >
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection
> (Http11BaseProtocol.java:665)
> > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(
> PoolTcpEndpoint.java:528)
> > org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
> LeaderFollowerWorkerThread.java:81)
> > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> ThreadPool.java:685)
> > java.lang.Thread.run(Thread.java:595)
> >
> >
> > somebody plz help me out...
> >
> > thanks in advance,
> > Sree.
> --
> http://Antwebsystems.com : OFBiz Quality support for competitive rates.
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: problem in calling a service from bsh

santosh malviya
In reply to this post by shree-3
Since you are supplying userLogin in service and in simple method userLogin
field is commented thats why it is giving excepion.

On Dec 17, 2007 1:26 PM, shree <[hidden email]> wrote:

>
> Hi all,
> I am trying to call a service from a bsh file.
>
> The service is as follows..
>
>
>  <simple-method method-name="updateProductPrice" short-description="Update
> an ProductPrice">
>        <set field="callingMethodName" value="updateProductPrice" />
>        <set field="checkAction" value="UPDATE" />
>        <call-simple-method method-name="checkProductRelatedPermission"
> xml-resource="org/ofbiz/product/product/ProductServices.xml"/>
>        <check-permission permission="PRODUCT_ADMIN"><fail-property
> resource="ProductUiLabels"
> property="ProductPriceMaintPermissionError"/></check-permission>
>        <check-errors/>
>
>        <entity-one entity-name="ProductPrice" value-name="lookedUpValue"/>
>
>        <!-- grab the old price value before setting nonpk parameter fields
> -->
>        <field-to-result map-name="lookedUpValue" field-name="price"
> result-name="oldPrice"/>
>
>        <set-nonpk-fields map-name="parameters"
> value-name="lookedUpValue"/>
>                <now-timestamp-to-env env-name="nowTimestamp"/>
>        <set field="lookedUpValue.lastModifiedDate"
> from-field="nowTimestamp" />
>        <!--<set field="lookedUpValue.lastModifiedByUserLogin"
> from-field="userLogin.userLoginId" />-->
>
>        <store-value value-name="lookedUpValue"/>
>    </simple-method>
>
> I am calling the service like below...
>
>
> Timestamp currentTimeStamp=new Timestamp(today.getTime());
> parameters.put("productId",productId);
> parameters.put("userLogin",userLogin);
> parameters.put("currencyUomId",currency);
> parameters.put("price",Double.valueOf(price));
> parameters.put("fromDate",currentTimeStamp);
> result=dispatcher.runSync("updateProductPrice",parameters);
>
>
> I am getting the following exception...
>
>
> Exception: java.lang.Exception
> Message: Error in simple-method [Update an ProductPrice
>
> [file:/C:/ofbiz/ofb/ofb/DEV/1.0.0/ofb/applications/product/script/org/ofbiz/product/price/PriceServices.xml#updateProductPrice]]:
> In set-nonpk-fields a value was not found with the specified valueAcsr:
> lookedUpValue, not setting fields
> ---- stack trace
> ---------------------------------------------------------------
> java.lang.Exception: Error in simple-method [Update an ProductPrice
>
> [file:/C:/ofbiz/ofb/ofb/DEV/1.0.0/ofb/applications/product/script/org/ofbiz/product/price/PriceServices.xml#updateProductPrice]]:
> In set-nonpk-fields a value was not found with the specified valueAcsr:
> lookedUpValue, not setting fields
> org.ofbiz.entity.transaction.TransactionUtil.setRollbackOnly(
> TransactionUtil.java:291)
> org.ofbiz.entity.transaction.TransactionUtil.rollback(TransactionUtil.java
> :238)
> org.ofbiz.minilang.SimpleMethod.exec(SimpleMethod.java:699)
> org.ofbiz.minilang.SimpleMethod.runSimpleMethod(SimpleMethod.java:105)
> org.ofbiz.minilang.SimpleMethod.runSimpleService(SimpleMethod.java:87)
> org.ofbiz.minilang.SimpleServiceEngine.serviceInvoker(
> SimpleServiceEngine.java:76)
> org.ofbiz.minilang.SimpleServiceEngine.runSync(SimpleServiceEngine.java
> :51)
> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:335)
> org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:210)
> org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136)
> sun.reflect.GeneratedMethodAccessor159.invoke(Unknown Source)
> sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
> java.lang.reflect.Method.invoke(Method.java:585)
> bsh.Reflect.invokeMethod(Unknown Source)
> bsh.Reflect.invokeObjectMethod(Unknown Source)
> bsh.Name.invokeMethod(Unknown Source)
> bsh.BSHMethodInvocation.eval(Unknown Source)
> bsh.BSHPrimaryExpression.eval(Unknown Source)
> bsh.BSHPrimaryExpression.eval(Unknown Source)
> bsh.BSHAssignment.eval(Unknown Source)
> bsh.BSHBlock.evalBlock(Unknown Source)
> bsh.BSHBlock.eval(Unknown Source)
> bsh.BSHBlock.eval(Unknown Source)
> bsh.BSHIfStatement.eval(Unknown Source)
> bsh.BSHIfStatement.eval(Unknown Source)
> bsh.BSHBlock.evalBlock(Unknown Source)
> bsh.BSHBlock.eval(Unknown Source)
> bsh.BSHBlock.eval(Unknown Source)
> bsh.BSHForStatement.eval(Unknown Source)
> bsh.BSHBlock.evalBlock(Unknown Source)
> bsh.BSHBlock.eval(Unknown Source)
> bsh.BSHBlock.eval(Unknown Source)
> bsh.BSHIfStatement.eval(Unknown Source)
> bsh.Interpreter.evalParsedScript(Unknown Source)
> bsh.Interpreter.evalParsedScript(Unknown Source)
> org.ofbiz.base.util.OfbizBshBsfEngine.eval(OfbizBshBsfEngine.java:189)
> org.apache.bsf.BSFManager$5.run(BSFManager.java:445)
> java.security.AccessController.doPrivileged(Native Method)
> org.apache.bsf.BSFManager.eval(BSFManager.java:442)
> org.ofbiz.webapp.event.BsfEventHandler.invoke(BsfEventHandler.java:106)
> org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:470)
> org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:278)
> org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:193)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:269)
> org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java:188)
> org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:248)
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:215)
> org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java:188)
> org.apache.catalina.core.StandardWrapperValve.invoke(
> StandardWrapperValve.java:210)
> org.apache.catalina.core.StandardContextValve.invoke(
> StandardContextValve.java:174)
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
> :127)
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
> :117)
> org.apache.catalina.core.StandardEngineValve.invoke(
> StandardEngineValve.java:108)
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:542)
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java
> :151)
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
>
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection
> (Http11BaseProtocol.java:665)
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(
> PoolTcpEndpoint.java:528)
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
> LeaderFollowerWorkerThread.java:81)
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> ThreadPool.java:685)
> java.lang.Thread.run(Thread.java:595)
>
>
> somebody plz help me out...
>
> thanks in advance,
> Sree.
> --
> View this message in context:
> http://www.nabble.com/problem-in-calling-a-service-from-bsh-tp14370129p14370129.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
>
Reply | Threaded
Open this post in threaded view
|

Re: problem in calling a service from bsh

Pranay Pandey
yes definitely "fromDate" must be an existing value from the database not
the currentTimeStamp and removing the cmment from  <!--<set field="
lookedUpValue.lastModifiedByUserLogin"
from-field="userLogin.userLoginId" />--> should work.


On Dec 17, 2007 7:06 PM, santosh malviya <[hidden email]> wrote:

> Since you are supplying userLogin in service and in simple method
> userLogin
> field is commented thats why it is giving excepion.
>
> On Dec 17, 2007 1:26 PM, shree <[hidden email]> wrote:
>
> >
> > Hi all,
> > I am trying to call a service from a bsh file.
> >
> > The service is as follows..
> >
> >
> >  <simple-method method-name="updateProductPrice"
> short-description="Update
> > an ProductPrice">
> >        <set field="callingMethodName" value="updateProductPrice" />
> >        <set field="checkAction" value="UPDATE" />
> >        <call-simple-method method-name="checkProductRelatedPermission"
> > xml-resource="org/ofbiz/product/product/ProductServices.xml"/>
> >        <check-permission permission="PRODUCT_ADMIN"><fail-property
> > resource="ProductUiLabels"
> > property="ProductPriceMaintPermissionError"/></check-permission>
> >        <check-errors/>
> >
> >        <entity-one entity-name="ProductPrice"
> value-name="lookedUpValue"/>
> >
> >        <!-- grab the old price value before setting nonpk parameter
> fields
> > -->
> >        <field-to-result map-name="lookedUpValue" field-name="price"
> > result-name="oldPrice"/>
> >
> >        <set-nonpk-fields map-name="parameters"
> > value-name="lookedUpValue"/>
> >                <now-timestamp-to-env env-name="nowTimestamp"/>
> >        <set field="lookedUpValue.lastModifiedDate"
> > from-field="nowTimestamp" />
> >        <!--<set field="lookedUpValue.lastModifiedByUserLogin"
> > from-field="userLogin.userLoginId" />-->
> >
> >        <store-value value-name="lookedUpValue"/>
> >    </simple-method>
> >
> > I am calling the service like below...
> >
> >
> > Timestamp currentTimeStamp=new Timestamp(today.getTime());
> > parameters.put("productId",productId);
> > parameters.put("userLogin",userLogin);
> > parameters.put("currencyUomId",currency);
> > parameters.put("price",Double.valueOf(price));
> > parameters.put("fromDate",currentTimeStamp);
> > result=dispatcher.runSync("updateProductPrice",parameters);
> >
> >
> > I am getting the following exception...
> >
> >
> > Exception: java.lang.Exception
> > Message: Error in simple-method [Update an ProductPrice
> >
> >
> [file:/C:/ofbiz/ofb/ofb/DEV/1.0.0/ofb/applications/product/script/org/ofbiz/product/price/PriceServices.xml#updateProductPrice]]:
> > In set-nonpk-fields a value was not found with the specified valueAcsr:
> > lookedUpValue, not setting fields
> > ---- stack trace
> > ---------------------------------------------------------------
> > java.lang.Exception: Error in simple-method [Update an ProductPrice
> >
> >
> [file:/C:/ofbiz/ofb/ofb/DEV/1.0.0/ofb/applications/product/script/org/ofbiz/product/price/PriceServices.xml#updateProductPrice]]:
> > In set-nonpk-fields a value was not found with the specified valueAcsr:
> > lookedUpValue, not setting fields
> > org.ofbiz.entity.transaction.TransactionUtil.setRollbackOnly(
> > TransactionUtil.java:291)
> > org.ofbiz.entity.transaction.TransactionUtil.rollback(
> TransactionUtil.java
> > :238)
> > org.ofbiz.minilang.SimpleMethod.exec(SimpleMethod.java:699)
> > org.ofbiz.minilang.SimpleMethod.runSimpleMethod(SimpleMethod.java:105)
> > org.ofbiz.minilang.SimpleMethod.runSimpleService(SimpleMethod.java:87)
> > org.ofbiz.minilang.SimpleServiceEngine.serviceInvoker(
> > SimpleServiceEngine.java:76)
> > org.ofbiz.minilang.SimpleServiceEngine.runSync(SimpleServiceEngine.java
> > :51)
> > org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:335)
> > org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:210)
> > org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136)
> > sun.reflect.GeneratedMethodAccessor159.invoke(Unknown Source)
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(
> > DelegatingMethodAccessorImpl.java:25)
> > java.lang.reflect.Method.invoke(Method.java:585)
> > bsh.Reflect.invokeMethod(Unknown Source)
> > bsh.Reflect.invokeObjectMethod(Unknown Source)
> > bsh.Name.invokeMethod(Unknown Source)
> > bsh.BSHMethodInvocation.eval(Unknown Source)
> > bsh.BSHPrimaryExpression.eval(Unknown Source)
> > bsh.BSHPrimaryExpression.eval(Unknown Source)
> > bsh.BSHAssignment.eval(Unknown Source)
> > bsh.BSHBlock.evalBlock(Unknown Source)
> > bsh.BSHBlock.eval(Unknown Source)
> > bsh.BSHBlock.eval(Unknown Source)
> > bsh.BSHIfStatement.eval(Unknown Source)
> > bsh.BSHIfStatement.eval(Unknown Source)
> > bsh.BSHBlock.evalBlock(Unknown Source)
> > bsh.BSHBlock.eval(Unknown Source)
> > bsh.BSHBlock.eval(Unknown Source)
> > bsh.BSHForStatement.eval(Unknown Source)
> > bsh.BSHBlock.evalBlock(Unknown Source)
> > bsh.BSHBlock.eval(Unknown Source)
> > bsh.BSHBlock.eval(Unknown Source)
> > bsh.BSHIfStatement.eval(Unknown Source)
> > bsh.Interpreter.evalParsedScript(Unknown Source)
> > bsh.Interpreter.evalParsedScript(Unknown Source)
> > org.ofbiz.base.util.OfbizBshBsfEngine.eval(OfbizBshBsfEngine.java:189)
> > org.apache.bsf.BSFManager$5.run(BSFManager.java:445)
> > java.security.AccessController.doPrivileged(Native Method)
> > org.apache.bsf.BSFManager.eval(BSFManager.java:442)
> > org.ofbiz.webapp.event.BsfEventHandler.invoke(BsfEventHandler.java:106)
> > org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java
> :470)
> > org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java
> :278)
> > org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:193)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> > ApplicationFilterChain.java:269)
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(
> > ApplicationFilterChain.java:188)
> > org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:248)
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> > ApplicationFilterChain.java:215)
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(
> > ApplicationFilterChain.java:188)
> > org.apache.catalina.core.StandardWrapperValve.invoke(
> > StandardWrapperValve.java:210)
> > org.apache.catalina.core.StandardContextValve.invoke(
> > StandardContextValve.java:174)
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
> > :127)
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
> > :117)
> > org.apache.catalina.core.StandardEngineValve.invoke(
> > StandardEngineValve.java:108)
> > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java
> :542)
> > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java
> > :151)
> > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
> :870)
> >
> >
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection
> > (Http11BaseProtocol.java:665)
> > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(
> > PoolTcpEndpoint.java:528)
> > org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
> > LeaderFollowerWorkerThread.java:81)
> > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> > ThreadPool.java:685)
> > java.lang.Thread.run(Thread.java:595)
> >
> >
> > somebody plz help me out...
> >
> > thanks in advance,
> > Sree.
> > --
> > View this message in context:
> >
> http://www.nabble.com/problem-in-calling-a-service-from-bsh-tp14370129p14370129.html
> > Sent from the OFBiz - User mailing list archive at Nabble.com.
> >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: problem in calling a service from bsh

shree-3
In reply to this post by shree-3

You are exactly correct Hansbak.
I passed the fromDate value from the database...It worked for me.

Thank you very much all.
have a great day..........
sree.