Wednesday, February 19, 2014

WinAPI::ShellExecute() for a JAR file for Banking application

Recently came across a scenario where a banking a hash program needs to be called to encrypt a payment file before sending to the Bank. The bank had just changed the hashing program from an .exe file to a .cmd, this file inturn was a batch script file which would validate and then call a JAR file with the appropriate parameters.
Issue:- While executing the .cmd file from the Command prompt the JAR file runs and hashes the file correctly, but when we use the Dynamics AX to call the .cmd file the JAR file is not executed. The command used was WINAPI::ShellExecute(Command, Parameters);

Investigation :- After preliminary checking from both the AX and command prompt we guessed that the .cmd file was not being executed due to a failure in the calling mechanism. We tried different approaches by calling the cmd.exe and then pass the parameters to mimick the manual approach. But somehow the command prompt opened up but did not execute the JAR file. Then next approach was to add all the commands inside a batch script file which would call the JAR file, so from AX we wouldn't need to specify the details in AX but would just call the batch script file. Still the execution of JAR file from AX was not happening even though we could execute the file manually.
After a lots of Google searches on the execution environment with ample trial and error my colleague identified that the issue was due to JRE execution is the root cause. Meaning that Dynamics AX looks for the Java Runtime under the 32 bit folder(under C:\Program Files (x86)\Java\bin) instead of the 64 bit installed in Windows server 2012 machine. This could be because of the legacy run time approach followed since the older versions executing the JAR files.

Install the 32 bit Java runtime on the server.

AX job would look something like this to call the WINAPI::ShellExecute(command); where the command = @D:\TestScript.bat

And test script  batch file will have,
CD D:\HashFile\
D:\HashFile\HashProgram.cmd parm1 parm2 parm3 parmx....
Another thing to note is to link the batch file to the folder using CD D:\HashFile\ before executing the .cmd file. To point to the correct execution folder before running the command.

Add on:- For those who are trying to execute exe as a process from X++, do find an excellent post from Bo Jensen at his blog post - X++ run a process with user credentials

Thursday, February 13, 2014

Publish-AXReport : SSRS Deployment Error 'Domain/User' is not recognized

I faced this issue during deployment of all the default SSRS report when I was migrating the application from Development environment to UAT. The issue occurs due the previous AOS sessions that are present in the Table SysServerSessions table. This table will not be listed in the AOT and you will be able to access this table for viewing the records from SQL management studio, alternatively you can also create a dummy form and access the table from datasource.

There is no problem in deleting the records in this table as the records are automatically inserted by the AOS when AOS service starts up. 

Conclusion:- Turn off the AOS and clear the records from SysServerSessions table. Republish the SSRS reports it'll publish correctly.

Wednesday, February 12, 2014

Report Deployment Error - Value cannot be null. Parameter name : explicitConfiguration

Today faced an SSRS error when deploying on of the reports in our client environment on AX 2012 R2 CU6

The error is exactly similiar to the issue described in this blog. Please refer for the error event log and the detailed description about the WCF service artifacts failure.

Conclusion: Fix the endpoint or deactivate the failed service group and re-try the report deployment again.

Dynamics AX 2012 R3 Training Blitz

Dynamics AX 2012 R3 is just around the corner, and is planned for GA by May 2014.

There some initiatives from the Microsoft Product team for familiarizing the product before GA. Some of the avenues are Technical & Product Conferences and Microsoft Connect for CTP. Recently there are some very public R3 Training Blitz webcasts for showcasing what can be expected in the new release. The webcasts are free and can be joined by everyone, during the conference the team diligently answers the questions from the viewers. Also the first webcast for the R3 is recorded and out on the Youtube which is a great way to reach out to all those who would have missed it.

The second sessions are planned for Feb 26 and Feb 27, please do join in as it has specific segments for the verticals including Retail & Manufacturing. I am very interested and keen to know the new things that are being implemented in the R3 Retail after seeing some of the significant changes in the CTP sessions.
Here is the link for you to join the Dynamics AX virtual events, do signup and enjoy the sessions.

Just incase if you have missed the Part 1 of the Traning blitz webcast, catch it on Youtube here.