Category Archives: Application Integration Framework,AIF

AIF Webservice : Tracing Web Service calls

When using AIF through web services, you can be in the dark when you want to know what’s really going on in there.

I was looking in to the web.config file suddenly i have seen a tag to trace the AIF Web services.


<;!-- This is used for enabling tracing in retail and debug builds.
AIF Service processing stack outputs and information
messages used for debugging.
Possible values for the switch are Off, Warning,
Information, Critical, Verbose.
Change the switchValue to Information to enable tracing.
<sources >
<;source name="AifServiceProcessing" switchValue="Information">
<;listeners >
<;add name="TextWriterListener"
initializeData="AifServiceTrace.webinfo" >;
<;remove name="Default" />


by default the Inner tag switchValue="Off”> and i have changed in to  switchValue="Information">. I found this on MSDN and will show an example here of what the result of the tracing shows.

i have invoked the service through .net class . there should be a file named AifServiceTrace.Webinfo present with the tracing information : 

The following information can be viewed :

  • UserId’s
  • Message ID
  • Source and destination endpoint
  • Key Data XML
  • Return Data from Ax


AifServiceProcessing Information: 0 : SourceEndpointUser : rajdiscoms\axbcproxy
AifServiceProcessing Information: 0 : Logged on to Dynamics Ax successfully.
AifServiceProcessing Information: 0 : Incoming MessageId : 5af19da1-9532-4842-9522-2f499f012e50
AifServiceProcessing Information: 0 : Submitting User : rajdiscoms\axbcproxy
AifServiceProcessing Information: 0 : External Action :
AifServiceProcessing Information: 0 : Source Endpoint
AifServiceProcessing Information: 0 : Destination Endpoint
AifServiceProcessing Information: 0 : Parameter in request : <;BiliingDeterminants xmlns=""><SenderId xsi:nil="true" xmlns:xsi="" /><Rdm_BillingDeterminants class="entity"><_DocumentHash xsi:nil="true" xmlns:xsi="" /><BinderNo>798080</BinderNo><DiscomCode xsi:nil="true" xmlns:xsi="" /><OfficeCode>80980</OfficeCode><ScheduledForBillMonth xsi:nil="true" xmlns:xsi="" /><ScheduledForBillYear xsi:nil="true" xmlns:xsi="" /><TimeStamp xsi:nil="true" xmlns:xsi="" /><TokenIssueDate xsi:nil="true" xmlns:xsi="" /><TokenNo>90124</TokenNo><TotalConsumers xsi:nil="true" xmlns:xsi="" /></Rdm_BillingDeterminants></BiliingDeterminants>
AifServiceProcessing Information: 0 : Aif Message Xml Request: : <;?xml version="1.0" encoding="utf-16"?><Envelope xmlns=""><Header><MessageId>{5af19da1-9532-4842-9522-2f499f012e50}</MessageId><SourceEndpointUser>rajdiscoms\axbcproxy</SourceEndpointUser><SourceEndpoint /><DestinationEndpoint /><Action></Action></Header><Body><MessageParts xmlns=""><BiliingDeterminants xmlns=""><SenderId xsi:nil="true" xmlns:xsi="" /><Rdm_BillingDeterminants class="entity"><_DocumentHash xsi:nil="true" xmlns:xsi="" /><BinderNo>798080</BinderNo><DiscomCode xsi:nil="true" xmlns:xsi="" /><OfficeCode>80980</OfficeCode><ScheduledForBillMonth xsi:nil="true" xmlns:xsi="" /><ScheduledForBillYear xsi:nil="true" xmlns:xsi="" /><TimeStamp xsi:nil="true" xmlns:xsi="" /><TokenIssueDate xsi:nil="true" xmlns:xsi="" /><TokenNo>90124</TokenNo><TotalConsumers xsi:nil="true" xmlns:xsi="" /></Rdm_BillingDeterminants></BiliingDeterminants></MessageParts></Body></Envelope>
AifServiceProcessing Information: 0 : Return value from DynamicsAx : <;EntityKey xmlns=""><KeyData><KeyField><Field>TokenNo</Field><Value>90124</Value></KeyField></KeyData></EntityKey>


happy Daxing Smile


Tags: ,

AIF Web Service actions(Find,Read, etc.) lost after recreating service in Dynamics AX 2009

When you delete service objects (classes, macros, service node…) and recreate the service you may have run into the issue that none of the service operations were visible.

Here’s how I solved it today when having the same issue. (We had to remove everything or else the problem was not solved) 

The problem is that the actions are not gone, but they were linked incorrectly. The AIFAction table contains the operations and also contains the classId of the class where the methods to handle the actions are. 



Well as the service objects were deleted and afterwards recreated, the class ID of the service class had been altered. Due to this changed ID, none of the operations were visible on the service. 

To fix this, just delete the current records in the AIFAction table for the corresponding service and then we can recreate the actions by calling the AIFServiceGenerationManager class,
method RegisterService.


Then we can see the operations again in the services form.


Tags: , ,

How to resolve int/real with 0/0.00 values via AIF outbound integration with external application

there is known issue with Dynamics Ax AIF Does not serialize the integer or Real values like when table fields having values 0/0.00. it will always return the null values and does not allow to update these values.

Scenario 1.

Table XYZ


X1(String),X2(Int),X3(Real) having values

X1=Deepak ,X2=0,X3=0.0

when you will try to execute the  AIF find operation it will return the data set fields values “Deepak”,Null,Null respectively fields X1,X2,X3. it will not allow to update the null values while execution of AIF Update Operation.

Scenario 2

X1=Deepak ,X2=2,X3=2.0

when you will try to execute the AIF find operation it will return the data set fields values “Deepak”,2,2.0 respectively fields X1,X2,X3. it will allow to update with null values as well as other values while execution of AIF Update Operation.

but when you will update these values with null or zero then it wont allow you update the values and got stuck in first scenario.


this is a known limitation that AIF does not serialize null values in outbound XMLs. If the outbound document has int or real fields with value 0 or 0.0, they would not appear in the outbound XML generated by AIF. The reason is that AX does not have null values so default values (0 for int, 0.00 for real, ‘’ for strings) for each type are treated as nulls and are not serialized by outbound operations.


There are some workarounds for this limitation. If you want a field to be serialized irrespective of its value, you need to make it a “required” field. This can be done in two ways:

– Make field mandatory at table level ie. In AOT , set the field property ‘Mandatory’ to Yes.

– Make the field mandatory at service level.

Making a field mandatory at the table level affects all the consumers of the table such as forms. The second way is less intrusive since it only affects services stack.


This article demonstrates shows how to make a field mandatory at service level.To demonstrate this i have created a table named CrmTable having fields (SanctionLoad(Real),PeakLoad(Real),Multiplyfactor(Real),Account(String),qty(Int)), and run the Application Integration Framework wizard.

Now we are  using CrmTableQueryService document service with operations find,Create,Update.


Now we will try to consume this web service though .Net Application,whenever we will  try to run the first scenario it will through the error because the xml file does not contains the  Real and Interger values fields.we can Check the resulting xml in Basic->Periodic->AIF->Document Schema. The outbound xml in this case does not contain the tag ‘Sanction Load,Peak Load,Multiply factor, Qty  since its value is 0.00/0.

As you would have observed that the ‘the fields property are missing from the outbound xml. Let’s apply workaround #2 – of making fields mandatory for CrmTableQueryService by following steps:


1. Open the document class for CrmTableQueryService service – AxdCrmQueryTable . Override method initMandatoryFieldsMap() from the AxdBase in AxdCrmQueryTable class

2. Update method body as

protected void initMandatoryFieldsMap()









For more information about the initMandatoryFieldsMap method, see .

3. Here AxCrmTable is the AxBC class for the table that contains the field and parmSanctionLoad is the name of the field parm method.

4. Compile the method.

5. Register the service again by right clicking the service node in AOT and selecting ‘Register Service’

6. Stop and restart the AOS to flush all caches.

7. Click on View Schema button on Document Data Policies form for the outbound port. The updated schema now shows ‘Sanction Load’ as a mandatory field.



9. Send another request to the outbound port with Sanction Load= 0.00.


10. Open the outbound xml and  this time you will see the Sanction Load property in the output xml.





Happy Daxing Open-mouthed smile


Tags: ,

AIF: web service operations was not visible in Basic->Setup->AIF->Service.

At a customer’s site, I was creating  AIF Web services. i as trying to regenerating the web service.but i am not able to see the operation of that webservice in Basic->Setup->AIF->Service.


After a certain amount of regenerating and deleting the web service project and nearly giving up,  after lots of efforts i have  discovered that the AIF Wizard have imported the AIF operation’s with wrong id’s in AifAction table.


It probably means you have regenerated you classes using the AIF document wizard, or that you have imported the AIF classes with wrong id’s.


You can use this job to fix the class id’s in the AIFAction table:

static void FixAIFActions(Args _args)
AIFAction aIFAction;
AIFService aifService;
ClassId classId;

// inner method:
// spit string at delimeter, keep left substring
str lSplit( str _s, str _delimeter )
str s = "";
int pos;
int len = strlen( _s );

pos = strfind( _s, _delimeter, 0, len );
s = strdel( _s,pos,len-pos+1);

return s;
//Select Web service name
select aifService where aifService.Name == "BiliingDeterminantsService";
// fix all actions
while select aIFAction
// check if classid and classname matc.
if(lSplit(aIFAction.ActionId, '.') == aifService.Name)
// update classid
aIFAction.ClassId = classId;

info(strfmt('Action %1 updated', aIFAction.ActionId));



Tags: ,

AIF: HTTP Error 404.3 – Not Found

I have deployed the web service on IIS, I got an error when I tried to browse my web service
The error was:

HTTP Error 404.3 – Not Found

When I tried to add a web reference the svc in visual studio .NET, I got a similar error:

HTTP Error 404 – Not Found

I solved it by using the method described on the AIF blog:

Basically, execute the following command on your web server:

ServiceModelReg.exe -i -x


Related Links



Tags: ,

Dynamics AX AIF Web Service reference credential problem

At a client’s site, I was creating  AIF Web services. For this, I was using the service wizard in AX 2009.

The web service was deployed to the IIS 7.5.when i when i was trying to consume the web service through  the .Net application.the following happened : The service was prompting for credentials and did not work properly.


WCF Service Reference Credential Prompt



After a certain amount of searching time and nearly giving up,  I was browsing the configuration file of the web services directory and discovered that the BindingMethod of the deployed services was configured to use basicHttpBinding.


This was the actual problem because the wsdl looked like this : (negotiate authentication tags were added, …)



Changing the binding method to wsHttpBinding creates the service without the negotiateAuthentication and takes care of our annoying credential problem.



Tags: ,