Export (0) Print
Expand All

How to: Trace a Call to an AIF Web Service

Dynamics AX 2009

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 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.

    Caution noteCaution

    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.


<system.diagnostics>
    <!-- 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"
               type="System.Diagnostics.TextWriterTraceListener"
               initializeData="AifServiceTrace.webinfo" >
          </add>
          <remove name="Default" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>

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 : 
    contoso\mclark
AifServiceProcessing Information: 0 : Logged on to Dynamics 
    Ax successfully.
AifServiceProcessing Information: 0 : Incoming MessageId : 
    d51711e0-eb79-4d2d-a5d0-1f8327b487ec
AifServiceProcessing Information: 0 : Submitting User : 
    contoso\mclark
AifServiceProcessing Information: 0 : External Action : 
    http://schemas.microsoft.com/dynamics/2008/
    01/services/SMAServiceOrderService/read
AifServiceProcessing Information: 0 : Destination Endpoint
AifServiceProcessing Information: 0 : Source Endpoint
AifServiceProcessing Information: 0 : 
    Parameter in request : <EntityKeyList
    xmlns="http://schemas.microsoft.com/dynamics/2006/
    02/documents/EntityKeyList"><EntityKey
    xmlns="http://schemas.microsoft.com/dynamics/2006/
    02/documents/EntityKey">
    <KeyData><KeyField><Field>ServiceOrderId</Field>
    <Value>0000043_SO</Value></KeyField></KeyData>
    </EntityKey></EntityKeyList>
AifServiceProcessing Information: 0 : Return value from DynamicsAx :
    <DocPurpose xmlns="http://schemas.microsoft.com/dynamics/2008/
    01/documents/ServiceOrder">Original</DocPurpose><SenderId 
    xmlns="http://schemas.microsoft.com/dynamics/2008/
    01/documents/ServiceOrder">dat</SenderId><SMAServiceOrderTable 
    class="entity" xmlns="http://schemas.microsoft.com/dynamics/2008/
    01/documents/ServiceOrder"><_DocumentHash>
    fbe22b7413eb72c2aa5f1067a686f719</_DocumentHash>
    <ActivityNumber>A00000260</ActivityNumber>
    <ActivityTypeId>E-mail</ActivityTypeId>
    <AddressRefRecId>5637144582</AddressRefRecId>
    <AddressRefTableId>77</AddressRefTableId>
    <CalendarConflict>No</CalendarConflict>
    <CustAccount>4006</CustAccount>
    <Description>Service chairs only</Description><IncomingWebOrder>
    No</IncomingWebOrder><Origin>User</Origin>
    <PreferredTechnician>ALA</PreferredTechnician>
    <Priority>Normal</Priority><Progress>InProcess</Progress>
    <ProjId>9002</ProjId><RecId>5637146366</RecId>
    <RecVersion>2062867747</RecVersion><Responsible>AJE</Responsible>
    <ServiceAddress>Tulipans rijge 232514  A Den Haag
    NL</ServiceAddress><ServiceAddressCity>Den Haag
    </ServiceAddressCity><ServiceAddressCountryRegion>
    NL</ServiceAddressCountryRegion>
    <ServiceAddressName>Furniture World</ServiceAddressName>
    <ServiceAddressStreet>Tulipans rijge 23
    </ServiceAddressStreet><ServiceAddressZipCode>2514 AB
    </ServiceAddressZipCode><ServiceCountryRegionId>
    NL</ServiceCountryRegionId>
    <ServiceDateTime localDateTime="2008-04-23T11:00:00" 
    timezone="GMTMINUS0800PACIFICTIME">2008-04-23T18:00:00Z
    </ServiceDateTime><ServiceLevelAgreementStatus>
    None</ServiceLevelAgreementStatus>
    <ServiceOrderId>0000043_SO</ServiceOrderId>
    <SignOff>No</SignOff><StageId>Planning</StageId>
   

Community Additions

ADD
Show:
© 2014 Microsoft