Consume External Web Services

Note: The following steps show you how to consume an external StockQuote service by using X++.

  1. Open Visual Studio as an administrator.
  2. Go to File > New > Project.
  3. In the New project dialog box in the left column, select Visual C# under the Templates node.
  4. Select Class Library from the list in the middle column.
  5. Enter ExternalServiceLibrary for the name.
  6. Select OK.
  7. In the Solution Explorer window, right-click the ExternalServiceLibrary node.
  8. Select Add Service Reference.
  9. Enter your organization’s web service in the Address field.
  10. Select OK.
  11. In the Solution Explorer window, right-click the ExternalServiceLibrary node.
  12. Select Add > New Item.
  13. Select Code in the left column, and then select Class in the middle column.
  14. Name the class ExternalServiceClass.
  15. Wrap the StockQuote service operation.
  16. Perform a build by right-clicking the ExternalServiceLibrary project in the Solution Explorer.
  17. Select Build. The binary ExternalServiceLibrary.dll is created.
  18. Select File > New > Project.
  19. In the New project dialog box in the left column, select Dynamics 365 under the Templates node.
  20. Select Finance Operations from the middle column.
  21. Enter ExternalServiceLibrary in the Name field and select OK.
  22. In the Solution Explorer window, right-click the ExternalServiceLibrary node.
  23. Select Add Reference.
  24. Select ExternalServiceLibrary.dll from the Add reference dialog box.
  25. Select OK.
  26. Open the Class in the References node in the Solution Explorer window.
  27. Use the external web services that were referenced in ExternalServiceLibrary.dll.