Hello All,
I have a query regarding the consuming a web services through navision I am getting two problem:-
1.When I am running this code it is giving response of 400 which is bad request.The web service is working fine it is giving result, when run through browser.
- The second problem is that it is giving error when i tried to take output by Commenting the status = 200 Line -
Microsoft Dynamics NAV
A DotNet variable has not been instantiated. Attempting to call MSXML.IXMLDOMNode.text in CodeUnit : OnRun
OK
The code I have mentioned below-
IF ISNULL(DotNetXmlDoc) THEN
DotNetXmlDoc := DotNetXmlDoc.DOMDocumentClass;
IF ISNULL(DotNetXmlHttp) THEN
DotNetXmlHttp := DotNetXmlHttp.XMLHTTPRequestClass;
DotNetXmlHttp.open(‘POST’,‘localhost/MyWebservice.asmx’,0,0,0);
DotNetXmlHttp.setRequestHeader(‘Host’,‘localhost’);
DotNetXmlHttp.setRequestHeader(‘Content-Type’,‘text/xml; charset=utf-8’);
DotNetXmlHttp.setRequestHeader(‘Content-Length’,‘Length’);
DotNetXmlHttp.setRequestHeader(‘SOAPAction’,'tempuri.org/mymethodname’);
DotNetXmlHttp.send(’<?xml version="1.0" encoding="utf-8"?>’
+’<soap:Envelope xmlns:xsi="www.w3.org/…/XMLSchema-instance" xmlns:xsd="www.w3.org/…/XMLSchema" xmlns:soap="schemas.xmlsoap.org/…/">’
‘soap:Body’+
‘’](http://tempuri.org/) +
‘’+“CustNo.”+’’+
‘’+FORMAT(Amount)+’’+
‘</soap:Body>’+
‘</soap:Envelope>’);
DotNetXmlDoc.load(DotNetXmlHttp.responseBody);
IF DotNetXmlHttp.status = 200 THEN BEGIN
DotNetXmlNodeList := DotNetXmlDoc.getElementsByTagName(‘soap:Body’);
IF ISNULL(DotNetXmlNode) THEN
DotNetXmlNode := DotNetXmlNodeList.item(0);
EVALUATE(Output,UPPERCASE(DotNetXmlNode.text(’’)));
// MESSAGE(Output);
END;
Please advise me for the same.
Thanks in advance.