Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Null parameters passed to DMI serverMethod

    So we've been chugging along pretty good with JavaScript datasources, but I've been investigating using the Java backend for the datasources as well. So I've taken a working Javascript datasource and made an XML datasource, put the IDACall servlet in our web.xml and am at the point where it is calling the specified method per the serverMethod attribute in the datasource. I've configured the DSto send the servletRequest and servletResponse to that method. However, when getting to the method those two parameters are null, and I don't know why.

    Here is the xml datasource:

    <DataSource
    ID="chartOfAccountsTreeViewDS"
    serverType="generic">

    <operationBindings>
    <binding
    operationType="fetch"
    recordXPath="//FinancialInterfaceAccountPojo"
    serverMethod="getChartOfAccountsSC"
    methodArguments="$servletRequest, $servletResponse">

    <serverObject
    lookupStyle="new"
    className="net.intraflex.financial.service.FinancialInterfaceService"/>
    </binding>
    </operationBindings>

    <fields>
    <field name="Id" primaryKey="true" />
    <field name="ParentId"/>
    <field name="Name" type="text" title="Name"/>
    <field name="Description" type="text" title="Description"/>
    </fields>

    </DataSource>


    The java method:

    public static List getChartOfAccountsSC(
    HttpServletRequest req, HttpServletResponse resp) {

    RequestManager sd = RequestManager.getInstance(req, resp);
    FinancialInterfaceLogic fiLogic = FinancialInterfaceLogicFactory.getInstance().getFinancialInterfaceLogic(sd.getLoginRole());

    List accounts = null;
    accounts.addAll(fiLogic.getChartOfAccounts());

    return accounts;
    }


    If I put a break at the RequestManager sd = ... line I can see that both the req and resp parameters are null. Any ideas where I've gone wrong?

    #2
    Hi jjohns,

    In this particular case you don't need a "methodArguments" declaration because they will be matched by type. However, in case you do need to specify methodArguments in the future, the correct names for the servletRequest and servletResponse arguments are actually just "request" and "response" - sorry the doc is incorrect on this point.

    Comment

    Working...
    X