running an authenticated service from beanshell service via telnet

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

running an authenticated service from beanshell service via telnet

snowch
I want to run a service that requires authenication by telnetting into 9990.  The bsh I am trying to run is below.  The error I am receiving is: org.ofbiz.service.ServiceAuthException: You do not have permission to invoke the service [dhalesCheckUpliftPermission]

Is it possible to run a service that requires authentication from beanshell telnet service on 9990?

import java.util.*;
import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.service.*;
import org.ofbiz.service.GenericDispatcher;
import org.ofbiz.base.util.*;
import org.ofbiz.entity.util.*;
import org.ofbiz.security.*;

ofbSecurity = new OFBizSecurity();
delegator = GenericDelegator.getGenericDelegator("default");
dispatcher = GenericDispatcher.getLocalDispatcher("dhales", delegator);

userLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", "admin"));
Map serviceCtx = UtilMisc.toMap("UpliftNumber", 70001, "userLogin", userLogin);

try{
        resultMap = dispatcher.runSync("dhalesCheckUpliftPermission", serviceCtx);
}catch(GenericServiceException e){
        print(e);
}

print(resultMap);