Webservice using xmlport error- parameter in method is null

skulla
Member Posts: 140
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.
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
-
You need to set the parameter to something different than null when calling the function. And check the min occurance on the nodes of the xmlport, because if there is Once, there cannot be null....0
-
Kamil thank you for your reply. I am passing parameter to the function call.
ExportCurrency expcurrency = new ExportCurrency();
ExportCurrency_Result ExpCurrResult = await Services.ExportCurrencyAsync(expcurrency);
I have also checked the nodes MinOccurs property they all set to once.0 -
I have also checked the nodes MinOccurs property they all set to once.
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.0 -
I currently have only two fields from currency table which is code and description, so they have values. I am thinking the error is happening because of pass by reference.0
-
I recommend testing the exposed webservice with a tool such as SoapUI or Storm and see whether everything works as expected. This can help you narrow down whether the issue is in your C# code or your NAV app. Though this sounds mostly like it's in the C# code...
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.0 -
I got the same error some days back and that happened because of case mismatch in the parameter name. For eg, in the function in codeunit , the parameter is defined as filepath where as when I am calling that function through SOAP , I have written as <Filepath>.
Once I changed that to <filepath> it worked.0 -
Thank you for the replies, my webservice connection is working and i tested this using SOAPUI. The parameter names does match. I am still getting same error i strongly believe that NAV WS is not supporing call by reference asynchronously, i ended up creating a function in codeunit and in that function i exported XMLport and returned back the text string with XML. I exposed that codeunit as webservice and everything works as expected.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions