webSevics

artur+1
Member Posts: 18
Hi All,
I would like to ask one question:
Is it possible to send data to web service from Navision C/AL?
EX: I want to send parameters(Document No, Document Type) to web service after every posting of a document
in Navision 2013
Thanks in advance
I would like to ask one question:
Is it possible to send data to web service from Navision C/AL?
EX: I want to send parameters(Document No, Document Type) to web service after every posting of a document
in Navision 2013
Thanks in advance
0
Comments
-
Sure, look through these
http://www.dynamics.is/?tag=soap-services
and
http://www.dynamics.is/?tag=web-services________________________________
Gunnar Gestsson
Microsoft Certified IT Professional
Dynamics NAV MVP
http://www.dynamics.is
http://Objects4NAV.com0 -
Hi,
I have seen your example for webservice dotnet, but I didn't undestood where the codeunit should be installaed, on the NAV caller or on the NAV called?
I have to call, from a Server NAV2013 A one codeunit on Server NAV2013 B.
Actually I have doing this procedure on Server A, but don't work when the procedure called the codeunit on Server B
( WinHTTP.open('POST',ServiceURL,FALSE,Username,Password); ), the Server B or the service NAV on ( I suppose ) don't recognizes the Username e Password.
Becouse you have had more experience, can you see my code, belove, and give me any suggestion?
GetSetup;
CREATE(XMLDoc,TRUE,TRUE);
XMLProsInstr := XMLDoc.createProcessingInstruction('xml','version="1.0" encoding="utf-8"');
XMLDoc.appendChild(XMLProsInstr);
CreateEnvelope(XMLElement1);
XMLElement2 := XMLDoc.createElement('soap:Body');
XMLElement3 := XMLDoc.createElement('GetFarmerTankEntryAverageYW');
XMLElement3.setAttribute('xmlns','urn:microsoft-dynamics-schemas/codeunit/RMWeb');
CreateElement(XMLElement3, 'farmerID', FORMAT(FarmerID,0,9), '', '');
CreateElement(XMLElement3, 'No', Nr, '', '');
CreateElement(XMLElement3, 'tankEntryXML', '', '', '');
XMLElement2.appendChild(XMLElement3);
XMLElement1.appendChild(XMLElement2);
XMLDoc.appendChild(XMLElement1);
WinHTTP.open('POST',ServiceURL,FALSE,Username,Password);
WinHTTP.setRequestHeader('Content-Type','text/xml; charset=utf-8');
WinHTTP.setRequestHeader('SOAPAction','GetFarmerTankEntryAverageYW');
WinHTTP.send(XMLDoc);
IF WinHTTP.status <> 200 THEN
ERROR(Text003,WinHTTP.status,WinHTTP.statusText);
XMLResponseDoc.load(WinHTTP.responseXML);
DisplayDocument(XMLResponseDoc);
GetSetup()
ServiceURL :='http://192.168.1.10:7107/DynNav71_VT7-TEST/WS/VT7-TEST/Codeunit/D01';
// http://SV-IU-DEV.sv-iu.iperutility:7107 ... deunit/D01
Username := '';
Password := '';
IF ISCLEAR(WinHTTP) THEN
CREATE(WinHTTP,FALSE,TRUE);
IF ISCLEAR(XMLResponseDoc) THEN
CREATE(XMLResponseDoc,TRUE,FALSE);
DisplayDocument(VAR XMLResponseDoc : Automation "'Microsoft XML, v6.0'.DOMDocument60")
XMLBuffer.Read(XMLDoc);
COMMIT;
FORM.RUNMODAL(FORM::"XML Buffer");
CreateEnvelope(VAR InElement : Automation "'Microsoft XML, v6.0'.IXMLDOMElement")
InElement := XMLDoc.createElement('soap:Envelope');
InElement.setAttribute('xmlns:soap','http://schemas.xmlsoap.org/soap/envelope/');
InElement.setAttribute('xmlns:xsi','http://www.w3.org/2001/XMLSchema-instance');
InElement.setAttribute('xmlns:xsd','http://www.w3.org/2001/XMLSchema');
CreateElement(VAR InElement : Automation "'Microsoft XML, v3.0'.IXMLDOMElement";InNodeName : Text[50];InNodeValue : Text[250];InAttribu
TempElement := XMLDoc.createElement(InNodeName);
TempElement.nodeTypedValue(InNodeValue);
IF InAttributeName <> '' THEN
TempElement.setAttribute(InAttributeName,InAttributeValue);
InElement.appendChild(TempElement);0
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