-->
Recently I had to change, increase rather the length of a string variable in a service constituting Table. Simple thing huh. I created a new string EDT with more length and attached to the string field. My Import Utility (AIF) for Items (Products) failed with the data length error.

Invalid document schema. The following error was returned:  The 'http://schemas.microsoft.com/dynamics/2008/01/documents/TableName:FieldName' element is invalid - The value 'sample value provided by API consumer' is invalid according to its datatype 'http://schemas.microsoft.com/dynamics/2008/01/sharedtypes:AxdExtType_SomeDefaultEDTName' - The actual length is greater than the MaxLength value. The actual length is greater than the MaxLength value.

Actually the document schema was mentioning the same old data type. I was quite sure there must be an automated way to refresh the xml schema of the related document.There is one, under Tools > AIF > Update Document Service (from IDE). This opens the 'Update document service' form



In my case however, it created some new classes, new Ax<Table> classes. Then I refreshed AIF Services from AOT > Forms > AifService (form).


One more thing to mention is that the new classes had bugs in them, specifically in the methods that were dealing with the cacheObject classes. Their bodies were commented for developer to write desired implementation. But this was totally out of scope for me, I removed those methods. All fine, incremental CIL generated. AIF refreshed, hit my utility > Import, same old jeopardizing error :(

The schema was same old, same old shared type referenced :S. I realized that Ax<Table> class is wrapping the table, lets see there :) Yes there it is, the parm method referring to the field i changed.


public fieldEDT parmField(fieldEDT _fieldEDT = '')
{
    if (!prmisDefault(_searchName))
    {
        this.setField(fieldNum(TableName, FieldName), _fieldEDT);
    }

    return tableBuffer.FieldName;
}

Solution

Actually this class wraps the table, and this class and its methods and meta data are used to create and refresh Document Schema. If you have to add a new field in your web service, you may add / modify the parm methods in the particular Ax<Table> class.

The BUG

Refreshing through Update Document Schema added new Ax<Table> classes. However, in the respective Axd<Table> class class method (), they were not mentioned in any case. This resulted in following error;
This document does not support the AxEcoResProductIdentifier class.
I am quite sure it was the update document schema > 'Regenerate data object classes' process bug, it should have made respective case scenarios and initialized relevant Ax<Table> classes. See below illustration

top