Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Consume Custom AIF service In AX

Posted on by Microsoft Employee

HI 

We Have multiple instance AX Server. I want transfer data between ax instances through AIF Services.

1- Created a Custom Services in AX1 and Consumed That service  in Dot net Project and Add to AOT.

  AIF Requires a list data as input parameter. below my code

CLRObject clientType;
List dtaheadlist = new List(Types::Class);
CLRObject ClrObject;
int integer;
str string;
System.Exception ex;
AXSERVICE.Creation.ACXHPWSSERVICEClient _client;
AXSERVICE.Creation.ACXHPWSSERVICE _service;
AXSERVICE.Creation.AcxDATACONTRACT[] Hdata;
AXSERVICE.Creation.AcxDATACONTRACT hdclass;
AXSERVICE.Creation.CallContext calcontext;
new InteropPermission(InteropKind::ClrInterop).assert();

try
{
clientType =CLRInterop::getType("AXSERVICE.InCreation.ACXHPWSSERVICEClient");
_client = AifUtil::CreateServiceClient(clientType);
hdclass = new AXSERVICE.Creation.AcxDATACONTRACT();


hdclass.set_TRANSFER("YES");

hdclass.set_LocationIdFrom("16001');

hdclass.set_RequestId("PR-0001233");

 Hdata   = new AXSERVICE.Creation.AcxDATACONTRACT[1]();

  Hdata.Add(hdclass);  // Here receiving ERROR  please guide me this correct 

      result= _client.dataindentwithdetails(calcontext,Hdata);

}

}
catch(Exception::CLRError)
{

ex = CLRInterop::getLastException();
info(ex.ToString());
}

}

*This post is locked for comments

  • Suggested answer
    AhmedMgamal Profile Picture
    AhmedMgamal 75 on at
    RE: Consume Custom AIF service In AX

    you don't provide us with any detail about the error so it is very hard to identify the issue you face , but can you try to use set SetValue method instead of add it may work with you.

    let us know more about that.

  • Martin Dráb Profile Picture
    Martin Dráb 230,235 Most Valuable Professional on at
    RE: Consume Custom AIF service In AX

    If you get an error, the first step is finding more information about the error. First of all, look at the error message. Then you can also debug the code.

    If you need our help, make sure you share all the details with us.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans