Skip to Content
0
Aug 30, 2012 at 09:24 AM

Supplied userRef is not a valid UserBOHandle

33 Views

Hi,

I am using SDK 2.1 to create a custom web service.

When running the web-service I get the following faultstring "Supplied userRef is not a valid UserBOHandle"

and when debugging it is the function RunAsServiceLocator that throws the exception.

My code snippet looks like this:

ShopOrderBasicConfiguration soBasic = null;
ResourceBasicConfiguration reBasic = null;
try {
String user = wsContext.getUserPrincipal().getName();

if ((null == site)||"".equals(site)) {
SimpleLogger.log(Severity.ERROR,Category.SYS_SERVER, loc,
"MESDK:setupResource WebService:Exception Set Resource", "No Site defined in request");
}


//Find Shop Order object. Use Service locator to run using a specific user and site
ServiceReference serviceRef = new ServiceReference(COM_SAP_ME_DEMAND, SHOPORDER_SERVICE);
RunAsServiceLocator serviceLocator = new RunAsServiceLocator(user, site, null);
soService = serviceLocator.getService(serviceRef, ShopOrderServiceInterface.class);
FindShopOrderByKeyFieldsRequest soKeyReq = new FindShopOrderByKeyFieldsRequest(shopOrder);
soBasic = soService.findShopOrderByKeyFields(soKeyReq);

How can I change the user to be a valid UserRef?

Br,

Johan