[XML Records] XmlToRecordList requires RecordList node? Java vs .Net discrepancy

[XML Records] XmlToRecordList requires RecordList node? Java vs .Net discrepancy

  
Forge Component
(23)
Published on 15 Jun by Ricardo Silva
23 votes
Published on 15 Jun by Ricardo Silva
I'm in the middle of transfering over an application from a .NET stack to JAVA stack (both environments are hosted by OutSystems).

Under the new Java envirnoment, I'm not getting the same result from XmlToRecordList action.  I created a test page in the original environment to test the extension and had it working perfectly.  The same page on the Java stack is giving me 'unexpected format. You should have only one root element named <RecordList>' error on the same exact XML and same Code.

https://dev.ikuity.com/AmazonS3Connector/TestXmlToRecordList.aspx
https://thrivent-dev.outsystemsenterprise.com/AmazonS3Connector/Test.jsf

In the XmlToRecordList parameters, I tried passing both 'True' and 'False' for 'BypassRootRecordListNode' with no difference.

If I wrap the xml with <RecordList> tags (something that's not required in the .NET version), I don't get the error, but here's the problem: How can I have different Structures with the same 'RecordList' name?

Also, I thought maybe the BypassRootRecordListNode was meant as a work around to the above problem, so if I wrapped the xml with <RecordList>, it would not ignore that node when deserializing it into a specific Structure...that doesn't seem to happen either.  Previous posts arent' really clear on this, what needs to be done?  Any help is appreciated!  Thanks!
Are you using the "old" Record and Record List types?

If you are using the new List type it won't work.

More info on the new List type here http://www.outsystems.com/forums/discussion/14342/from-record-lists-to-lists/
Hi João, I'm definitely passing a List of Record of my Structure type.
Can you provide a small sample of your code?
Sure thing:

See the attachment, all it's doing is clearing the ListBucketResultRecordList, then passing the typed xml and that same record list. Then refreshing the screen.
And can you show the properties of ListbucketResultRecordList?
Here it is

The default value for the bypass root node parameter is true. Have you tried passing an explicit False there ?
Ricardo Silva wrote:
The default value for the bypass root node parameter is true. Have you tried passing an explicit False there ?
 Yes, the best outcome I get is that it will no longer throw and exception but the action will not populate the record list.
 
Solution
I looked into this and there are two problems:

1) XML Records Java implementation is ignoring the IgnoreXMLDeclarationAndNS parameter, so the XML declaration is causing some parsing issues.

2) The XML you're using is using "Sequence" Mode for record lists, but the default is "Child" mode.

If you simply set the default record list mode to "S" before calling XMLToRecordList, it will correctly process the data.



I have also sent you an email with a modified version of XML records which does not ignore the parameter.

I'll update the component with this version soon.

Solution
That fixed it.  I went ahead and Changed the default value of RecordListMode attribute directly in Integration Studio so as to not mess with it in Studio.  Thanks for the quick turnaround and updated xif, Ricardo!  Very much appreciated!

Hi Marco, How dors this extension work for xml elements with attributes ,i have an xml which has multilevel of child elements and attributes at each element level.dies this extension work for me.
João Heleno wrote:
Are you using the "old" Record and Record List types?

If you are using the new List type it won't work.

More info on the new List type here http://www.outsystems.com/forums/discussion/14342/from-record-lists-to-lists/
 Do you mean this extention wont work with the (new?) List type? 
How can I get it to work then? 
I'm new to OS I don't know about the old and new types, but my version is Version 9.1.300.0 .

Cheers Patrice

Marco Asteriti wrote:

I'm in the middle of transfering over an application from a .NET stack to JAVA stack (both environments are hosted by OutSystems).

Under the new Java envirnoment, I'm not getting the same result from XmlToRecordList action.  I created a test page in the original environment to test the extension and had it working perfectly.  The same page on the Java stack is giving me 'unexpected format. You should have only one root element named <RecordList>' error on the same exact XML and same Code.

https://dev.ikuity.com/AmazonS3Connector/TestXmlToRecordList.aspx
https://thrivent-dev.outsystemsenterprise.com/AmazonS3Connector/Test.jsf

In the XmlToRecordList parameters, I tried passing both 'True' and 'False' for 'BypassRootRecordListNode' with no difference.

If I wrap the xml with <RecordList> tags (something that's not required in the .NET version), I don't get the error, but here's the problem: How can I have different Structures with the same 'RecordList' name?

Also, I thought maybe the BypassRootRecordListNode was meant as a work around to the above problem, so if I wrapped the xml with <RecordList>, it would not ignore that node when deserializing it into a specific Structure...that doesn't seem to happen either.  Previous posts arent' really clear on this, what needs to be done?  Any help is appreciated!  Thanks!


Hi Marco,

I am facing the same issue. Did you get it resolved? If yes, can you please tell me how do I fix this?

Thanks,

Gurvinder


Hello Gurvinder,

Please check my post where I explain what was the issue Marco was facing with the appropriate configurations to get it to work.

Best regards,

Ricardo Silva

Ricardo Silva wrote:

Hello Gurvinder,

Please check my post where I explain what was the issue Marco was facing with the appropriate configurations to get it to work.

Best regards,

Ricardo Silva

Hi Ricardo,

I still get the following error : 

unexpected format. You should have only one root element named <RecordList>

My variable type is : 

XML2RecordList Configuration : 

DefaultConfig:


The format of the XML that I would be receiving would look something like this :

<?xml version="1.0" encoding="UTF-8"?>

<ERROR> 

     <ERRORCODE>E08</ERRORCODE>

     <ERRORSTRING>INVALID MERCHANTREF</ERRORSTRING>

 </ERROR>


Have you tried passing False to "BypassRootRecordList" ?

Ricardo Silva wrote:

Have you tried passing False to "BypassRootRecordList" ?


Yeah, then I get an error saying "No value present".