Web Services Navision 2016

angelreynosog
Member Posts: 9
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" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 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);
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" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 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);
0
Best Answer
-
Are you trying to get the result status code, or are you trying to store the returned XML?Kyle Hardin - ArcherPoint5
Answers
-
Are you trying to get the result status code, or are you trying to store the returned XML?Kyle Hardin - ArcherPoint5
-
90/5000
I am trying to store the result the XML in a table.
Thank you for your cooperation0 -
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 - ArcherPoint0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions