[prev in list] [next in list] [prev in thread] [next in thread]
List: forgerock-openig
Subject: Re: [Openig] REST/SOAP Conversion
From: Guillaume Sauthier <guillaume.sauthier () forgerock ! com>
Date: 2015-04-10 8:04:06
Message-ID: etPan.552783f6.6b8b4567.1fc () myrkr ! local
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
There is no ready to use OpenIG filter that is doing what you want, but try to google \
around "Groovy Json Xml Converter", you'll have some starting points.
Here are some links that seems to be in relation with your request:
http://stackoverflow.com/questions/18830248/converting-xml-to-json-in-groovy
Just notice that this is not a trivial task to do: SOAP is really a beast compared to \
JSON. That would be OK for simple web services, but probably not appropriate when the \
mapping is not trivial.
I would say that the best option for you (if you have to deal with complex structures \
and non-trivial mapping) is to generate a JAXWS Client and use it in your groovy \
script. You'll still have to map your input JSON into the jaxws required java \
objects, but you won't have to worry about SOAP and XML. then you'll have to get your \
response, transform it back from XML to JSON and place it into \
exchange.response.entity.
Hope that help
—
Guillaume Sauthier
OpenIG Lead Developer
ForgeRock
On 10 Apr 2015 at 09:42:14, Nestore Sulcis (nestsulcis@inbox.com) wrote:
Is there an example of filter script for JSON/XML conversion?
Thanks
-----Original Message-----
From: guillaume.sauthier@forgerock.com
Sent: Wed, 8 Apr 2015 11:52:59 +0200
To: openig@forgerock.org
Subject: Re: [Openig] REST/SOAP Conversion
Hi Nestore
Transforming messages is at the core of OpenIG, but we don't have such a generic \
filter/handler: it's too specific to your application (knowing the incoming JSON \
format to its XML/SOAP equivalent).
That means you have to write something to make that content transformation. \
Hopefully, OpenIG gives you the ability to script transformation (see \
ScriptableHandler and ScriptableFilter) where you can do whatever you want to your \
message with some Groovy code.
Groovy has some nice JSON and Xml support out of the box so I guess that would be \
pretty straight-forward to write a filter script that would adapt an incoming JSON \
entity into an equivalent Xml/Soap and do the reverse for the response.
See the OpenIG Guide for scripting examples.
—
Guillaume Sauthier
OpenIG Lead Developer
ForgeRock
On 8 Apr 2015 at 11:27:21, Nestore Sulcis (nestsulcis@inbox.com) wrote:
Hi I'm new to OpenIG and I have this scenario: there is a REST internet client which \
needs to invoke a SOAP web service.
My question: is it possible to use OpenIG to convert REST to SOAP (and viceversa)? If \
yes, which handlers/filters should I use?
____________________________________________________________
Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.
Check it out at http://mysecurelogon.com/password-manager
_______________________________________________
Openig mailing list
Openig@forgerock.org
https://lists.forgerock.org/mailman/listinfo/openig
_______________________________________________
Openig mailing list
Openig@forgerock.org
https://lists.forgerock.org/mailman/listinfo/openig
[Attachment #5 (text/html)]
<html><head><style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
padding:1em;
margin:auto;
background:#fefefe;
}
h1, h2, h3, h4, h5, h6 {
font-weight: bold;
}
h1 {
color: #000000;
font-size: 28pt;
}
h2 {
border-bottom: 1px solid #CCCCCC;
color: #000000;
font-size: 24px;
}
h3 {
font-size: 18px;
}
h4 {
font-size: 16px;
}
h5 {
font-size: 14px;
}
h6 {
color: #777777;
background-color: inherit;
font-size: 14px;
}
hr {
height: 0.2em;
border: 0;
color: #CCCCCC;
background-color: #CCCCCC;
display: inherit;
}
p, blockquote, ul, ol, dl, li, table, pre {
margin: 15px 0;
}
a, a:visited {
color: #4183C4;
background-color: inherit;
text-decoration: none;
}
#message {
border-radius: 6px;
border: 1px solid #ccc;
display:block;
width:100%;
height:60px;
margin:6px 0px;
}
button, #ws {
font-size: 12 pt;
padding: 4px 6px;
border-radius: 5px;
border: 1px solid #bbb;
background-color: #eee;
}
code, pre, #ws, #message {
font-family: Monaco;
font-size: 10pt;
border-radius: 3px;
background-color: #F8F8F8;
color: inherit;
}
code {
border: 1px solid #EAEAEA;
margin: 0 2px;
padding: 0 5px;
}
pre {
border: 1px solid #CCCCCC;
overflow: auto;
padding: 4px 8px;
}
pre > code {
border: 0;
margin: 0;
padding: 0;
}
#ws { background-color: #f8f8f8; }
.bloop_markdown table {
border-collapse: collapse;
font-family: Helvetica, arial, freesans, clean, sans-serif;
color: rgb(51, 51, 51);
font-size: 15px; line-height: 25px;
padding: 0; }
.bloop_markdown table tr {
border-top: 1px solid #cccccc;
background-color: white;
margin: 0;
padding: 0; }
.bloop_markdown table tr:nth-child(2n) {
background-color: #f8f8f8; }
.bloop_markdown table tr th {
font-weight: bold;
border: 1px solid #cccccc;
margin: 0;
padding: 6px 13px; }
.bloop_markdown table tr td {
border: 1px solid #cccccc;
margin: 0;
padding: 6px 13px; }
.bloop_markdown table tr th :first-child, table tr td :first-child {
margin-top: 0; }
.bloop_markdown table tr th :last-child, table tr td :last-child {
margin-bottom: 0; }
.bloop_markdown blockquote{
border-left: 4px solid #dddddd;
padding: 0 15px;
color: #777777; }
blockquote > :first-child {
margin-top: 0; }
blockquote > :last-child {
margin-bottom: 0; }
code, pre, #ws, #message {
word-break: normal;
word-wrap: normal;
}
hr {
display: inherit;
}
.bloop_markdown :first-child {
-webkit-margin-before: 0;
}
code, pre, #ws, #message {
font-family: Menlo, Consolas, Liberation Mono, Courier, monospace;
}
.send { color:#77bb77; }
.server { color:#7799bb; }
.error { color:#AA0000; }</style></head><body style="word-wrap: break-word; \
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div \
class="bloop_markdown"><p>There is no ready to use OpenIG filter that is doing what \
you want, but try to google around "Groovy Json Xml Converter", you'll have some \
starting points.</p>
<p>Here are some links that seems to be in relation with your request:</p>
<ul>
<li>http://stackoverflow.com/questions/18830248/converting-xml-to-json-in-groovy</li>
</ul>
<p>Just notice that this is not a trivial task to do: SOAP is really a beast compared \
to JSON. That would be OK for simple web services, but probably not appropriate when \
the mapping is not trivial.</p>
<p>I would say that the best option for you (if you have to deal with complex \
structures and non-trivial mapping) is to generate a JAXWS Client and use it in your \
groovy script. You'll still have to map your input JSON into the jaxws required java \
objects, but you won't have to worry about SOAP and XML. then you'll have to get your \
response, transform it back from XML to JSON and place it into \
<code>exchange.response.entity</code>.</p>
<p>Hope that help</p>
<p></p></div><div class="bloop_original_html"><style>body{font-family:Helvetica,Arial;font-size:13px}</style><div \
id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: \
rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div> <br> <div \
id="bloop_sign_1428652407730364160" class="bloop_sign"><div \
class="bloop_markdown"><p></p></div><div class="bloop_original_html"><div \
style="font-family:helvetica,arial;font-size:13px">—</div><div \
style="font-family:helvetica,arial;font-size:13px"><span style="font-family: \
'Helvetica Neue', Helvetica, Arial, sans-serif;">Guillaume Sauthier</span></div><div \
style="font-family:helvetica,arial;font-size:13px"><span style="font-family: \
'Helvetica Neue', Helvetica, Arial, sans-serif;">OpenIG Lead \
Developer</span></div><div style="font-family:helvetica,arial;font-size:13px"><a \
href="http://www.forgerock.com" style="font-family: 'Helvetica Neue', Helvetica, \
Arial, sans-serif;">ForgeRock</a></div></div></div> <br><p class="airmail_on" \
style="color:#000;">On 10 Apr 2015 at 09:42:14, Nestore Sulcis (<a \
href="mailto:nestsulcis@inbox.com">nestsulcis@inbox.com</a>) wrote:</p> <blockquote \
type="cite" class="clean_bq"><span><div><div></div><div>
<title></title>
<div>Is there an example of filter script for JSON/XML
conversion?</div>
Thanks<br>
<br>
<blockquote style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px \
solid; MARGIN-RIGHT: 0px"> <div class="msgHeaders">-----Original Message-----<br>
<b>From:</b> guillaume.sauthier@forgerock.com<br>
<b>Sent:</b> Wed, 8 Apr 2015 11:52:59 +0200<br>
<b>To:</b> openig@forgerock.org<br>
<b>Subject:</b> Re: [Openig] REST/SOAP Conversion<br>
<br></div>
<div class="oldBody">
<div>
<div>
<p>Hi Nestore</p>
<p>Transforming messages is at the core of OpenIG, but we don't
have such a generic filter/handler: it's too specific to your
application (knowing the incoming JSON format to its XML/SOAP
equivalent).</p>
<p>That means you have to write something to make that content
transformation. Hopefully, OpenIG gives you the <strong>ability to
script transformation</strong> (see <a \
href="http://docs.forgerock.org/en/openig/3.1.0/reference/index.html#ScriptableHandler">
ScriptableHandler</a> and <a \
href="http://docs.forgerock.org/en/openig/3.1.0/reference/index.html#ScriptableFilter">
ScriptableFilter</a>) where you can do whatever you want to your
message with some Groovy code.</p>
<p>Groovy has some nice <a href="http://groovy-lang.org/json.html">JSON</a> and <a \
href="http://groovy-lang.org/processing-xml.html">Xml</a> support out of the box so I \
guess that would be <strong>pretty straight-forward</strong> to write a filter script \
that would adapt an incoming JSON entity into an equivalent Xml/Soap and do the
reverse for the response.</p>
<p>See the OpenIG Guide for <a \
href="http://docs.forgerock.org/en/openig/3.1.0/gateway-guide/index.html#about-scripting">
scripting examples</a>.</p>
</div>
<div>
<div><span>—</span></div>
<div>
<div>
<div>
<div><span>Guillaume Sauthier</span></div>
<div><span>OpenIG Lead Developer</span></div>
<div><a href="http://www.forgerock.com">ForgeRock</a></div>
</div>
</div>
<br>
<p>On 8 Apr 2015 at 11:27:21, Nestore Sulcis (<a \
href="mailto:nestsulcis@inbox.com">nestsulcis@inbox.com</a>) wrote:</p> <blockquote \
type="cite"> <div>
<div><span>Hi I'm new to OpenIG and I have this scenario: there is
a REST internet client which needs to invoke a SOAP web
service.<br>
<br>
My question: is it possible to use OpenIG to convert REST to SOAP
(and viceversa)? If yes, which handlers/filters should I use?<br>
<br>
____________________________________________________________<br>
Can't remember your password? Do you need a strong and secure
password?<br>
Use Password manager! It stores your passwords & protects your
account.<br>
Check it out at http://mysecurelogon.com/password-manager<br>
<br>
<br>
_______________________________________________<br>
Openig mailing list<br>
Openig@forgerock.org<br>
https://lists.forgerock.org/mailman/listinfo/openig<br></span></div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote>
<hr size="1px" noshade="noshade" style="clear:both;margin-top:10px;height:1px;">
<div style="font:12px \
Verdana,sans-serif;color:Black;background:white;padding:3px;line-height:1.3em"> <a \
href="http://mysecurelogon.com/password-manager"><img \
src="http://my.inbox.com/img/ftrs/mlman3703.jpg" width="424" height="73" alt="Can't \
remember your password? Do you need a strong and secure password? Use Password \
manager! It stores your passwords & protects your account." border="0" \
style="margin-bottom:10px"></a></div>
_______________________________________________
<br>Openig mailing list
<br>Openig@forgerock.org
<br>https://lists.forgerock.org/mailman/listinfo/openig
<br></div></div></span></blockquote></div><div \
class="bloop_markdown"><p></p></div></body></html>
_______________________________________________
Openig mailing list
Openig@forgerock.org
https://lists.forgerock.org/mailman/listinfo/openig
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic