BHOLD: ScriptProcessor.ExecuteScript Fails for roleAddUser Function When Using bscript.dll


  • Hi all,

    I am trying out running BHOLD scripts, just simple stuff like adding a user to a role.  I am using bscript.dll managed assembly instead of the .asmx web service.  Reason being, the way the applicaiton is structured, I cannot directly reference the web service for some reason and have to work around this by having a separate console application that calls the service (not preferred).

    My script string looks like this (I hardcoded the ids for simplicity):

    string sc = "<functions><function name='roleadduser' roleid='17' userid='11' /></functions>";

    When I try to run it (ScriptProcessor.ExecuteScript(sc)), it fails with the following error (no matter what I do with the string):

    FuncName: roleadduser
    Function: <function name="roleadduser" roleid="17" userid="11" />
    5_Error converting data type nvarchar to int.

    BUT (!!!) This exact same call works fine if I use the web service.  Makes me think that something is messed up inside the ScriptProcessor class.

    Has anyone encountered this kind of behavior before?

    Thank you!

    2013년 6월 24일 월요일 오후 8:55

모든 응답

  • Dont know if you have found something already, but I used this piece of code, which works fine... the only difference might be the call to InitializeByAlias (or the Initialize), to set the acting user. Via the webservice, this is managed by the browser since the browser sends across some user information (Windows Authentication).

    You also don't have roles and or users with a name containing an ID-value like 17or 11? BHOLD needs a special prefix in these cases, to treat these values as string-values. Because roleid="XXX" might also contain a Role-Name, upon which BHOLD will look up its ID-value.

    using bscript;
    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    namespace BHOLDScriptProcessorTest
        class Program
            static void Main(string[] args)
                ScriptProcessor sp = new ScriptProcessor();
                sp.InitializeByAlias("Administrator", "B1");
                sp.ExecuteScript("<functions><function name='roleadduser' roleid='1013' userid='9' /></functions>");

    Kind regards,

    Henrik de Jong

    Core Developer of the BHOLD software

    2013년 7월 23일 화요일 오전 7:13