Sending xml in blobfield to webservice with dotnet NAV2013

greys
Member Posts: 29
Hi,
I'm upgrading a 2009 database to NAV2013R2 and I am encountering problems with the existing solution of sending a xml to a webservice. Table 'Record' has a field 'XML Message' (blob) which contains a xml-file generated previously by a xmlport. Streams are used to store this content into a xmldomdocument (XMLDoc), which is sent to a webservice later in the process.
Excerpt from code:
Record."XML Message".CREATEINSTREAM(Instr);
Record."XML Message".CREATEOUTSTREAM(OutStr);
Record.CALCFIELDS("XML Message");
IF ISCLEAR(XMLDoc) THEN
CREATE(XMLDoc,FALSE,TRUE);
XMLDoc.load(Instr);
.....
NAV2013 does not like streams apparently, because the above construction halts at the XMLDoc.load(Instr) with the error message 'stream cannot be used with client-side invoked automation'. Changing the third parameter into FALSE does not solve a thing, because NAV2013 won't let me save the object then (error 'You cannot create an Automation object "XMLDoc" on Microsoft Dynamics NAV Server. You must create it on a client computer')......
Since I would like to not be depending on automations anymore, I would love to switch to a dotnet solution. Is there anyone who can help me achieve the same functionality by using dotnet variables? So what I want is loading the xmlcontent of a blob file into a XMLDoc-variable.
Any help would be greatly appreciated!
Best regards,
Greys
I'm upgrading a 2009 database to NAV2013R2 and I am encountering problems with the existing solution of sending a xml to a webservice. Table 'Record' has a field 'XML Message' (blob) which contains a xml-file generated previously by a xmlport. Streams are used to store this content into a xmldomdocument (XMLDoc), which is sent to a webservice later in the process.
Excerpt from code:
Record."XML Message".CREATEINSTREAM(Instr);
Record."XML Message".CREATEOUTSTREAM(OutStr);
Record.CALCFIELDS("XML Message");
IF ISCLEAR(XMLDoc) THEN
CREATE(XMLDoc,FALSE,TRUE);
XMLDoc.load(Instr);
.....
NAV2013 does not like streams apparently, because the above construction halts at the XMLDoc.load(Instr) with the error message 'stream cannot be used with client-side invoked automation'. Changing the third parameter into FALSE does not solve a thing, because NAV2013 won't let me save the object then (error 'You cannot create an Automation object "XMLDoc" on Microsoft Dynamics NAV Server. You must create it on a client computer')......
Since I would like to not be depending on automations anymore, I would love to switch to a dotnet solution. Is there anyone who can help me achieve the same functionality by using dotnet variables? So what I want is loading the xmlcontent of a blob file into a XMLDoc-variable.
Any help would be greatly appreciated!
Best regards,
Greys
0
Comments
-
Hi,
Take a look at this blog.
http://dynamicsuser.net/blogs/waldo/archive/2011/12/20/net-interop-consume-a-third-party-web-service-check-vat-registration-no.aspx
It may be also worth checking that in that codeunit you always have
CREATE(XMLDoc,FALSE,TRUE);
and there is not only
CREATE(XML);
I had a similar problem, and compiler would point to a wrong place in the code, but there was a CREATE(XML); before in the code without ,FALSE,TRUE);
Bottom Line: search for CREATE and make sure that ",FALSE,TRUE);" is always present
I hope this helps.0 -
look at cu 6224 XML DOM Management. it uses dotnet data types0
-
You always can do this:
FileName := FileMgt.ClientTempFileName('xml');
Record."XML Message".EXPORT(FileName);
XMLDoc.load(FileName);
Where:
FileName is Text
FileMgt is codeunit 419 (File Management)
XMLDoc is DotNet System.Xml.XmlDocument.'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'0
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