Web Service

SaalekSaalek Member Posts: 181
edited 2012-11-19 in NAV Three Tier
Hi

I have a problem using web services.
1- I've this XML File (is an example):
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
 xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <navFunction xmlns="urn:microsoft-dynamics-schemas/codeunit/NAV">
      <text>
        <field1>value1</field1>
        <field2>value2</field2>
        <field3>value3</field3>
       </text>
    </navFunction>
  </soap:Body>
</soap:Envelope>

2- I've a published codeunit in Navision to read this file using BigText
navFunction(Text : BigText) Text[1024]
CLEAR(XMLDocument);
CREATE(XMLDocument);
TempBlob.INIT;
TempBlob.Blob.CREATEOUTSTREAM(WriteStream);
TextoEntrada.WRITE(WriteStream);
TempBlob.CALCFIELDS(Blob);
TempBlob.Blob.CREATEINSTREAM(ReadStream);
XMLDocument.load(ReadStream);
XMLNodeList:=XMLDocument.childNodes;
....
....

3- When I call this WS, i receive this error message:
<?xml version="1.0"?>
-<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.Types.Exceptions.NavNCLAutomationVariableNotCreatedException</faultcode><faultstring xml:lang="es-ES">The automation variable has not been instantiated.</faultstring>-<detail><string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">The automation variable has not been instantiated.</string></detail></s:Fault></s:Body></s:Envelope>

Why ?

The problem is that when I call WS, all nodes from XML file disappear, so only have node values.
I modified the function to save in a file the bigtext variable, and I only have this:
value1
value2
value3

If I call this function as a normal Nav function, it works fine.

Someone knows why the nodes disappears ?

Thanks
Sign In or Register to comment.