synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Miyuru Wanninayaka <miyur...@gmail.com>
Subject Re: Payload factory mediator to support creating full SOAPEnvelope
Date Fri, 18 Jan 2013 05:26:25 GMT
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 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/>.

Mime
View raw message