How to: Trace a Call to an AIF Web Service

This topic describes how to trace a call from an external client to an X++ service exposed as a Web service in Microsoft Dynamics AX. When you call the Web service, the call goes to the Web service and is then passed to the AOS. You can use tracing to capture the parameters the client sends to the Web services as well as the parameters that are sent from the Web service to the AOS.

Tracing Web service calls can be useful for troubleshooting because it enables you to see the data that is being sent at various points in an exchange.

To Trace a Web Service Call

To enable tracing of a call to a Web service, you must modify the Web.config found in the Internet Information Services (IIS) virtual directory. For more information, see Troubleshooting Web Services.

  1. In Visual Studio or a text editor, open the Web.config file found in the virtual directory. The default location for this directory is <Microsoft Dynamics AX Installation Directory>\50\AifWebServices.

  2. Copy and paste the AifServiceProcessing element to the Web.config from the code in the following section.

  3. Call the Web service.

  4. Review the trace file. The trace information is appended to the AifServiceTrace.webinfo file. If no file exists, the AifServiceTrace.webinfo file is created in the virtual directory.


    Be sure to set the AifServiceProcessing value in the Web.config to Off when you have finished troubleshooting. Otherwise, all calls to the Web service will continue to be logged creating a large trace file and a potential performance impact.

The AifServiceProcessing Element in the Web.config

    <!-- 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" />

Sample Trace File

The trace file displays the parameters that are sent from the client to the Web service and the parameters that are sent from the Web service to the AOS. The following code is a sample of a trace file generated by a request to read a service order with a call to the SMAServiceOrderService service.

AifServiceProcessing Information: 0 : SourceEndpointUser : 
AifServiceProcessing Information: 0 : Logged on to Dynamics 
    Ax successfully.
AifServiceProcessing Information: 0 : Incoming MessageId : 
AifServiceProcessing Information: 0 : Submitting User : 
AifServiceProcessing Information: 0 : External Action :
AifServiceProcessing Information: 0 : Destination Endpoint
AifServiceProcessing Information: 0 : Source Endpoint
AifServiceProcessing Information: 0 : 
    Parameter in request : <EntityKeyList
AifServiceProcessing Information: 0 : Return value from DynamicsAx :
    <DocPurpose xmlns="
    class="entity" xmlns="
    <Description>Service chairs only</Description><IncomingWebOrder>
    <ServiceAddress>Tulipans rijge 232514  A Den Haag
    NL</ServiceAddress><ServiceAddressCity>Den Haag
    <ServiceAddressName>Furniture World</ServiceAddressName>
    <ServiceAddressStreet>Tulipans rijge 23
    </ServiceAddressStreet><ServiceAddressZipCode>2514 AB
    <ServiceDateTime localDateTime="2008-04-23T11:00:00" 

See Also

How to: Call an AIF Web Service from C#