I have one database in which I run an XMLPort that creates the following XML and send it via http request to a NAV Webservice in an other database.
<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<soap:Envelope xmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="
http://www.w3.org/2001/XMLSchema">
<soap:Body>
<UpdateC xmlns="urn:microsoft-dynamics-schemas/codeunit/CWSMgt">
<importdata>
<CHead>
<No>4</No>
<Title>4 Test</Title>
<Date>10.12.13</Date>
<Author>JR</Author>
<TNo>T12345</TNo>
</CHead>
</importdata>
</UpdateC>
</soap:Body>
</soap:Envelope>
In the other databse I have published codeunit CWSMgt as a web service.
This codeunit has a function UpdateC with a parameter called importdata.
First I tried to use an XMLPort as the parameter.
The error that I am getting here is like that:
a:Microsoft.Dynamics.Nav.Types.Exceptions.NavNCLXmlPortInvalidXmlExceptionImported XML cannot validate with the schema: The element 'importdata' has an invalid child Element 'CHead' in Namespace 'urn:microsoft-dynamics-schemas/codeunit/CIDWSMgt'. Expected was the list of possible elements: 'CHead'.
If I alternatively use a BigText as the parameter I seem to get only the node values. But that doesn't seem to be XML anymore. The tags are missing.
UpdateC(importdata : BigText) : Text[1024]
TempBlob.Blob.CREATEOUTSTREAM(loutstr);
importdata.WRITE(loutstr);
TempBlob.CALCFIELDS(Blob);
TempBlob.Blob.EXPORT('C:\Temp\blob.txt');
The file looks like:
4 4 Test 10.12.13 T12345
Any hints on how to overcome the namespace problem or the lost XML formatting in the text variable?
Comments
NAV Developer