Problem with 2009 R2 Web Service that should write into the database

HeinrichHeinrich Member Posts: 7
Hi,

we have some problems with WebServices that should write into the NAV database.
Our main solution (NAV 2016 / 2015 / 2013R2) recently got some enhancements with NAV WebServices. But some of our customers are still on NAV 2009 Classic Client and should also get this enhancements. Unfortunately we encounter major difficulties.

The enhancement is based on web services built with Codeunits & XMLPorts. This works like a charme im the newer NAV versions. In NAV 2009 R2 we get errors like below. I built a very small example to show the point:

Request (sent to NAV with SoapUI, based on the WSDL fom NAV):
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tes="urn:microsoft-dynamics-schemas/codeunit/TestWebService" xmlns:x70="urn:microsoft-dynamics-nav/xmlports/x70050">
   <soapenv:Header/>
   <soapenv:Body>
      <tes:TestFunction1>
         <tes:testXMLPort>
            <!--Zero or more repetitions:-->
            <x70:TestTable>
               <!--Optional:-->
               <x70:Nr>0</x70:Nr>
            </x70:TestTable>
         </tes:testXMLPort>
      </tes:TestFunction1>
   </soapenv:Body>
</soapenv:Envelope>

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.Types.Exceptions.NavNCLXmlPortUnexpectedElementException</faultcode>
         <faultstring xml:lang="de-DE">The Element &lt;x70:TestTable> is unexpected.</faultstring>
         <detail>
            <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">The Element &lt;x70:TestTable> is unexpected.</string>
         </detail>
      </s:Fault>
   </s:Body>
</s:Envelope>

It works if we remove all
x70:
from the request. But, up to now, that is not possible in the original request.

It would be really great to get any help on this.

If you like youi nay have a look in the attached objects (from the sample above).
Table 70050
Codeunit 70050
XML Port 70050

Thanks in advance
Heinrich

Answers

  • Peter+is1Peter+is1 Member Posts: 174
    In 2009, we use a stylesheet to remove the namespace from the xml before importing it with an xmlport.

    something like...

    [Build lautXmlStyleSheet]

    XmlSourceDocument.transformNodeToObject(lautXmlStyleSheet, XmlDestinationDocument);
    \\
    The truth exists in seven versions.
Sign In or Register to comment.