I have created a Simple Hello Word Web service on ASP.net and wanted to consume this Web service in Navision.
When I am calling this web service from Navision I am getting "root element is missing" Error.
Microsoft Dynamics NAV
A call to System.Xml.XmlDocument.Load failed with this message: Data at the root level is invalid. Line 1, position 1.
OK
I have written this code.
Url :='http://localhost:55172/WebService.asmx';
reqText := '' + 'HelloWorld' +
'';
// save request text in instream
TempBlob."Primary Key" := 1;
TempBlob.Blob.CREATEOUTSTREAM(ReqBodyOutStream);
ReqBodyOutStream.WRITE(reqText);
TempBlob.Blob.CREATEINSTREAM(ReqBodyInStream);
// run the WebServReqMgt functions to send the request
WebServReqMgt.SetGlobals(ReqBodyInStream,Url,Username,Password);
WebServReqMgt.DisableHttpsCheck;
WebServReqMgt.RUN;
// get the response
WebServReqMgt.SendRequestToWebService();
WebServReqMgt.GetResponseContent(RespBodyInStream);
ResponseXmlDoc := ResponseXmlDoc.XmlDocument;
ResponseXmlDoc.Load(RespBodyInStream);
MESSAGE(ResponseXmlDoc.InnerXml);
END;
Name DataType Subtype Length
Url Text
reqText Text
TempBlob Record TempBlob
ReqBodyOutStream OutStream
ReqBodyInStream InStream
Username Text
Password Text
RespBodyInStream InStream
WebServReqMgt Codeunit SOAP Web Service Request Mgt.
ResponseXmlDoc DotNet System.Xml.XmlDocument.'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
these are the variables which i am using
*This post is locked for comments
I have the same question (0)