AX 2012: Client sessions connected to AOS server

System administrators often need to know how many AX client sessions are connected to AOS server for multiple reasons:

1. View all the existing client sessions to AOS server
2. End existing client sessions to AOS server
3. Reject new client sessions
4. Accept new client sessions

To perform such jobs, navigate to System administration >> Common >> Users >> Online users

Client sessions tab:

1. Clicking End sessions terminates selected sessions in the grid
2. Online users show connected users to AOS server.

Untitled

Server instances tab:

1. Clicking Reject new clients rejects any new connections requested to AOS server
2. Clicking Accept new clients allows users to establish client connections to AOS server

Untitled

Further, we can also see existing server sessions to AOS server by querying SQL table SysServerSessions in which active sessions are identified by 1 in Status field:

Untitled

Advertisements

AX 2012: Creating enhanced inbound port

Prerequisites:

1. Full compile has been performed revealing no errors
2. Full CIL has been performed successfully
3. Incremental CIL has been performed after compiling the new service class


To create an enhanced inbound port for your custom service, please follow the steps below:

1. Right click on the service node, CustomerService in this case, and click Add-Ins > Register service
2. This opens AIF services dialog where you can search for your newly created service port in the list
3. Open Application workspace and navigate to:

  • System Administration > Setup > Services and Application Integration Framework > Inbound ports

4. Click New button
5. Give name and description of the port. In this case CustomerServices

Untitled

6. Click Service operations

Untitled

7. Move your service operations towards left pane
8. Click Activate

Untitled

AX 2012: Creating parm methods automatically

It is often a tedious task to create parm methods for a class having many data members. Use the following AOT job to create parm methods automatically instantaneously! All you need to do is to declare data members in the class declaration. Make sure the data type and variable is separated by a single space character. Then replace the name of your class in the job script and finally run job! You can download the xpo file below:

static void createParmMethod(Args _args)
{
    #AOT

    ClassName className = classStr(MyClass);

    TreeNode classDeclarationTreeNode;
    TreeNode classTreeNode;
    TreeNode parmMethodNode;

    Source classDeclaration;

    System.Text.RegularExpressions.MatchCollection mcVariables;
    System.Text.RegularExpressions.Match mVariable;
    int matchCount;
    int matchIdx;

    System.Text.RegularExpressions.GroupCollection gcVariableDeclaration;
    System.Text.RegularExpressions.Group gVariableDeclarationPart;

    str variableType;
    str variableName;

    str pattern = ' (?[a-zA-Z0-9_]+) (?[a-zA-Z0-9_]+);';

    Source parmMethodBody;

    classTreeNode = TreeNode::findNode(strFmt(@"%1\%2", #ClassesPath, className));

    classDeclarationTreeNode = TreeNode::findNode(
        strFmt(@"%1\%2\ClassDeclaration",
        #ClassesPath,
        className));

    classDeclaration = classDeclarationTreeNode.AOTgetSource();

    mcVariables = System.Text.RegularExpressions.Regex::Matches(
        classDeclaration,
        pattern,
        System.Text.RegularExpressions.RegexOptions::Singleline);
    matchCount = CLRInterop::getAnyTypeForObject(mcVariables.get_Count());

    for (matchIdx = 0; matchIdx < matchCount; matchIdx++)
    {
        mVariable = mcVariables.get_Item(matchIdx);
        gcVariableDeclaration = mVariable.get_Groups();

        gVariableDeclarationPart = gcVariableDeclaration.get_Item('VarType');
        variableType = gVariableDeclarationPart.get_Value();

        gVariableDeclarationPart = gcVariableDeclaration.get_Item('VarName');
        variableName = gVariableDeclarationPart.get_Value();

        parmMethodBody = new xppSource().parmMethod(variableType, variableName);

        parmMethodNode = classTreeNode.AOTadd('method1');
        parmMethodNode.AOTsetSource(parmMethodBody);
        classTreeNode.AOTsave();
    }

    classTreeNode.AOTcompile();
}

Download the XPO:


Read the full post here by Sasha Nazarov.