AIF : Enable net.tcp binding on WCF service

Today I wanted to check out what the impact of changing the binding method to net.tcp instead of wsHttpBinding was. But to be able to use net.tcp as a binding, some things need to be done.

IIS Setup

The first thing to do is making sure everything is in place on the IIS 7 side.
For tcp.net being enabled as binding method, make sure the following feature is installed.

By installing this, you can add net.tcp bindings in IIS. So right now we can start by going to the IIS manager and add net.tcp as a binding method on the Dynamics Ax AIF Application.

After adding the site binding, enable the net.tcp binding as protocol on the Application

Dynamics Ax AIF Webservice setup

Once the IIS is ready to pass net.tcp requests, we can configure the Dynamics Ax Web Service to work with net.tcp binding.

Inside Dynamics Ax, go to Basic à Setup à Application Integration Framework à Services and click the configure button. Now the configuration editor will start. Here you can select the service you want to alter and change the binding method to net.tcp. You also have to specify the address here. In this case it is: net.tcp://hostname:808/DynamicsAX50AIFServices/nvmpconfigtableservice.svc

Once you have done this, you can go ahead and regenerate the service artifacts and refresh the services on the calling applications.

Dynamics AIF : Tracing Web Service calls

When using AIF through web services, you can be in the dark when you want to know what’s really going on in there. Additionally you can have trouble debugging the thing when you are running a Windows 2008 box. (Contacted Microsoft last week and the response was that debuggin AIF webservices does not work on a Win2k8 box but they are developing a hotfix as we speak)

There is a possibility to have some tracing of what is happening there.  I found this on MSDN and will show an example here of what the result of the tracing shows. 

First, head over to the folder where the Dynamics Ax web services are generated. There you should find a web.config file. To enable tracing you need to make sure this tag is present 

 <system.diagnostics>
    <!-- This is used for enabling tracing in retail and debug builds.
           AIF Service processing stack outputs and information
           messages used for debugging.
           Possible values for the switch are Off, Warning,
             Information, Critical, Verbose.
           Change the switchValue to Information to enable tracing.
      -->
    <sources >
      <source name="AifServiceProcessing" switchValue="Information">
        <listeners >
          <add name="TextWriterListener"
               type="System.Diagnostics.TextWriterTraceListener"
               initializeData="AifServiceTrace.webinfo" >
          </add>
          <remove name="Default" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>  

After invoking the service, there should be a file named AifServiceTrace.Webinfo present with the tracing information : 

The following information can be viewed :

  • UserId’s
  • Message ID
  • Source and destination endpoint
  • Key Data XML
  • Return Data from Ax

 

AIF WCF Tracing

Dynamics Ax AIF Web Service reference credential problem

 

At a customer’s site, I was creating some extra AIF wcf services so that some extra tables would be externally available. For creating the WCF service, I was using the service wizard in Ax 2009 which is described here : http://msdn.microsoft.com/en-us/library/aa609947.aspx

The newly created service was deployed to the Internet Information Server but when the .Net application tried to reference the webservice, the following happened : The service was prompting for credentials and did not work properly.

WCF Service Reference Credential Prompt

After a certain amount of searching time and nearly giving up,  I was browsing the configuration file of the web services directory and discovered that the BindingMethod of the deployed services was configured to use basicHttpBinding.

Endpoint binding method basicHttpBinding

This was the actual problem because the wsdl looked like this : (negotiate authentication tags were added, …)

 

Wrong WSDL with negotiateAuthentication tag

Changing the binding method to wsHttpBinding creates the service without the negotiateAuthentication and takes care of our annoying credential problem.

Endpoint binding method wsHttpBinding