Hi All,
i am trying to update one newly created table called "GLentrymap" from one Navision DB to other (NAV to NAV)using web services and i have published one codeunit as web service in my NAV DB2(we can call it as NAV_Dest) and that codeunit consist a simple function called"upadateglentrymap" just to update the data in respective table(GLentrymap) and have written one more codeunit in NAV DB1 (NAV_Source) ,So when i ran this codeunit i am getting error like "Http error 401: Unauthorized ".
so pls help on that!!
here is my code for NAV DB1 (NAV_Source):
IF ISCLEAR(XmlHttp) THEN
CREATE(XmlHttp, TRUE,TRUE);
IF ISCLEAR(XmlDoc) THEN
CREATE(XmlDoc);
XmlDoc.async(FALSE);
//call webservice updateGLentrymap table
XmlHttp.open('POST','localhost/.../codeunittest',FALSE,
'username','pass');
XmlHttp.setRequestHeader('Content-Type', 'text/xml; charset=utf-8');
XmlHttp.setRequestHeader('SOAPAction', 'upadateglentrymap');
//<?xml version="1.0" encoding="utf-8"?>
XmlHttp.send(
'<soapenv:Envelope xmlns:soapenv="schemas.xmlsoap.org/.../envelope" '+
' xmlns:nav="urn:microsoft-dynamics-schemas/codeunit/codeunittest"> '+
'<soapenv:Body> '+
'<nav:updateGLenrymap> '+
'<nav:no>'+FORMAT(GLEntryMap."G/L Entry no")+'</nav:no> '+
'<nav:mapping_Account>'+GLEntryMap."Mapping account"+'</nav:mapping_Account> '+
'</nav:updateGLenrymap> '+
'</soapenv:Body> '+
'</soapenv:Envelope>');
// XmlHttp.send(soap);
//MESSAGE('%1',GLEntryMap."G/L Entry no");
IF XmlHttp.status <> 200 THEN
ERROR('Http error '
+ FORMAT(XmlHttp.status)+': '+XmlHttp.statusText + ' ' +XmlHttp.responseText);
XmlDoc.load(XmlHttp.responseXML);
MESSAGE(XmlHttp.statusText+'\\'+XmlDoc.text);
*This post is locked for comments