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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

no overload for method takes 0 arguments, in a method which does not need an argument

(1) ShareShare
ReportReport
Posted on by 148

Hi,

I developed a simple service in AX2012 which only has a method for counting everytime the service gets consumed.

 

[SysEntryPointAttribute(true)]
public int ContadoraAvrAvr()
{
    _Counter  ;
    return _Counter;
}

But when I try to consume it in a C# console project I receive the error No overload for method takes 0 arguments. But my method does not need any arguments.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ConsumeBasicCustomService.ContadoraServicioGrupo;

namespace ConsumeBasicCustomService
{
    class Program
    {
        static void Main(string[] args)
        {
            ContadoraServicioClient contadoraServicioVar;
            
            contadoraServicioVar.ContadoraAvrAvr();

            Console.WriteLine();
            Console.ReadLine();

        }
    }
}

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,803 Most Valuable Professional on at

    What would likely help is knowing what parameters the method actually expects, which you can easily see in Visual Studio, e.g. by typing contadoraServicioVar.ContadoraAvrAvr( and checking IntelliSense.

    You'll find that the methods needs a CallContext object.

    As you see, the parameter profile of the service operation and the method in the proxy class don't have to be identical.

  • Daniel Mora Profile Picture
    148 on at

    Hi Martin,

    I understand now that I need a CallContext object, however I dont know exactly how I should code this based on what I have.

  • Suggested answer
    Martin Dráb Profile Picture
    237,803 Most Valuable Professional on at

    If you don't want to provide any parameters, you can simply create a new, empty CallContext:

    contadoraServicioVar.ContadoraAvrAvr(new CallContext());

    If you want to set some values, you need to create an instance of CallContext and set its properties. This example is copied from AX documentation:

    // Create an instance of the CallContext class.
    CallContext context = new CallContext();
    
    // Set the value for Company.
    context.Company = "dat";
    
    // Set the value for LogonAsUser.
    context.LogonAsUser = @"yourdomain\userid";
    
    // Set the value for language.
    context.Language = "en-us";

    You could also use different syntax for the same thing:

    // Create an instance of the CallContext class.
    CallContext context = new CallContext
    {
        Company = "dat",
        LogonAsUser = @"yourdomain\userid",
        Language = "en-us"
    };

    Then you'll pass the object to your method:

    contadoraServicioVar.ContadoraAvrAvr(context);

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans