Connect to Web Serice from Excel VBA - Parameter is null err

HenrikDK
Member Posts: 14
Hi
I am trying to connect to a Web Service from VBA in Excel. It is working fine; I have connected to the Web Service and I have started the code execution in the Codeunit I connect to. Now I wish to add a parameter to the Web Service and it keeps giving me an error that the parameter "pdepartment" is Null!.
I have searched for hours how to solve this and have found a few things that could affect it:
- It is not possible to send parameters in XML to a NAV Web Services from Excel
- You have to be very careful with case (upper / lower) of the function and parameter - I have tried to change it to different things, but it had no effect
Anyone that have an idea what to try? I am getting more and more frustrated.
Thanks in advance.
Yours sincerely
Henrik
The Codeunit

The Web Service

The VBA Code

Which create this XML file:
The Error
I am trying to connect to a Web Service from VBA in Excel. It is working fine; I have connected to the Web Service and I have started the code execution in the Codeunit I connect to. Now I wish to add a parameter to the Web Service and it keeps giving me an error that the parameter "pdepartment" is Null!.
I have searched for hours how to solve this and have found a few things that could affect it:
- It is not possible to send parameters in XML to a NAV Web Services from Excel
- You have to be very careful with case (upper / lower) of the function and parameter - I have tried to change it to different things, but it had no effect
Anyone that have an idea what to try? I am getting more and more frustrated.
Thanks in advance.
Yours sincerely
Henrik
The Codeunit
The Web Service
The VBA Code
Which create this XML file:
<?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <Createjob> <pdepartment>h</pdepartment> </Createjob> </soap:Body> </soap:Envelope>
The Error
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode xmlns:a="urn:microsoft-dynamics-schemas/error">a:Microsoft.Dynamics.Nav.Service.WebServices.ServiceBrokerException</faultcode><faultstring xml:lang="da-DK">Parameter pdepartment in method Createjob in service Job_Functions2 is null! </faultstring><detail><string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">Parameter pdepartment in method Createjob in service Job_Functions2 is null! </string></detail></s:Fault></s:Body></s:Envelope>
0
Answers
-
I found a solution with the help of a friend.
The solution was to add a Namespace in my Createjob part which ended with the name of my Codeunit Web Service, but with the rest being standard.XMLCallString = "<?xml version=""1.0"" encoding=""UTF-8""?>" & _ "<soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">" & _ "<soap:Body>" & _ "<Createjob xmlns=""urn:microsoft-dynamics-schemas/codeunit/Job_Functions"">" & _ "<pdepartment>2</pdepartment>" & _ "</Createjob>" & _ "</soap:Body>" & _ "</soap:Envelope>"
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