Postman is a great tool for debugging web sites and web services. For developing web services the free edition works well and is a great proof of concept that can be given to the development team doing the integration on the other side. In this post we’ll walk through how to use Postman to test Dynamics AX 2012 web services.
Set up AX AIF Inbound Port
Postman does not support net.tcp protocol as of yet. So we need to create a new inbound port using the HTTP adapter. It will reference the same service operations, so you can debug the service by sending a request from Postman. Open /System Administration/Setup/Services and Application Integration Framework/Inbound ports
- Create a new inbound port
- Give the port a name
- Select the HTTP adapter
- Select the web site to host it. Their setup is located at /System Administration/Setup/Services and Application Integration Framework/Web sites
- Select the service operations you want to test
- Set up logging (optional) by setting the logging mode to “Original document”
Set Up Web Debugging Proxy
First we install Fiddler, a web debugging proxy. The tool will let us eavesdrop on the communication between Postman and Dynamics AX. The current NTLM (Windows auth) functionality in Postman is still in BETA and I had a hard time getting it working, so as a ‘always works’ approach, start Fiddler and turn on the “Automatically Authenticate” rule. You must leave Fiddler running this mode while you use Postman. This will assist Postman so that it can authenticate with AX AIF. Now Postman will not need to negotiate NTLM authentication, nor need to send any authentication headers. Without this step we’d receive a “401 Unauthorized” / “IIS 8.5 Detailed Error – 401.2 – Unauthorized” response.
Use Postman to Retrieve the WSDL XML
Now install and open Postman. The registration is optional. Create a new basic request.
Put in the URL of the WSDL file of the web service you want to test. In my example I am using: http://servername/MicrosoftDynamicsAXAif60/dag/xppservice.svc?WSDL
Click the bright blue Send button!
Using Postman to Call a Service Operation
In order to hit a service operation, you need to understand how to look at the WSDL file for the operation information (Postman documentation).
This is what worked for Dynamics AX 2012-
- Change HTTP method from GET to POST
- Leave the get Params empty (the ?WSDL is not needed)
- Authorization should be “No Auth” because Fiddler is doing it for us
- Content-Type: text/xml
- SOAPAction: http://tempuri.org/AXServiceName/ServiceOperationName – this comes from the WSDL file
- Body – This needs to be a valid SOAP request, with an envelope
Extra Credit: Configure WCF Web Service to Send Error Information in the Response
As you are sending requests to the web service, with even a minor typo you’ll likely receive an HTTP 500 response from the web service, citing “Internal Service Error…The server was unable to process the request due to an internal error.” Then it explains how to change the WCF web service configuration in order to get a better error message. Well, with Dynamics AX this is a bit different, or actually easier.
- Open /System Administration/Setup/Services and Application Integration Framework/Inbound ports
- Select the HTTP inbound port created earlier
- Deactivate the service if it is currently deployed and active
- Click on the “Configure” button next to the adapter setting
- In the configuration editor window that appears, navigate to Advanced/Service Behaviors/routingServiceBehavior/serviceDebug
- Change IncludeExceptionDetailsInFaults to True
Send your request again, and it will point you to the place in your request that has the typo!