Hello Everyone,
I am building a simple .net application using VS 2012. I have published a codeunit in Navision which has one single function with xmlport as parameter. I have added Navision web service using service reference and I am using asynchronous methods of the web service to call the function but when ever I call my method I am getting Parameter xxxxx in method xxxxx in service xxxxxx is null. If I change my codeunit function parameter to normal instead of passing it by reference I do not get that error but also I don't get any data back from Navision. I do not want to use synchronous methods. Any help or suggestions are appreciated.
p.s. If I use VS 2010 with synchronous methods then call is working fine.
0
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
ExportCurrency expcurrency = new ExportCurrency();
ExportCurrency_Result ExpCurrResult = await Services.ExportCurrencyAsync(expcurrency);
I have also checked the nodes MinOccurs property they all set to once.
ArcherPoint, Inc http://www.archerpoint.com
Blog: http://www.navisionworld.com
skkulla
If there is Once, you need to create all objects inside the object to not have any null inside. If you want to have possibility to pass null, you need to set the min occurance to Zero and make the value optional in this way.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
ArcherPoint, Inc http://www.archerpoint.com
Blog: http://www.navisionworld.com
skkulla
If you're sure that "expcurrency" is set to pass by reference in NAV, then to me it looks like something went wrong when the service reference was added in VS. I would expect that the C# proxy required the "ref" keyword on the parameter. However, I haven't used the new async/await keywords in C# myself yet, so I may be mistaking.
You mentioned that the synchronous generated version of the method works. A workaround may be to start a thread with the service call, and do a thread.join or something similar in the place where you need the result.
Once I changed that to <filepath> it worked.
ArcherPoint, Inc http://www.archerpoint.com
Blog: http://www.navisionworld.com
skkulla