Friday, 18 December 2020

Testing Entities in D365 with SOAPUI custom services

Testing SOAP custom service in your application 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 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.

  1. Start SoapUI, and select the SOAP button to create a project.

  2. 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 more information, see the Services home page.

      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.

      Testing Entities in D365 with SOAPUI custom services,Dynamics 365 entity soap authentication,SOAPUI,token,third party test entity in D365,ODATA entity testing,soapUI,

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

  4. Right-click the test suite, and then select New TestCase.

  5. Expand the test case, right-click Test Steps, select Add Step, and then select HTTP Request.

  6. Enter a name for the request, and then select OK.

  7. Enter a name for the test step. The endpoint that you should use for the POST request is [https://login.microsoftonline.com/[tenant_id]/oauth2/token](https://login.microsoftonline.com/%5btenant_id%5d/oauth2/token).

  8. Use the plus sign (+) button next to Parameters to add the following values.

    TABLE 2
    ParameterValue
    grant_typeclient_credentials
    client_idThe application ID from the Azure AD application registration
    client_secretThe secret key value from the Azure AD application registration
    resourceThe URL of the instance without the trailing '/'
  9. To make sure that the parameters are in the POST body, select Post QueryString, and then select Play. An access token should be returned in the response pane. The values will be most readable if you use the JSON response tab. Copy the access token so that you can use it in the authorization header of subsequent requests.

  10. Go back to the first request node under the GetUserSessionInfo SOAP sample request. In the request pane on the left, select 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.

  11. 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're trying to do.

    For our simple 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 aren't valid content for the XML schema.) Alternatively, you can just delete the question marks (?) so that the context elements are empty.

  12. The SOAP request is now ready. Select Play, and validate the result on the right.

    Validate the results

In our example, we have now successfully authenticated and then queried UserSessionService via SOAP.

Above content is taken from https://docs.microsoft.com/

Thanks,

Vikas Mehta

1 comment:

  1. Thank you for helping people get the information they need. Great stuff as usual. Keep up the great work!!!
    Dynamics 365 testing

    ReplyDelete

AZURE INTERVIEW QUESTIONS AND ANSWERS

AZURE INTERVIEW QUESTIONS AND ANSWERES 2021 2. What is cloud computing? Explanation:  It is the use of servers on the internet to “store...