[XML Records] XmlToRecordList Question

[XML Records] XmlToRecordList Question

  
Forge Component
(24)
Published on 15 Jun by Ricardo Silva
24 votes
Published on 15 Jun by Ricardo Silva
Maybe someone can provide me with some much needed assistance. I have attached a recently downloaded sample RESTFulWebServiceExample that uses the XmlToRecordList and RecordToXml.  I can not seem to get past the XmlToRecordList in the code.

I am sending the below XML to the application using Postman.  The code gets to the XmlToRecordList and then goes to the All Exceptions.   

<?xml version="1.0" encoding="UTF-8" ?>
 <GetInvoiceNumberRequest>
  <API_Key>abc</API_Key>
  <API_Secret>123</API_Secret>
 </GetInvoiceNumberRequest>

Please note: I am using the OutSystems Cloud and the Java stack but have also tried this using the Community Edition on the .Net stack and had the same results.

Thanks in advance for your help.

Wayne 
For anyone that reads this post in the future, I have solved the problem.  It turns out that the RESTFulWebServiceExample needed some tweaking and didn't work as it was posted.  I had to change the code to pass in a RecordList to the XmlToRecordList instead of a Record. I also had to surround the Xml with <RecordList> as shown below.  Goncalo Borrega mentions this in the XmlToRecordlist conversion posting.
 
<?xml version="1.0" encoding="UTF-8" ?>
<RecordList> 
 <GetInvoiceNumberRequest>
  <API_Key>abc</API_Key>
  <API_Secret>123</API_Secret>
 </GetInvoiceNumberRequest>
</RecordList>
 
I accomplished the adding of the <RecordList> in the Set Xml Assign with the below code.
 
Substr(GetRequestContent.RawContent,0,Index(GetRequestContent.RawContent,"?>")+3) + "<RecordList>" + Substr(GetRequestContent.RawContent,Index(GetRequestContent.RawContent,"?>")+3,Length(GetRequestContent.RawContent)-(Index(GetRequestContent.RawContent,"?>")+3)) + "</RecordList>"
 
Good Luck,
Wayne
That must be happening because you're explicitely passing "False" to the IgnoreRootNode parameter of the XMLToRecordList action. The default behavior is to _not_ need that RecordList extra element.
If you mean the BypassRootRecordListNode parameter of the XmlToRecordList, I am not entering anything in that parameter.  It is blank.

Wayne


Well, for a single Record, you shouldn't need to include the RecordList entity.

Can you try it with just passing a RecordList to the "object" parameter of the XMLToRecordList ?

If you're still having problems with this, please post the current version of your eSpace so we can take a look and try and help you.
Oh ... Are you using the latest version of RESTfulWebServices ?

I believe that version uses some "features" that work in Java but not in .NET, in particular being able to fill in a record by reference.
I have included the RESTfulWebServices I had downloaded and used, see the original top post.  I passed the RecordList to the object parameter of the XMLToRecordList, but the Structure Attributes were empty when I viewed them in the debugger util I surrounded them in the Xml with <Record>. Everything now works.  I am using the XmlRecords version 1.5.1

Wayne
Also, I had to fix the RESTfulWebServices I downloaded to pass in a RecordList because it didn't work.  It was passing a Record to the XmlToRecordList.

Why is the need for <RecordList> ?

I have a simple xml with

<SomeRootName>
<Entity>
<attr/>
<attr/>
<attr/>
</Entity>
<Entity>
<attr/>
<attr/>
<attr/>
</Entity><Entity>
<attr/>
<attr/>
<attr/>
</Entity>
</SomeRootName>


I would like to tell, just use SomeRootname and get on with it.

is that possible?

hmm, noticed in the javacode it's simply hardcoded.
so I will add my wish:


Please add an optional parameter that if empty stays "RecordList" otherwise it will check on the provided name...

Also change the 2nd exception when checking on tagName in Deserializer so one can see what the actual issue is. (2 of the same exceptions on different checks is a bit funny)