Export (0) Print
Expand All

How to: Add a Service Reference

Dynamics AX 2009

This topic describes how to add a service reference so you can consume an external Web service from X++ code in Microsoft Dynamics AX. The first step to consuming an external Web service is to add a reference to the Web service. This process generates the proxy assembly and other reference files. A Web service reference is added in the Web references form. You can navigate to the Web references form through the Tools menu or the AOT.

Use the following steps to add a reference to the Microsoft Windows Live Search service. For more information about the Live Search API, see Getting Started with the Live Search API.

  1. From the Tools menu select Development tools, select Application Integation Framework, and then select Add service reference.

    - or -

    In the AOT, right-click the References node, and then click Add service reference.

  2. In the WSDL URL field, enter the location of the service WSDL, http://soap.search.msn.com/webservices.asmx?wsdl.

    This field can contain a path to the local file system, a file share, or an Internet address. The following are valid formats for the WSDL URL:

    • http://soap.search.msn.com/webservices.asmx?wsdl

    • http://localhost/WebServices/SalesTableservice.asmx?WSDL

    • c:\WebServices\SalesTableService.wsdl

  3. In the .NET code namespace field, enter a unique name for the .NET namespace such as WindowsLiveSearch. This is the namespace in which the generated proxy assembly and other files will reside.

  4. In the Reference name field, enter a unique name for the Web service without spaces or special characters such as LiveSearch.

    This name is used as the name of the .NET assembly that is created and the name of the directory that contains the generated Web reference files.

  5. In the Service description field, enter a description for the Web service.

  6. Click OK. The Web reference is generated and the proxy files are saved to the following directory: <Microsoft Dynamics AX Install Directory>Application\Appl\DynamicsAx\ServiceReferences\<Web Service Name>.

    ImportantImportant

    If the WSDL of the external Web service contains an enum, you will need to restart the AOS service. If you add a service reference and you receive an error, this may be the cause.


To debug a call to an external Web service, you must generate a PDB file for the assembly that is generated. To generate the .pdb file along with the proxy assembly, follow these steps:

  1. Navigate to the directory <Microsoft Dynamics AX Install Directory>\Server\DynamicsAx\Bin and open the file WebReferenceGenerator.config. This file contains the following XML.

    <?xml version="1.0" encoding="utf-8" ?>
    <!-- This configuration file is used for generation
        of web references. -->
    <configuration>
      <appSettings>
        <!-- This key will turn on/off debug symbol file (*.pdb)
            to be generated for web references. -->
        <add key="IncludeDebugInfo" value="false"/>
      </appSettings>
    </configuration>
    
  2. Change the value of IncludeDebugInfo to true.

  3. Open the AOT, expand the References node, right-click the service reference and then click Regenerate. The proxy files are regenerated and a .pdb file with the same name and location as the assembly is created.

Community Additions

ADD
Show:
© 2014 Microsoft