so bear with me if I'm doing anything wrong.
i have been trying to update some data in Nav from C#, but whatever i do i get errors:
my code Unit looks like this, this is my method i need to use to update:
<operation name="OpdaterVogn">
<operation soapAction="urn:microsoft-dynamics-schemas/codeunit/BMG:OpdaterVogn"style="document"/>
<input name="OpdaterVogn">
<body use="literal"/>
</input>
<output name="OpdaterVogn_Result">
<body use="literal"/>
</output>
</operation>
ill show u my objects i get passed via my codeunit aswell:
<schema elementFormDefault="qualified" targetNamespace="urn:microsoft-dynamics-nav/xmlports/x78001">
<complexType name="VognType">
<sequence>
<element minOccurs="1" maxOccurs="1" name="Kode" type="string"/>
<element minOccurs="1" maxOccurs="1" name="RegNr" type="string"/>
<element minOccurs="1" maxOccurs="1" name="Beskrivelse" type="string"/>
<element minOccurs="1" maxOccurs="1" default="false" name="Spaerret" type="boolean"/>
</sequence>
</complexType>
<complexType name="Vogn" mixed="true">
<sequence>
<element minOccurs="1" maxOccurs="unbounded" name="Vogn" type="tns:VognType"/>
</sequence>
</complexType>
<element name="Vogn" type="tns:Vogn"/>
</schema>
anyway, moving on to C#, i can get the data over to C# and review it. Now i want to update a "vogn" with the method.
at the moment my code looks like this:
BMGWS ws = new BMGWS();
Vogn vogne = new Vogn();
VognType vogn = new VognType();
ws.UseDefaultCredentials = true;
ws.SendVogn("BMG 2013", false, ref vogne);
vogn = vogne.Vogn1[0];
string kode = vogn.Kode;
string beskrivelse = vogn.Beskrivelse;
string regnr = vogn.RegNr;
bool spaerret = vogn.Spaerret;
Vogn vogneNy = new Vogn();
VognType vognNy = new VognType();
vognNy.Kode = kode; // string value to update
vognNy.Beskrivelse = beskrivelse; // string value to update
vognNy.RegNr = regnr; // string value to update
vognNy.Spaerret = spaerret; // Bool value to update
List<VognType> list = new List<VognType>();
list.Add(vognNy);
vogneNy.Vogn1 = list.ToArray();
vogneNy.Vogn1[0] = vognNy;
ws.OpdaterVogn("BMG 2013", vogneNy);
my last method wont work, i get the following error:
{"The Element <Kode>
is expected by Min Occurs value: Once. Element received: <>
."}
hopefully you guys can help me in here...