web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Consuming AIF Web Service in VS.NET C# Console project

(0) ShareShare
ReportReport
Posted on by 3,089

Dear Experts,

I have written one AIF service in AX 2012 and exposed the web service. Finally added as a Web Service Reference in VS.NET C# Console project. The problem is, once the system try to create the record in db it shows me error:

"There was no endpoint listening at http://<PCNAME>/MicrosoftDynamicsAXAif60/MyContacts/xppservice.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details."

How can I resolve this problem?

Best Regards,
Ahmed

*This post is locked for comments

I have the same question (0)
  • Bilal Issa Profile Picture
    4,370 on at
    RE: Consuming AIF Web Service in VS.NET C# Console project

    Hi,

    please try to turn off the firewall

    Regards,

    Bilal

  • Community Member Profile Picture
    on at
    RE: Consuming AIF Web Service in VS.NET C# Console project

    Please validate whether all the required AIF inbound port in Dynamics AX activated

  • Ahmed Muhammad Alam Profile Picture
    3,089 on at
    RE: Consuming AIF Web Service in VS.NET C# Console project

    Hello,

    I have already switched off the firewall.

    Best Regards,

    Ahmed

  • Ahmed Muhammad Alam Profile Picture
    3,089 on at
    RE: Consuming AIF Web Service in VS.NET C# Console project

    Hello,

    Still same. I have created a new table with three fields.

    - Created a query

    - AIF generation through wizard

    - Created inbound service group on HTTP protocol

    - Attached the web service in VS.NET C# Console project.

    MyContactServiceReference.MyContactsQueryServiceClient client = new MyContactServiceReference.MyContactsQueryServiceClient();

               MyContactServiceReference.CallContext context = new MyContactServiceReference.CallContext();

               MyContactServiceReference.AxdEntity_MyContacts[] record = new MyContactServiceReference.AxdEntity_MyContacts[1];

               MyContactServiceReference.EntityKey[] response;

               record[0] = new MyContactServiceReference.AxdEntity_MyContacts();

               Console.Write("\nID: ");

               record[0].ID = Convert.ToInt32(Console.ReadLine());

               Console.Write("\nName: ");

               record[0].Name = Console.ReadLine();

               Console.Write("\nMobile: ");

               record[0].Mobile = Console.ReadLine();

               Console.Write("\nEmail: ");

               record[0].Email = Console.ReadLine();

               context.Company = "dat";

               try

               {

                   response = client.create(context, record);

                   Console.WriteLine("\nSuccess! New recode with {0} '{1}'", response[0].KeyData[0].Field, response[0].KeyData[0].Value);

                   client.Close();

               }

               catch (Exception e)

               {

                   Console.WriteLine("Exception : {0}", e.Message);

                   client.Abort();

               }

               Console.ReadLine();

  • Suggested answer
    keoma Profile Picture
    32,729 on at
    RE: Consuming AIF Web Service in VS.NET C# Console project

    hi,

    check if you have enabled anonymous access and check your binding settings. binding settings on client and server side must match in detail.

    also follow msdn.microsoft.com/.../cc652581(v=ax.50).aspx for binding settings.

  • Ahmed Muhammad Alam Profile Picture
    3,089 on at
    RE: Consuming AIF Web Service in VS.NET C# Console project

    Dear Experts,

    I have found this exception "Inner Exception" from the system.

    System.Net.WebException: The remote server returned an error : (404) Not Found

  • Mohammad Raziq Ali Profile Picture
    2,486 on at
    RE: Consuming AIF Web Service in VS.NET C# Console project

    Dear Ahmed,

    When ever you made changes to AIF service in AX, deactivate the service, make changes to it and redeploy it, mean while, Update Service Reference in Visual Studio as well.

    It is recommended that you do full Cil Generation (deactivate the service) before Redeploy the service.

    I will give one personal tip to debug AIF from Visual Studio, Create Txt File, place it in some directory and write some characters into it and placed this code with your C# code in between, so that, you will be able to know something where the actual error is.......

    Thanks,

    Raziq

  • Ahmed Muhammad Alam Profile Picture
    3,089 on at
    RE: Consuming AIF Web Service in VS.NET C# Console project

    Dear Mohammad,

    I have performed the mentioned below activity but still the same result.

    - Deactivate the Service

    - Compile complete application

    - Generate Full CIL

    - Activate the Service

    - Refresh the service from AIF Services

    - Web Services added successfully within the console application of VS.NET.

    - Working fine over the browser

    Once I use the service operation [Create or else] it shows me the problem which I mentioned above as a Inner Exception.

  • Suggested answer
    Mohammad Raziq Ali Profile Picture
    2,486 on at
    RE: Consuming AIF Web Service in VS.NET C# Console project

    Dear Ahmed,

    Hats off for your efforts but now, one thing is clear, it is totally network oriented issue.

    try to do R&D on port (compatibility), required permissions to use that AIF service in C#.

    These could be the reason for your issue.

  • Suggested answer
    keoma Profile Picture
    32,729 on at
    RE: Consuming AIF Web Service in VS.NET C# Console project

    check windows eventlog and IIS log file for details.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#2
Community Member Profile Picture

Community Member 2

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans