Single element array with rest2Soap

10 views
Skip to first unread message

Agostino Chiosi

unread,
Apr 11, 2016, 10:57:55 AM4/11/16
to membrane...@googlegroups.com
Hi,

First of all congratulation for the great job you have done with membrane!

I am using the rest2Soap interceptor and I am wondering if there is a way to force single elements into arrays. 

For example if I receive the following XML:

<response>
   <customer>
      <name>John</name>
      <surname>White</surname>
    </customer>
</response>

it gets translated in {"response": {"customer": {"name" = "John", "surname"= "White"} } }

while I would like it to be:  {"response": [ { "name" = "John", "surname"= "White" } ] }

Of course arrays with multiple elements get translated like the latter example.

Is there a simple way to achieve this? I know that I can detect this on the client side, but it seems not the best solution.

Many thanks!
Agostino

Thomas Bayer

unread,
Apr 12, 2016, 3:52:11 AM4/12/16
to membrane...@googlegroups.com
Hi,
you can try to change the output of the XSLT transformation to influence the output. But the most powerful option would be to put an Javascript execution into the response flow that transforms the result accordingly. We will provide an interceptor for Javascript shortly.

Cheers,
Thomas

Am 11.04.16 um 16:57 schrieb Agostino Chiosi:
--
You received this message because you are subscribed to the Google Groups "membrane-monitor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to membrane-monit...@googlegroups.com.
To post to this group, send email to membrane...@googlegroups.com.
Visit this group at https://groups.google.com/group/membrane-monitor.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages