4

I`m trying to call a Nav 2013 R2 web service codeunit with a custom SOAP command and I get a response indicating that the parameters being passed are null, which they are not.

Does anyone have an answer as to why this is happening or could point me in a direction that could help solve this? Thanks!

Here is the SOAP request:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><TransferOrderCreate xmlns="urn:microsoft-dynamics-schemas/Codeunit/WebTestCodeunit"><ptext>this is some text</ptext><pint>999</pint></TransferOrderCreate></soap:Body></soap:Envelope>

Here is the SOAP response:

<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.WebMetadata.ServiceBrokerException</faultcode><faultstring xml:lang="en-CA">Parameter ptext in method TransferOrderCreate in service WebTestCodeunit is null! </faultstring><detail><string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">Parameter ptext in method TransferOrderCreate in service WebTestCodeunit is null! </string></detail></s:Fault></s:Body></s:Envelope>

Here is the service as exposed by Nav:

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:microsoft-dynamics-schemas/codeunit/WebTestCodeunit" targetNamespace="urn:microsoft-dynamics-schemas/codeunit/WebTestCodeunit" debug="true">
<script id="FirebugLite" firebugIgnore="true" extension="Chrome"/>
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:microsoft-dynamics-schemas/codeunit/WebTestCodeunit">
<element name="TransferOrderCreate">
<complexType>
<sequence>
<element minOccurs="1" maxOccurs="1" name="ptext" type="string"/>
<element minOccurs="1" maxOccurs="1" name="pint" type="int"/>
</sequence>
</complexType>
</element>
<element name="TransferOrderCreate_Result">
<complexType>
<sequence>
<element minOccurs="1" maxOccurs="1" name="return_value" type="string"/>
</sequence>
</complexType>
</element>
</schema>
</types>
<message name="TransferOrderCreate">
<part name="parameters" element="tns:TransferOrderCreate"/>
</message>
<message name="TransferOrderCreate_Result">
<part name="parameters" element="tns:TransferOrderCreate_Result"/>
</message>
<portType name="WebTestCodeunit_Port">
<operation name="TransferOrderCreate">
<input name="TransferOrderCreate" message="tns:TransferOrderCreate"/>
<output name="TransferOrderCreate_Result" message="tns:TransferOrderCreate_Result"/>
</operation>
</portType>
<binding name="WebTestCodeunit_Binding" type="tns:WebTestCodeunit_Port">
<binding xmlns="http://schemas.xmlsoap.org/wsdl/soap/" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="TransferOrderCreate">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:microsoft-dynamics-schemas/codeunit/WebTestCodeunit:TransferOrderCreate" style="document"/>
<input name="TransferOrderCreate">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</input>
<output name="TransferOrderCreate_Result">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</output>
</operation>
</binding>
<service name="WebTestCodeunit">
<port name="WebTestCodeunit_Port" binding="tns:WebTestCodeunit_Binding">
<address xmlns="http://schemas.xmlsoap.org/wsdl/soap/" location="http://lt0619.xx.xxxxxxxxx.xx:11047/Trunk/WS/7002/Codeunit/WebTestCodeunit"/>
</port>
</service>
</definitions>
Doug J. Huras
  • 637
  • 1
  • 10
  • 19
  • I'm afraid I'm asking the same question in every post about Nav WS. Have you tried to consume wsdl of your service with something like SOAPui and let it create valid soap requests for you? I can't see if something wrong with your request but anyway. – Mak Sim Sep 12 '15 at 06:33
  • Thanks. I'm primarily using Fiddler Web Debugger. When I monitor the messages from the browser with Fiddler, I see the "null" error. When trying to send the message directly from Fiddler, I get "401 Unauthorized" responses. I'm still trying to figure out the Fiddler setup to get around this error, in order to get to "my" error. – Doug J. Huras Sep 14 '15 at 13:35
  • Don't know if Fiddler can handle NTLM. A time ago I was able to [handle authorization](http://stackoverflow.com/a/25357700/1820340) in SOAPui. This app can send request to your WS and you will be able to monitor it with Fiddler if there sill be the null-error. If not, you will get propper request and send it with whatever you are using. – Mak Sim Sep 15 '15 at 07:45

1 Answers1

2

Check namespaces in wsdl definition and your request. Namespaces are case sensitive.

wsdl:

urn:microsoft-dynamics-schemas/codeunit/WebTestCodeunit

reqest:

urn:microsoft-dynamics-schemas/Codeunit/WebTestCodeunit

This could throw the exception you see.

  • Thanks for your help! This was the issue. The error message really put me on the wrong track. Now I can move forward and put this knowledge to some good use. Thanks again. – Doug J. Huras Sep 15 '15 at 20:26