Hi all
I'm having a REALLY bad week so I'm hoping someone can help with this little frustration :-)
I'm trying to write a piece of JavaScript which calls a NAV Webservice. Now I've played about a lot with webservices but it's normally me calling them from NAV rather than calling a NAV one. On top of this, I don't really know JavaScript :-)
Anyway, I have a simple NAV webservice which adds a record to a table. I am trying to call it as a SOAP web service but don't mind if there's a better option such as OData. I have also tried both with windows logins and NAVUserPassword (https) and get the same error.
The error is:
Server instance: DynamicsNAV110CU1
Tenant: <ii>default</ii>
<ii>Session type: WebServiceClient
Session ID: 10
This licence is not compatible with this version of Dynamics NAV.</ii>
The html page is as follows:
<html>
<head>
<title>SOAP JavaScript Client Test</title>
<script type="text/javascript">
function soap() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('POST', '
http://xxx.xxx.co.uk:7047/DynamicsNAV110CU1/WS/Codeunit/BraintreeWebFunctions');
// build SOAP request
var sr =
'<?xml version="1.0" encoding="utf-8"?>' +
'<soap:Envelope xmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="
http://www.w3.org/2001/XMLSchema">' +
'<soap:Body><CreateCustomerPaymentNonce xmlns="urn:microsoft-dynamics-schemas/codeunit/BraintreeWebFunctions">' +
'<custID>WEB</custID>' +
'<nonce>Friday C</nonce>' +
'</CreateCustomerPaymentNonce>' +
'</soap:Body>' +
'</soap:Envelope>';
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
alert('done. use firebug/console to see network response');
}
}
}
// Send the POST request
xmlhttp.setRequestHeader("Authorization", "Basic " + btoa("xxx.xxx@xxx.co.uk:xxx"));
xmlhttp.setRequestHeader('Content-Type', 'text/xml; charset=utf-8');
xmlhttp.withCredentials = true;
xmlhttp.send(sr);
// send request
// ...
}
</script>
</head>
<body>
Test
<form name="Demo" action="" method="post">
<div>
<input type="button" value="Soap" onclick="soap();" />
</div>
</form>
</body>
</html>
Now I've tried shorted Service Names and Database Names. It also works with Web Service Studio and I can run the RTC with no issues.
Anyone have any suggestions?
Cheers
Chris