External Web services calling In Navision

gauravshukla
Member Posts: 5
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;
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;
0
Answers
-
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 using0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions