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:
<?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>
Answers
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.