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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

AX 2012 AIF Web services

(0) ShareShare
ReportReport
Posted on by 535

I'm fairly new to the AIF web service side, but that seemed to have went as planned. I have consumed this the web service from AX on my windows service in VS 2013. Then I go to call a simple method in the windows service and it gives me the error: "No overload for Method 'addintegers' takes 2 arguements. What am I missing to call and return such a simple method from AX?

Method in AX:

[SysEntryPointAttribute(true)]
public int addIntegers(int _int1, int _int2)
{
    return _int1 + _int2;
}

VS2013 Service:

public void SendParts()
    {
        //ws.InventJournalTrans() = 
        PolyTransferService.PolyServiceReference.PolyJourInfoService polyJourInfoService;

        int test;

        polyJourInfoService = new PolyTransferService.PolyServiceReference.PolyJourInfoService();

        test = polyJourInfoService.addIntegers(1, 1);

    }


*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    Hi, you could use debugging or intellisense to see what kind of parameters the method is expecting(as you haven't overloaded it, there might be some default constructor for this)

    However, I would just simply add this method to the new service, technet.microsoft.com/.../aa607052.aspx

  • KeithM Profile Picture
    535 on at

    I used that same exact example as you can see with the addintegers, but something doesn't mesh up.  When I start typing in the brackets it is looking for the Request type on the method call and not two integers(AddIntegersRequest request).

  • Community Member Profile Picture
    on at

    Sorry, I must have missed in your question the part where you overload the method and add it as a new method in your newly created service.

    If you look it in AIF, is your addintegers method available for a (dummy) port utilizing your service?

  • KeithM Profile Picture
    535 on at

    I haven't overloaded anything. I just added the method like it suggested in the article. I can see it just fine when I add the service operations to the inbound port, if that is what you are asking.

  • Verified answer
    Martin Dráb Profile Picture
    239,647 Most Valuable Professional on at

    Create a new instance of AddIntegersRequest - you should see properties for your two arguments. Fill values to the properties and pass the object to the service.

  • KeithM Profile Picture
    535 on at

    Thanks Martin, I played around and got that without squiggly lines, now I am getting the dreaded "The namespace 'Poly......' already contains a definition for 'XXX....'. I haven't found a logical workaround for this yet.

  • Martin Dráb Profile Picture
    239,647 Most Valuable Professional on at

    Can you tell what you did before you started getting this error? Don't you mix different type of services in the same inbound port? What type is it referring to?

  • KeithM Profile Picture
    535 on at

    I wasn't getting these errors until I fixed my code to access the service.   I referenced this article: stackoverflow.com/.../how-to-fix-namespace-x-already-contains-a-definition-for-x-error-happened-aft, but tried that and it didn't fix it.

  • Martin Dráb Profile Picture
    239,647 Most Valuable Professional on at

    What about the remaining questions?

  • KeithM Profile Picture
    535 on at

    Sorry, I just added the standard create, find, get, etc.  I did have two different services with the same create, find. I removed them and that might have seemed to fix the error. I am still getting the request error. Getting a conversion error now, "Cannot implicitly convert type, Default...., to int".

     public void SendParts()
        {
            //ws.InventJournalTrans() = 
            Default.ServicePolyRecords.PolyJourInfoService polyJourInfoService;
    
            int test;
    
            test = 0;
    
            PolyJourInfoServiceAddIntegersRequest pjisrequest = new PolyJourInfoServiceAddIntegersRequest();
    
            pjisrequest._int1 = 1;
            pjisrequest._int2 = 9;
    
         test = polyJourInfoService.addIntegers(pjisrequest);
            //pjisrequest.CallContext
    
        }


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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 34

#2
Michel ROY Profile Picture

Michel ROY 14

#3
Jagadabi Profile Picture

Jagadabi 6

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans