mibuso.com

Microsoft Business Solutions online community
It is currently Wed May 22, 2013 8:56 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: javascript to call Navision Web Service..
PostPosted: Tue Nov 08, 2011 12:57 am 
Offline

Joined: Thu Feb 17, 2011 8:00 pm
Posts: 34
Country: United States (us)
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


Top
 Profile E-mail  
 
 Post subject: Re: javascript to call Navision Web Service..
PostPosted: Tue Nov 08, 2011 11:06 am 
Offline

Joined: Tue Sep 23, 2008 1:30 pm
Posts: 105
Country: India (in)
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.


Top
 Profile E-mail  
 
 Post subject: Re: javascript to call Navision Web Service..
PostPosted: Tue Nov 08, 2011 5:07 pm 
Offline

Joined: Thu Feb 17, 2011 8:00 pm
Posts: 34
Country: United States (us)
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...


Top
 Profile E-mail  
 
 Post subject: Re: javascript to call Navision Web Service..
PostPosted: Wed Nov 09, 2011 6:21 am 
Offline

Joined: Fri Jul 28, 2006 5:55 am
Posts: 13
Location: Russia
Country: Russia (ru)
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>


Top
 Profile  
 
 Post subject: Re: javascript to call Navision Web Service..
PostPosted: Wed Feb 15, 2012 2:21 pm 
Offline

Joined: Wed Feb 15, 2012 2:16 pm
Posts: 3
Country: United States (us)
Please, can anybody post javascript example for creating record in nav ? Or inserting data in current record ? Thanks


Top
 Profile E-mail  
 
 Post subject: Re: javascript to call Navision Web Service..
PostPosted: Thu Feb 16, 2012 2:55 am 
Offline

Joined: Tue May 05, 2009 5:30 pm
Posts: 75
Country: Sweden (se)
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..


Top
 Profile E-mail WWW  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: