Complex data sets from SOAP asset


(Neil) #1

Hello-

I’m working on a project to see if we can display our council tax accounts using Squiz. Initially I was rather gung ho in saying that we could but I’m finding it incredibly difficult to consume complex xml using asset listings and keywords.

Whilst I accept xslt is generally an awful thing, it would allow me to display this in a structured way reasonably easily.

My issue are mainly around iterating through repeated data, (Shadow assets appear to be quite arbitrary in how the data is split) but also that the some pertinent data is can live in another section of the xml (which xpath could retrieve quite easily). This means that I can’t seem to access that or any other repeated data inside the Type format of the asset listing.

I think my question is, am I going about this the right way? Is there a better way to consume complex xml in matrix? Is this was available as a REST resource I think my life would be far easier but alas it isn’t.

When I look on the last Request screen of the asset, the Response Object looks to be a nicely formed JS object that I could somehow consume. Is it possible to access the data this way and I just don’t know how?

Hope that makes some sense. Thanks.

Matrix Version:5.3.4


(Peter McLeod) #2

Hi

Could try using xslt to convert to JSON then use the REST JS process it.

There are some generic XSLT stylesheet that you could use (eg google XML2JSON-XSLT ) rather then making your own - not sure how well it would tranform a complex structure though.

Then just apply the xslt to your xml to get the json data - could either embed directly in the REST JS using a keyword or pull it in using the actual rest call (you would need to apply the transformation before it is accessed using the rest call).

Thanks
Peter


(Neil) #3

Thanks Peter, that’s mostly ace.

When the JSON asset calls the SOAP asset, what user will this happen as?

When I run a test on saving the REST asset, there is a 403 forbidden returned.

If I open up the permissions of the asset to a public read then it returns a 200. Just wondered which user needs to have access to the assets?

Thanks.


(Peter McLeod) #4

Hi

By default I think the resource being called by the REST JS asset needs to be publicly available to access it. You have a couple of options in the ‘Authentication Type’ settings of the rest asset for access restricted resources thought.

If the soap asset is just another asset in your matrix system then could try the Matrix Cookie Passthrough option.

Could aslo try wrapoing the output of the soap asset in some conitions - eg check if the request is from the same server ip and and includes a key.

Another option could be to try and output the soap asset (that has the xslt applied to it) directly in the Rest JS using a globals_content_raw keyword.

Thanks
Peter