Hi Vinod,

Thanks for the suggestion, I haven't tried script mediator as I tried using
payload factory using om element property.  I will try script mediator for
the array type payloads.

Regards,
Sameera,

On Fri, Jan 5, 2018 at 2:21 PM, Vinod Kavinda <[email protected]> wrote:

> Hi Sameera,
> Did you try the script mediator? Please refer SO question[1], script
> mediator has been successfully used here for a similar case.
>
> [1] - https://stackoverflow.com/questions/44817012/how-to-
> transform-json-array-response-to-xml-array-in-esb-wso2-using-script-media
>
> Regards,
> Vinod
>
> On Fri, Jan 5, 2018 at 1:51 PM, Sameera Gunarathne <[email protected]>
> wrote:
>
>> Hi,
>>
>> I'm generating a soap message from a JSON payload and there I would get
>> custom object arrays for the payload. An example message format would be
>> like below.
>>
>> {
>>    "phoneNumbers":[
>>       {
>>          "number":"",
>>          "person":""
>>       }
>>    ]
>> }
>>
>> respective soap message should be like this.
>>
>> <web:Payload>
>>     <web:PhoneNumbers>
>> <web:PhoneNumber>
>>     <web:Number></web:Number>
>>     <web:Person></web:Person>
>> <web:PhoneNumber/>
>>     </web:PhoneNumbers>
>> </web:Payload>
>>
>> I have used a payload factory mediator for the simple object
>> types(without arrays) and I use property mediator to access the object
>> fields so that I can inject them using an argument to the message template
>> used for payload factory. But when getting an array of as mentioned payload
>> the argument should be populated with following elements for the size of
>> the array.
>>
>> * <web:PhoneNumber>*
>> *     <web:Number></web:Number>*
>> *     <web:Person></web:Person>*
>> * <web:PhoneNumber/>*
>>
>> In this case, is there a way I can use payload factory with property
>> mediator? Or Is there a recommended mediators I can use for this scenario?
>>
>> Thanks and Regards,
>> Sameera,
>> --
>> Sameera Gunarathne
>> Software Engineer, WSO2 Inc. http://wso2.com
>> <http://l.facebook.com/l.php?u=http%3A%2F%2Fwso2.com&h=gAQEswASa>
>> Email: [email protected]
>> Mobile: +94714155561
>>
>
>
>
> --
> Vinod Kavinda
> Senior Software Engineer
> *WSO2 Inc. - lean . enterprise . middleware <http://www.wso2.com>.*
> Mobile : +94 (0) 712 415544
> Blog : http://soatechflicks.blogspot.com/
> [image: http://wso2.com/signature]
> <http://wso2.com/signature>
>
>


-- 
Sameera Gunarathne
Software Engineer, WSO2 Inc. http://wso2.com
<http://l.facebook.com/l.php?u=http%3A%2F%2Fwso2.com&h=gAQEswASa>
Email: [email protected]
Mobile: +94714155561
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to