AIF document service through the wizard (in AX). The service is meant for
creation of a ProductionOrder. It is built on a query on the ProdTable and
InventDim tables. It has ‘create’ and ‘read’ operations. The following is the
screenshot of the list of classes generated and below is their descriptions:
AxProdTable - The class that represents the table ProdTable
AxInventDim_ProdTable - The class that represents the table InventDim
AxdProductionOrder2 – Document Class
ProductionOrder2 – Data Object class (the class that serializes/deserializes XML data for usage in the form of a object)
ProductionOrder2Service – the service class (which has ‘create’ and ‘read’ methods apart from others)
Its successfully deployed it as a web service on IIS and able to add it as a service reference in a C# application. able to use the classes from AX (the service classes that are generated in AX on creation of the service)
following necessary code in C# to call the service and make use of the ‘create’ operation exposed by the service.
System.ServiceModel.FaultException`1[fin alProdOrder.AifReference.AifFault]:Reque st
Failed.
In AX (AIF), within Basic->Periodic->Application Integration Framework->Exceptions, the following is the exception:
Number sequence for the reference Lot ID in parameters in the Inventory management module has not been set up.
(P.S - From what to understand, this service is created on a query based on the ProdTable and InventDim tables. So, by creation of the production order, it is creation of a record in ProdTable, and not creation of a row in ProductionOrder form). The new record is being created without this “number sequence issue”. The number sequence for LotID is being generated successfully. But, the exception is showing up when we try to insert the record through the AIF service.
If trying to modify the service classes (setInventTransID and parmInventTransID methods of the AxprodTable), in order to call the number sequence for Lot ID (InventTransID) but the same exception still exists. Please tell me if someone knows the exact classes that are to modified in order to successfully insert the data. Kindly help me out with this issue or please redirect me to someone that works/has worked on AIF.
AxProdTable - The class that represents the table ProdTable
AxInventDim_ProdTable - The class that represents the table InventDim
AxdProductionOrder2 – Document Class
ProductionOrder2 – Data Object class (the class that serializes/deserializes XML data for usage in the form of a object)
ProductionOrder2Service – the service class (which has ‘create’ and ‘read’ methods apart from others)
Its successfully deployed it as a web service on IIS and able to add it as a service reference in a C# application. able to use the classes from AX (the service classes that are generated in AX on creation of the service)
following necessary code in C# to call the service and make use of the ‘create’ operation exposed by the service.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using finalProdOrder.AifReference;
namespace finalProdOrder
{
class Program
{
static void Main(string[] args)
{
// Instance of service client class.
ProdcutionOrder2ServiceClient service1 = new ProdcutionOrder2ServiceClient();
// Instance of document class.
AxdProdcutionOrder2 prodOrder = new AxdProdcutionOrder2();
// Instances of the entities(tables) that are used in the service and setting the needed fields on those entities.
AxdEntity_ProdTable prodTable = new AxdEntity_ProdTable();
prodTable.ProdId = "WO014117";
prodTable.ItemId = "00100400";
AxdEntity_InventDim inventDim = new AxdEntity_InventDim();
// Adding the sub-entity instances to their parent entities as an array of the sub-entity type.
prodTable.InventDim = new AxdEntity_InventDim[1] { inventDim };
prodOrder.ProdTable = new AxdEntity_ProdTable[1] { prodTable };
try
{
//Create method on the service passing in the document.
EntityKey[] prodOrderEntityKey = service1.create(prodOrder);
// The create method returns an EntityKey which contains the ID of the production order.
EntityKey returnedProdOrder = (EntityKey)prodOrderEntityKey.GetValue(0);
Console.WriteLine("A production order has been created with a Production ID of " + returnedProdOrder.KeyData[0].Value);
Console.ReadLine();
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
Console.ReadLine();
}
}
}
}
But
when run this code, there is an exception while executing the service.create
method(create operation). The exception shown in the Visual Studio
console:System.ServiceModel.FaultException`1[fin
In AX (AIF), within Basic->Periodic->Application Integration Framework->Exceptions, the following is the exception:
Number sequence for the reference Lot ID in parameters in the Inventory management module has not been set up.
(P.S - From what to understand, this service is created on a query based on the ProdTable and InventDim tables. So, by creation of the production order, it is creation of a record in ProdTable, and not creation of a row in ProductionOrder form). The new record is being created without this “number sequence issue”. The number sequence for LotID is being generated successfully. But, the exception is showing up when we try to insert the record through the AIF service.
If trying to modify the service classes (setInventTransID and parmInventTransID methods of the AxprodTable), in order to call the number sequence for Lot ID (InventTransID) but the same exception still exists. Please tell me if someone knows the exact classes that are to modified in order to successfully insert the data. Kindly help me out with this issue or please redirect me to someone that works/has worked on AIF.