Hi Jagath,

Thanks for the reply. The number of <return> elements are dynamic. I'll go
with XSLT then.

Thanks,
Bhathiya

On Wed, Nov 2, 2016 at 9:46 AM, Jagath Sisirakumara Ariyarathne <
[email protected]> wrote:

> Hi Bhathiya,
>
> If the number of <return> elements are static, we can use below config.
>
> <payloadFactory media-type="xml">
>     <format>
>         <ns:results xmlns:ns="http://service.ws.um.carbon.wso2.org";>
>             <ns:return>$1</ns:return>
>             <ns:return>$2</ns:return>
>         </ns:results>
>     </format>
>     <args>
>         <arg evaluator="xml"
>             expression="//ns:getUserListOfRoleResponse/ns:return[1]"
> xmlns:ns="http://service.ws.um.carbon.wso2.org"/>
>         <arg evaluator="xml"
>             expression="//ns:getUserListOfRoleResponse/ns:return[2]"
> xmlns:ns="http://service.ws.um.carbon.wso2.org"/>
>     </args>
> </payloadFactory>
>
> Otherwise you might need to use XSLT transformation.
>
> Thanks.
>
> On Sun, Oct 30, 2016 at 11:33 PM, Bhathiya Jayasekara <[email protected]>
> wrote:
>
>> Hi devs,
>>
>> I have below XML in the message context.
>>
>> <soapenv:Envelope xmlns:soapenv="http://schemas.
>> xmlsoap.org/soap/envelope/">
>>    <soapenv:Body>
>>       <*ns:getUserListOfRoleResponse* xmlns:ns="http://service.ws.um
>> .carbon.wso2.org">
>>          <ns:return>usersx</ns:return>
>>          <ns:return>doctor</ns:return>
>>       </*ns:getUserListOfRoleResponse*>
>>    </soapenv:Body>
>> </soapenv:Envelope>
>>
>> Is it possible to transform this to below one, just with a payload
>> factory (and xpath)?
>>
>>       <*ns:results* xmlns:ns="http://service.ws.um.carbon.wso2.org";>
>>          <ns:return>usersx</ns:return>
>>          <ns:return>doctor</ns:return>
>>       </*ns:results*>
>>
>> Basically what I tried is this with different xpaths, but none of them
>> gave me the expected output.
>>
>>          <payloadFactory media-type="xml">
>>             <format>
>>                <results>$1</results>
>>             </format>
>>             <args>
>>                <arg xmlns:ns="http://service.ws.um.carbon.wso2.org";
>> evaluator="xml" *expression="//ns:getUserListOfRoleResponse/node()"*/>
>>             </args>
>>          </payloadFactory>
>>
>> Appreciate your help.
>>
>> Thanks,
>>
>> --
>> *Bhathiya Jayasekara*
>> *Senior Software Engineer,*
>> *WSO2 inc., http://wso2.com <http://wso2.com>*
>>
>> *Phone: +94715478185 <%2B94715478185>*
>> *LinkedIn: http://www.linkedin.com/in/bhathiyaj
>> <http://www.linkedin.com/in/bhathiyaj>*
>> *Twitter: https://twitter.com/bhathiyax <https://twitter.com/bhathiyax>*
>> *Blog: http://movingaheadblog.blogspot.com
>> <http://movingaheadblog.blogspot.com/>*
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Jagath Ariyarathne
> Technical Lead
> WSO2 Inc.  http://wso2.com/
> Email: [email protected]
> Mob  : +94 77 386 7048
> <http://wso2.com/signature>
>



-- 
*Bhathiya Jayasekara*
*Senior Software Engineer,*
*WSO2 inc., http://wso2.com <http://wso2.com>*

*Phone: +94715478185*
*LinkedIn: http://www.linkedin.com/in/bhathiyaj
<http://www.linkedin.com/in/bhathiyaj>*
*Twitter: https://twitter.com/bhathiyax <https://twitter.com/bhathiyax>*
*Blog: http://movingaheadblog.blogspot.com
<http://movingaheadblog.blogspot.com/>*
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to