This article explains about Dynamics 365 F&O Testing Services Using SoapUI. SoapUI is an open source web service testing application for the representational state transfers and service oriented architectures.
MS Dynamics 365 F&O Testing Services Using SoapUI functionality covers web service inspection, invoking, development, simulation and mocking, functional testing, load and compliance testing.
Dynamics 365 F&O Testing Services Using SoapUI can test SOAP and REST web services, JMS, AMF, as well as make any HTTP(S) and JDBC calls. It is used for functional and non-functional testing, widely used in WebServices testing.
Register a Web Application with AAD
Before any clients can communicate with the services, they must be registered in AAD. These steps will help you register an application with AAD.
- From the appropriate project in Microsoft Dynamics Lifecycle Services (LCS), open Azure portal.
- In Azure portal, on the Azure Active Directory tab, choose Properties and make a note of the tenant ID in the Directory ID field. You will require the tenant ID later to retrieve an Azure Active Directory (Azure AD) authentication token.
- On the Azure Active Directory tab, select App registrations, and then select New application registration.
- Enter a name that recognizes the external application that you are registering. For an application that will validate by using a shared secret, choose Web app or API. In this environment, the sign on URL does not matter. Hence, use localhost.
- Choose the new application and copy the application ID. You will require the application ID later to request an Azure AD authentication token. Choose Required permissions.
- Choose Add and then select Select an API.
- Select Microsoft Dynamics ERP (Microsoft.ERP). If you search Microsoft Dynamics ERP in the search field within Select an API it might appear to be grayed out. In that case, make sure you look for the full name as shown above.
- Under Delegated permissions, you must select, at a minimum, the following options:
- Access Dynamics AX Custom Service
- Accessing Dynamics AX data
- Access Dynamics AX online as organization users
- Select Done.
- Choose Keys. In the dialog box that gets displayed, enter a description, set the Expires value to Never expires and then choose Save.
Register your External Application in Finance and Operations
- In MS D365 Finance and Operations, go to System administration > Set up > AAD (Azure Active Directory) applications.
- Choose New.
- Fill in the fields for the new record:
- In the Client Id field, enter the application ID that you registered in Azure AD.
- Inside the Name field, enter a name for the application.
- In the User ID field, select an appropriate service account user ID. For this example, we have selected the Admin user. As a good practice, you should provide a dedicated service account that has the correct permissions for the operations that must be performed.
When you’ve finished, select Save. You’ve now finished setting up the prerequisites.
After the external application retrieves an Azure AD authentication token, it should now be able to use the token in an authorization HTTP header to make subsequent service calls via OData or SOAP, for example.
MS Dynamics 365 F&O Testing Services Using SoapUI Overview
Query the Finance and Operations SOAP Custom Service by Using SoapUI
SoapUI (https://www.soapui.org/) is a tool that is often used to interact with SOAP and REST web services in scenarios that involve API development and testing. This procedure isn’t an endorsement of SoapUI, and other similar tools are available.
However, we are using Dynamics 365 F&O Testing Services Using SoapUI to illustrate the concepts and messages that are involved when you use OAuth to authenticate with Azure AD, and then make SOAP requests to and receive responses from Finance and Operations.
- Start SoapUI and select the SOAP button to create a project.
- Complete the information for the project:
- In the Project Name field, enter a name for the project.
- In the Initial WSDL field, enter the service address and add the suffix ?wsdl. (The service address should be in the format [Finance and Operations instance base URL]/soap/services/[service group name].)
For example, we are querying the user session service at the URL
https://[Finance and Operations base URL]/soap/services/UserSessionService?wsdl.
- Select the Create sample requests for all operations? check box.
Because you selected to create sample requests, one sample request is created for each service operation that is available.
- Right-click the new project, and then select New TestSuite to create a test suite. This test suite will generate a POST request for an Azure AD authorization token.
- Right-click the test suite, and then select New TestCase.
- Expand the test case, right click Test Steps, Choose Add Step and then select HTTP Request.
- Enter a name for the request and then select OK.
- Enter a name for the test step. The endpoint that you should use for the POST request is
- Use the plus sign (+) button next to Parameters to add the following values.
|client_id||The application ID from the Azure AD application registration|
|client_secret||The secret key value from the Azure AD application registration|
|resource||The URL of the Finance and Operations instance without the trailing ‘/’|
- To make sure that the parameters are in the POST body, choose Post QueryString and then click Play. An access token should be displayed in the response pane.
- The values will be most readable if you utilize the JSON response tab. Copy the access token so that you can utilize it in the authorization header of subsequent requests.
- Go back to the first request node under the GetUserSessionInfo SOAP sample request. In the request pane on the left, choose the plus sign (+) button to add a header that is named Authorization. Paste the access token into the Value field and add the prefix Bearer.
- The sample requests that SoapUI creates won’t work unless you modify them. You must edit the call context and body so that they are consistent with the schema for what you are trying to do.
For our simple Microsoft Dynamics 365 F&O Testing Services Using SoapUI scenario, you can edit the optional call context elements so that they are null-valued. Insert a forward slash (/) before the greater than sign (>) in the opening tags.
Then comment out the question marks (?) and the closing tags by using the standard <!–…–> syntax to delimit the start and end of the comments. (Question marks are not valid content for the XML schema.) Otherwise, you can just delete the question marks (?) so that the context elements are empty.
The SOAP request is now ready. Choose Play and validate the result on the right. In our example, we have now successfully authenticated and then queried UserSessionService via SOAP. For more information on Microsoft D365 F&O Testing Services Using SoapUI, please contact us.