XMLport & BLOB

lyot
Member Posts: 202
I'm having some troubles with the following code:
The file blob.xml is created correct with the right content but... Customer.xml is strangely enough empty ](*,)
IF NOT ISCLEAR(lautXmlHttp) THEN CLEAR(lautXmlHttp); CREATE(lautXmlHttp); IF NOT ISCLEAR(lautXmlDoc) THEN CLEAR(lautXmlDoc); CREATE(lautXmlDoc); lautXmlDoc.async := FALSE; lautXmlDoc.validateOnParse := FALSE; lautXmlDoc.setProperty('ProhibitDTD',FALSE); recTmpXml.INIT; recTmpXml."Entry No." := 0; recTmpXml.INSERT; recTmpXml.Xml.CREATEOUTSTREAM(outXmlStream); lxmlCustomer.SETDESTINATION(outXmlStream); lxmlCustomer.EXPORT; recTmpXml.MODIFY; recTmpXml.Xml.EXPORT('c:\blob.xml'); recTmpXml.CALCFIELDS(Xml); IF recTmpXml.Xml.HASVALUE THEN recTmpXml.Xml.CREATEINSTREAM(inXmlStream); lautXmlDoc.load(inXmlStream); //TEST lautXmlDoc.save('c:\Customer.xml');
The file blob.xml is created correct with the right content but... Customer.xml is strangely enough empty ](*,)
0
Answers
-
lautXmlHttp Automation 'Microsoft XML, v6.0'.XMLHTTP60
lautXmlDoc Automation 'Microsoft XML, v6.0'.DOMDocument
lxmlCustomer XMLport Export Customer0 -
try to comment out the following code.
lautXmlDoc.validateOnParse := FALSE;
lautXmlDoc.setProperty('ProhibitDTD',FALSE);
your code looks fine otherwise.0 -
-
When I place
inXmlStream.READTEXT(bstr,1024); MESSAGE(bstr);
BeforelautXmlDoc.load(inXmlStream);
I get output, so the stream does contain data.0 -
which executable version of NAV are you using?0
-
-
try it on a newer exe.0
-
Try to add CALCFIELDS before you export the BLOB...0
-
lyot wrote:
lxmlCustomer.SETDESTINATION(outXmlStream); lxmlCustomer.EXPORT; recTmpXml.MODIFY; recTmpXml.CALCFIELDS(Xml); //----add this line recTmpXml.Xml.EXPORT('c:\blob.xml');
0 -
kine wrote:Does it mean that you have tried this?
lxmlCustomer.SETDESTINATION(outXmlStream); lxmlCustomer.EXPORT; recTmpXml.MODIFY; recTmpXml.CALCFIELDS(Xml); //----add this line recTmpXml.Xml.EXPORT('c:\blob.xml');
Yep, and even without the calcfields there isn't a real problem because the blob.xml alwasys contains the right data.
The problem starts when I load the contents of the blob in a InStream and when I load that Instream in a XML doc.recTmpXml.CALCFIELDS(Xml); IF recTmpXml.Xml.HASVALUE THEN recTmpXml.Xml.CREATEINSTREAM(inXmlStream); lautXmlDoc.load(inXmlStream); //TEST lautXmlDoc.save('c:\Customer.xml');
Just to be sure if my xmldoc contains the right data, I save it to a file (debugging purpose).
The file customer.xml is created but it contains no data... at that point I'm quite sure that the rest of my code who will send the xml doc to a webservice
will not work either.0 -
Ok, I missed this part...
When I need to export XMLPort into xmldom,I am using this structure:lreTempBlob.Blob.CREATEOUTSTREAM(losStream); XMLPORT.EXPORT(XMLPORT::"Export Customers",losStream); lreTempBlob.Blob.CREATEINSTREAM(lisStream); lauXmlDom.load(lisStream);
I am not doing insert, modify, calcfields etc. and it is working for me... :-k (lreTempBlob is temporary record over table 99008535)0 -
-
For debugging purposes I have written the following:
CreateInStream; WHILE NOT (inXmlStream.EOS()) DO BEGIN int:= inXmlStream.READTEXT(test,100); MESSAGE(test + ' Size: ' + FORMAT(int)); END; lautXmlDoc.load(inXmlStream);
This shows me the content of inStream and it contains my xml file... So no problem there.0 -
When I activate the code that actualy sends the xml file to my webservice, I get the following error:
Microsoft Business Solutions-Navision
This message is for C/AL programmers:
The call to member send failed. msxml6.dll returned the following message:
Een naam bevat een ongeldig teken. (The name contains an invalid character)
OK
Unless a blank file is considered as an invalid character...?
Maybe there's an invalid character in the xml that prevents lautXmlDoc.save('c:\Customer.xml');
Just guessing...0 -
Problem fixed...
There we're spaces in the element names of the exported xml... #-o #-o #-o0
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