Operation with request parameters in response

22 views
Skip to first unread message

mjas...@gmail.com

unread,
Feb 25, 2016, 2:58:10 PM2/25/16
to membrane-monitor
Hello,


I try to use membrane as proxy for WEB service to establish connection with partner without additional development.

I have successfully configured xslt profile for request xml modification, but faced problem with response.
Request contains transaction_id and response should also contain transaction_id, but my API does not return it.

Is there any opportunity to store some variables from request and add them in response?

For example:

Request:
<request>
  <param1>123</param1>
  <param2>123</param2>
</request>

Transform:
<newrequest>
  <1>123</1>
  <2>456</2>
</newrequest>

Response:
<newresponse>
  <3>XXX</3>
  <4>YYY</4>
</newresponse>

Transform:
<response>
  <param3>XXX</param3>
  <param4>YYY</param4>
  <param2>123</param2>
</response>

Thanks.

Thomas Bayer

unread,
Feb 25, 2016, 3:06:23 PM2/25/16
to membrane...@googlegroups.com
Hi,
you can use a groovy script in the request that extracts the param using GPath and stores it into the exchange object. A secound groovy script in the response flow adds the parameter that it can read from the exchange. I think you only need about 10 Lines of Groovy Code inside your service proxy definition.

Have a look at the groovy example inside the examples folder an the following resources:

http://www.membrane-soa.org/service-proxy-doc/4.1/configuration/reference/groovy.htm
http://desmontandojava.blogspot.de/2013/04/groovy-xml-series-querying-xml-with.html

Cheers,
Thomas

Am 25.02.16 um 16:58 schrieb mjas...@gmail.com:
--
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