[prev in list] [next in list] [prev in thread] [next in thread] 

List:       synapse-dev
Subject:    Re: Payload factory mediator to support creating full SOAPEnvelope
From:       Udayanga Wickramasinghe <mastershield2007 () gmail ! com>
Date:       2013-01-22 1:34:00
Message-ID: CAP6obNp5dVGrjS-R47zx2ws_ELvFxKXDGXNafmSSzkk0p9jvFQ () mail ! gmail ! com
[Download RAW message or body]

Hi,

On Fri, Jan 18, 2013 at 12:26 AM, Miyuru Wanninayaka <miyurudw@gmail.com>wrote:

> Hi Sadeep,
>
> Having target xpath seems too much, but creating full envelope is a common
> use case. Payload is not just content of soap body, but the full envelope.
> Especially most cloud services like salesforce heavily use headers which
> makes synapse configuration too complex with lots of header mediators. And
> without target attribute, we can make this just work by looking at content
> of format element of payload factory mediator. If it is normal XML, set
> result as body content. If is an Envelope, set it as mc.setEnvelope.
>
>
I too think "target" attribute really makes less sense.. But option 2 you
have suggested looks reasonable and usually would be a naive solution for
many usecases (including modifying SOAP  headers easily)..

Regards,
Udayanga

I have already tested this approach and working fine.
>
>
>
> On Wed, Jan 16, 2013 at 5:48 PM, Sadeep Jayasumana <gayansadeep@gmail.com>wrote:
>
>> Hi,
>>
>> When Payload-factory mediator was initially developed, the main objective
>> was to provide an easy and intuitive way to create a new payload from a
>> well defined template. It turns out to be a very common use case, specially
>> when integrating data services. Although the same functionality can be
>> gained from Enrich mediator with somewhat less obvious configuration, we
>> thought adding a new mediator is justified given how common the use case is.
>>
>> Using Payload-factory mediator with 'target' attribute to modify a part
>> of the envelop makes less sense to me, we might as well use Enrich mediator
>> for such cases.
>>
>> Thanks,
>> Sadeep
>>
>> On Wed, Jan 16, 2013 at 10:42 PM, Senaka Fernando <senakafdo@gmail.com>wrote:
>>
>>> Hi Miyuru,
>>>
>>> Just a question. can't we make the target an XPath expression? That way
>>> you can modify any part of the envelope AFAIU.
>>>
>>> WDYT?
>>>
>>> Thanks,
>>> Senaka.
>>>
>>>
>>> On Wed, Jan 16, 2013 at 2:49 PM, Miyuru Wanninayaka <miyurudw@gmail.com>wrote:
>>>
>>>> Hi all,
>>>>
>>>> Currently Payload factory mediator only supports generating content of
>>>> SOAP body and there is no way to create full SOAP message with SOAP headers
>>>> using payload factory mediator.
>>>>
>>>> How about implementing this?
>>>>
>>>> option 1. We can add a attribute to payload factory mediator to define
>>>> whether result need to set as SOAP enveloper / SOAP body
>>>>
>>>>          <payloadFactory target="envelope | body>
>>>>             <format>
>>>>                <soapenv:Envelope xmlns:soapenv="
>>>> http://www.w3.org/2003/05/soap-envelope">
>>>>                   <soapenv:Header>
>>>>                      <foo>
>>>>                         <bar>?</bar>
>>>>                      </foo>
>>>>                   </soapenv:Header>
>>>>                   <soapenv:Body>
>>>>                       <request>?</request>
>>>>                   </soapenv:Body>
>>>>                </soapenv:Envelope>
>>>>             </format>
>>>>          </payloadFactory>
>>>>
>>>> option 2. In payloadFactory, check for structure of message. If it is
>>>> a SOAP envelope, set as mc.setEnvelope(), else set as content of existing
>>>> message's body.
>>>>
>>>> I prefer option#2 because, because no need to add 1 more attribute to
>>>> payloadFactory config.
>>>>
>>>> WDYT?
>>>>
>>>> --
>>>> Miyuru Wanninayaka
>>>> Senior Software Engineer - WSO2 Inc <http://wso2.com/>.
>>>
>>>
>>>
>>
>>
>> --
>>
>> Sadeep Jayasumana
>>
>> **
>>
>> Email: gayansadeep@gmail.com****
>>
>> Mobile: +61 4 1468 8521
>>
>>
>
>
> --
> Miyuru Wanninayaka
> Senior Software Engineer - WSO2 Inc <http://wso2.com/>.
>



-- 
http://www.udayangawiki.blogspot.com

[Attachment #3 (text/html)]

Hi,<br><br><div class="gmail_quote">On Fri, Jan 18, 2013 at 12:26 AM, Miyuru \
Wanninayaka <span dir="ltr">&lt;<a href="mailto:miyurudw@gmail.com" \
target="_blank">miyurudw@gmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> Hi Sadeep,<br><br>Having target xpath seems too much, but \
creating full envelope is a common use case. Payload is not just content of soap \
body, but the full envelope. Especially most cloud services like salesforce heavily \
use headers which makes synapse configuration too complex with lots of header \
mediators. And without target attribute, we can make this just work by looking at \
content of format element of payload factory mediator. If it is normal XML, set \
result as body content. If is an Envelope, set it as mc.setEnvelope.<br>


<br></blockquote><div><br></div><div>I too think &quot;target&quot; attribute really \
makes less sense.. But option 2 you have suggested looks reasonable and usually would \
be a naive solution for many usecases (including modifying SOAP  headers \
easily)..</div> <div><br></div><div>Regards,</div><div>Udayanga</div><div><br></div><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">I have already tested this approach and working fine.<div \
class="HOEnZb"> <div class="h5"><br><br><br><div class="gmail_quote">On Wed, Jan 16, \
2013 at 5:48 PM, Sadeep Jayasumana <span dir="ltr">&lt;<a \
href="mailto:gayansadeep@gmail.com" \
target="_blank">gayansadeep@gmail.com</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">Hi,<div><br></div><div>When Payload-factory mediator was \
initially developed, the main objective was to provide an easy and intuitive way to \
create a new payload from a well defined template. It turns out to be a very common \
use case, specially when integrating data services. Although the same functionality \
can be gained from Enrich mediator with somewhat less obvious configuration, we \
thought adding a new mediator is justified given how common the use case is.<div>



<br></div><div>Using Payload-factory mediator with &#39;target&#39; attribute to \
modify a part of the envelop makes less sense to me, we might as well use Enrich \
mediator for such cases.</div><div><br></div><div>Thanks,</div>



<div>Sadeep</div><div><div><div><br><div class="gmail_quote">On Wed, Jan 16, 2013 at \
10:42 PM, Senaka Fernando <span dir="ltr">&lt;<a href="mailto:senakafdo@gmail.com" \
target="_blank">senakafdo@gmail.com</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> Hi Miyuru,<div><br></div><div>Just a question. can&#39;t we \
make the target an XPath expression? That way you can modify any part of the envelope \
AFAIU. </div><div><br></div><div>WDYT?</div><div><br></div><div>Thanks,<br>



Senaka.<div><div><br>
<br><div class="gmail_quote">On Wed, Jan 16, 2013 at 2:49 PM, Miyuru Wanninayaka \
<span dir="ltr">&lt;<a href="mailto:miyurudw@gmail.com" \
target="_blank">miyurudw@gmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">




Hi all,<br><br>Currently Payload factory mediator only supports generating content of \
SOAP body and there is no way to create full SOAP message with SOAP headers using \
payload factory mediator. <br><br>How about implementing this?<br>







<br>option 1. We can add a attribute to payload factory mediator to define whether \
result need to set as SOAP enveloper / SOAP body<br><br>         \
&lt;payloadFactory<span style="color:rgb(255,0,0)"> target=&quot;envelope | \
body</span>&gt;<br>







            &lt;format&gt;<br>               &lt;soapenv:Envelope \
xmlns:soapenv=&quot;<a href="http://www.w3.org/2003/05/soap-envelope" \
target="_blank">http://www.w3.org/2003/05/soap-envelope</a>&quot;&gt;<br>             \
&lt;soapenv:Header&gt;<br>







                     &lt;foo&gt;<br>                        \
&lt;bar&gt;?&lt;/bar&gt;<br>                     &lt;/foo&gt;<br>                  \
&lt;/soapenv:Header&gt;<br>                  &lt;soapenv:Body&gt;<br>                 \
&lt;request&gt;?&lt;/request&gt;<br>







                  &lt;/soapenv:Body&gt;<br>               \
&lt;/soapenv:Envelope&gt;<br>            &lt;/format&gt;<br>         \
&lt;/payloadFactory&gt;<br><br>option 2. In payloadFactory<span \
style="color:rgb(255,0,0)"></span>, check for structure of message. If it is a SOAP \
envelope, set as mc.setEnvelope(), else set as content of existing message&#39;s \
body.<br>







<br>I prefer option#2 because, because no need to add 1 more attribute to \
payloadFactory<span style="color:rgb(255,0,0)"> \
</span>config.<br><br>WDYT?<span><font color="#888888"><br clear="all"><br>-- \
<br>Miyuru Wanninayaka<br>




Senior Software Engineer - <a href="http://wso2.com/" target="_blank">WSO2 Inc</a>.
</font></span></blockquote></div><br></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span><font \
color="#888888">-- <br><div><p \
style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">Sadeep \
Jayasumana</p></div>

<div><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">
</p><div><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><u></u></p></div><div><p \
style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">Email: <a \
href="mailto:gayansadeep@gmail.com" \
target="_blank">gayansadeep@gmail.com</a><u></u><u></u></p>



</div><div><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">Mobile: \
<a value="+94772266507">+61 4 1468 8521</a></p></div><p></p></div> \
</font></span></div></div> </blockquote></div><br><br clear="all"><br>-- <br>Miyuru \
Wanninayaka<br>Senior Software Engineer - <a href="http://wso2.com/" \
target="_blank">WSO2 Inc</a>. </div></div></blockquote></div><br><br \
clear="all"><div><br></div>-- <br><a \
href="http://www.udayangawiki.blogspot.com">http://www.udayangawiki.blogspot.com</a>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic