IF ISCLEAR(XmlHttp) THEN CREATE(XmlHttp, TRUE,TRUE); IF ISCLEAR(XmlDoc) THEN CREATE(XmlDoc); XmlDoc.async(FALSE); // call webservice CreateUpdateGLAccount url := 'http://server:7047/NAV_Dest/WS/companyName/Codeunit/IntegrationService'; XmlHttp.open('POST', url, FALSE); XmlHttp.setRequestHeader('Content-Type', 'text/xml; charset=utf-8'); soap := '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" '+ ' xmlns:nav="urn:microsoft-dynamics-schemas/codeunit/IntegrationService"> '+ '<soapenv:Body> '+ '<nav:CreateUpdateGLAccount> '+ '<nav:no>'+GLAccount."No."+'</nav:no> '+ '<nav:name>'+GLAccount.Name+'</nav:name> '+ '</nav:CreateUpdateGLAccount> '+ '</soapenv:Body> '+ '</soapenv:Envelope>'; XmlHttp.send(soap); IF XmlHttp.status <> 200 THEN ERROR('Http error ' + FORMAT(XmlHttp.status)+': '+XmlHttp.statusText + ' ' +XmlHttp.responseText); XmlDoc.load(XmlHttp.responseXML); MESSAGE(_url+'\\'+_soap+'\\'+XmlHttp.statusText+'\\'+XmlDoc.text);
CreateUpdateGLAccount(No : Code[20];Name : Text[30]) GLAccount.RESET; GLAccount.INIT; GLAccount.VALIDATE("No.", No); GLAccount.VALIDATE(Name, Name); IF NOT _GLAccount.INSERT(TRUE) THEN BEGIN GLAccount.MODIFY(TRUE); EXIT('updated'); END ELSE EXIT('inserted');
XmlHttp.setRequestHeader('SOAPAction', 'CreateUpdateGLAccount2');but then I get an error "SOAP message is invalid!'.
Comments
xmlhttp.open('POST', url, FALSE, USERNAME, PASSWORD);
no luck, still same problem.
It's really strange, I can call any external Webservice from NAV, I can call my NAV webservice from C#, but I'm not able get it work when I try to call a NAV Webservice from different NAV Instance.