Announcements
I have been developing in AX for years but this is the first time I have used the process to consume a third party service in a c# data project in VS and then add this to AX for use in the application.
I have a third party service that I have downloaded correctly into VS and when I write a test method to connect to it there, it executes and returns data without any issue.
I have followed the MS technet guide for consuming a web service, I have allowed it to run on the client and server and I have deployed without error and added to the AOT.
The project is now present in my AOT and I can call the third party class and its types/functions within a test job.
My issue is that when I try to execute the function to call the service and return the information, the call appears to work but I am not getting any data returned to my data contracts that I inherited from the web service.
I have attached an image to illustrate my test job
When I run a debugger with it I am unable to see the values coming back - also when I try to assign data members or obtain data from them - I get exceptions saying the data member is not part of that class etc even though they clearly are.
It is like no data is being returned.
As I said, in VS this is all working fine and I am at a loss to work out why I'm not getting data back into AX
Any help here would be appreciated
Thanks
Kauto
Hi Martin
Sorry only replying now
I think my confusion has come from the fact I thought I might be able to debug inside the job but on reflection yes I would need to compile the CIL and then run it as a batch/server side process and debug in VS.
I did apply some code as below and I can confirm I am now able to get data out.
The results as below in the infolog:
I think the lack of ability to debug inside my test job led me to believe it wasn't set up correctly when in fact I had it correct from day 1.
Clearly this is not an issue in D365 but for AX development on integrations I'll bear this in mind going forward.
Thank you kindly again
I think you should be able to get the value (from what you describe), but if you share the Json request for .Net code with us, we can better understand the relationship between the objects
You seem to be saying that the information about getting no data was wrong, because the array does contain two elements. The problem is somewhere else.
That array elements aren't displayed in the debugger is no problem; the X++ debugger doesn't provide this information for CLR array. But the data is there and you can work with it. If you want to see values directly in debugger, generate CIL from your X++ code, run it as CIL (e.g. through SysOperation framework) and use Visual Studio to debug this code.
You said that you tried to call orderDataValue = orderData.get_Item(0), but it's not clear whether you got the expected object or not. Please confirm. Also, how do you know that CustomerName is there if you're unable to get the value?
Note that I'm still missing your explanation of "I get exceptions saying the data member is not part of that class".
Hi Martin,
I hoped it might be you that would reply on this.
I have confirmed the correct values are being passed across to the service, exactly the same as if I send them in my visual studio method.
It looks to me like I am getting a response back to the objectList
The orderData value is actually an Array so I have defined it correctly now [ and this has taken me a step forward
I am now able to get the count value and indeed it is correct = 2 as I know there are 2 records returned.
My issue appears to be I can't seem to get the data out of the orderData value in the array.
If I add the following 2 lines:
orderDataValue = orderData.get_Item(0); // where orderDataValue is an instance of orderData custName = orderDataValue.get_CustomerName(); // here I don't get any value assigned even though I know it is there
I am getting closer just need a further prompt
Do I understand correctly that you successfully get an instance of OrderResponseListObject class but its orderdata property contains an empty array (or null)?
Are you sure that sakesParm.TokenId and salesParm.SiteId contain exactly the same data that you used when running your library in Visual Studio?
Please tell us more about "when I try to assign data members or obtain data from them - I get exceptions saying the data member is not part of that class". This clearly shows that you have a problem somewhere.
André Arnaud de Cal...
294,079
Super User 2025 Season 1
Martin Dráb
232,860
Most Valuable Professional
nmaenpaa
101,158
Moderator