Web Services Navision 2016

I am connected to a Web Services, and I would like to insert the result of this call in a table. Could you help me please?

I leave you an overview of the code I use.


url := 'http://192.168.16.23/CAMESER/cfmsv.asmx';
uriObj := uriObj.Uri(url);
Request := Request.CreateDefault(uriObj);
Request.Method := 'POST';
Request.ContentType := 'text/xml';
soapAction:= '"http://www.respuesta.com/GetContabilidad"';
Request.Headers.Add('SOAPAction',soapAction);
Request.Timeout := 120000;

xml := '<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:xsd="http://www.w3.org/2001/XMLSchema&quot; xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body>'+
'<GetContabilidadResponse xmlns="http://www.respuesta.com/">'+
'<Sociedad>'+Sociedad+'</Sociedad>'+
'</GetContabilidadResponse>'+
'</soap:Body></soap:Envelope>';


//Send the request to the webservices
stream := stream.StreamWriter(Request.GetRequestStream(), ascii.UTF8);
stream.Write(xml);
stream.Close();

//Get the response
Response := Request.GetResponse();
reader := reader.XmlTextReader(Response.GetResponseStream());

//Save the response to a XML
document := document.XmlDocument();
document.Load(reader);

Best Answer

Answers

  • angelreynosogangelreynosog Member Posts: 9
    90/5000
    I am trying to store the result the XML in a table.
    Thank you for your cooperation
  • kylehardinkylehardin Member Posts: 257
    Take a look at table 1235 and codeunit 1235. There are functions in that table for loading either an instream or text. And it parses the xml automatically, but now it's in table records.
    Kyle Hardin - ArcherPoint
Sign In or Register to comment.