javascript to call Navision Web Service..

ForeverBlue
Member Posts: 54
I have been reading a lot on http://blogs.msdn.com/b/freddyk/ about just javascript to call navision.
i have followed http://blogs.msdn.com/b/freddyk/archive/2010/01/19/connecting-to-nav-web-services-from.aspx by adding <add key="WebServicesUseNTLMAuthentication" value="true"></add> into CustomerSettings.config.
then base on http://blogs.msdn.com/b/freddyk/archive/2010/01/21/connecting-to-nav-web-services-from-javascript.aspx I builded a function just to display the company name but at xmlhttp.open('POST', URL, false);
, I have "Access is denied" error. Does anyone have any idea about this??
Thanks
i have followed http://blogs.msdn.com/b/freddyk/archive/2010/01/19/connecting-to-nav-web-services-from.aspx by adding <add key="WebServicesUseNTLMAuthentication" value="true"></add> into CustomerSettings.config.
then base on http://blogs.msdn.com/b/freddyk/archive/2010/01/21/connecting-to-nav-web-services-from-javascript.aspx I builded a function just to display the company name but at xmlhttp.open('POST', URL, false);
, I have "Access is denied" error. Does anyone have any idea about this??
Thanks
0
Comments
-
Hello,
The use who is accessing Web Service application should be domain user and it should have permission given in Navision.
Is that User added to NAV and given Persimission ? If Yes and still facing problem then Check whether that User is DBOwner for Database to which User try to access.0 -
Hi
I have been test that javascript on the same server as navsion web service and login as administrator so I have all the access right...0 -
Hi
Try to use this html file to connect to NAV WS (IE confirms security alert to continue if u open it) :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head><title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" language="JavaScript">
var baseURL = 'http://YourServerName:7047/DynamicsNAV/WS/SystemService';
// Function to Invoke a NAV WebService and return data from a specific Tag in the responseXML
function InvokeNavWS(URL) {
var result = null;
try {
var xmlhttp;
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}
else {// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
var request = '<Soap:Envelope xmlns:Soap="http://schemas.xmlsoap.org/soap/envelope/">' +
'<Soap:Body>' + '<Companies xmlns="urn:microsoft-dynamics-schemas/nav/system/"></Companies>' +
'</Soap:Body></Soap:Envelope>';
// Use Post and non-async
xmlhttp.open('POST', URL, false);
xmlhttp.setRequestHeader('Content-type', 'text/xml; charset=utf-8');
xmlhttp.setRequestHeader('Content-length', request.length);
xmlhttp.setRequestHeader('SOAPAction', 'Companies');
// Setup event handler when readystate changes
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
result = xmlhttp.responseXML.text;
}
else {
result = xmlhttp.statusText;
}
}
}
xmlhttp.send(request);
}
catch (e) {
result = e.description;
}
return result;
}
function GetCompList() {
CompList.innerHTML = InvokeNavWS(baseURL);
return;
}
</script>
</head>
<body>
<p><button type="button" value="Execute" onclick="GetCompList(); return false;" id="btnGetCompList">Get Company List</button></p>
<form id="CompList"/>
</body>
</html>0 -
Please, can anybody post javascript example for creating record in nav ? Or inserting data in current record ? Thanks0
-
You don't wanna go straight in to NAV from javascript/site, you should have a web service bridge with some external authentication.. put some auth in the soap-header.. and its easier to let your asmx-service talk to NAV than javascript.. if u go IIS..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