› Dynamics AX › Configure Inbound Port in AX 2012 to handle Bigger size XML coming inside via AIF

Configure Inbound Port in AX 2012 to handle Bigger size XML coming inside via AIF

 Leave a comment

1. The maximum size of the XML message that AX can receive is 64kb. In order to accept the XML of bigger size, we have to configure the Inbound port.

 

2. The web.config is created from the configuration of the inbound port. So, in order to preserve the changes even if the Inbound port gets reactivated, please make the changes as detailed below [Please refer to the below snapshots for your information]

a. Go to the Inbound port.

b. De-Activate the inbound port.

c. Click on “Configure” button as shown below [A pop up window will come]

d. Click “Yes” on the window popped up[Find below the snapshot of the popped up window]

e. Now go to Bindings basicHttpBindingWithWindowsAuth as highlighted in the below snapshot.

f. Now set the size of the property “MaxReceivedMessageSize” to a bigger value(like: 10485760).

g. Save the changes and close the form.

h. Click on Activate button to activate the Inbound port.

i. Check the Web Config file from the above file location and verify the value that was set in the previous “step-f”.

X++ code to fetch the data from Excel in AX 2012R2

I have come across the requirement to fetch the data from Excel in AX.
Below is the X++ code to do the same:

static void ImportDataFromExcel(Args _args)
{
    SysExcelApplication application;
    SysExcelWorkbooks workbooks;
    SysExcelWorkbook workbook;
    SysExcelWorksheets worksheets;
    SysExcelWorksheet worksheet;
    SysExcelCells cells;
    COMVariantType type;
    int row;
    ItemId itemid;
    Name name;
    FilenameOpen                    filename;
    dialogField                     dialogFilename;
    Dialog                          dialog;

    ;
    #AviFiles
    #Excel
    application = SysExcelApplication::construct();
    workbooks = application.workbooks();
 
    dialog = new Dialog("ExcelUpload");
    dialogFilename      =   dialog.addField(extendedTypeStr(FilenameOpen));
    dialog.filenameLookupFilter(["@SYS28576",#XLS, "@SYS28576",#XLSX]);
    dialog.filenameLookupTitle("Upload from Excel");
    dialog.caption("Excel Upload");
    dialogFilename.value(filename);

    if(!dialog.run())
        return;


    filename            =   dialogFilename.value();
    application         =   SysExcelApplication::construct();
    workbooks           =   application.workbooks();
    try
    {
    workbooks.open(filename);
    }
    catch (Exception::Error)
    {
    throw error("File cannot be opened.");
    }

    workbook = workbooks.item(1);
    worksheets = workbook.worksheets();
    worksheet = worksheets.itemFromNum(1);
    cells = worksheet.cells();
 
 do
{
row++;
itemId = cells.item(row, 1).value().bStr();
type = cells.item(row, 1).value().variantType();
info(strfmt('%1', itemId));
}
while (type != COMVariantType::VT_EMPTY);
}

Liked it? Share it.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.