Hi, On Fri, Jan 18, 2013 at 12:26 AM, Miyuru Wanninayaka <[email protected]>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 > <[email protected]>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 <[email protected]>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 >>> <[email protected]>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: [email protected]**** >> >> Mobile: +61 4 1468 8521 >> >> > > > -- > Miyuru Wanninayaka > Senior Software Engineer - WSO2 Inc <http://wso2.com/>. > -- http://www.udayangawiki.blogspot.com
