Hi Aditya,

The list parameters available for different transformations are available
in [1]. For your current requirement, could you try adding below property
in EI/conf/synapse.properties and restart the server?

*synapse.commons.json.output.xmloutMultiplePI=true*

I have tried it out with the proxy you have provided and it returns the
expected output.

{
    "id": 3,
    "parts": [
        "Screen"
    ],
    "test": [],
    "numberTest": 40,
    "make": "Tamsung"
}

[1]
https://docs.wso2.com/display/EI611/JSON+Support#JSONSupport-XMLtoJSONtransformationparameters

Thanks,
Himasha

On Sun, Oct 29, 2017 at 9:42 PM, aditya shivankar <
[email protected]> wrote:

> Hi Sudharma,
>
> I tried adding below line in synapse.properties file present
> at C:\wso2ei-6.1.1-update7\conf this location and restarted the server.
>
> synapse.json.to.xml.processing.instruction.enable=true.
>
> Still it did not work.
>
> Do let me know , if I did anything wrong.
>
> With Regards,
> Aditya
>
> On Sun, Oct 29, 2017 at 8:58 PM, aditya shivankar <
> [email protected]> wrote:
>
>> Hi Sudharma,
>>
>> Thanks for you reply.
>> As per previous mail suggestion, I downloaded wso2ei-6.1.1-update7, and
>> ran the same application on it.
>> But I did not get the expected result.
>>
>> Request I fired through postman.
>>
>> {
>> "id" : "3",
>> "parts" : ["Screen"],
>> "test" : [],
>> "numberTest" : 40
>> }
>>
>>
>> Response received :
>>
>> {
>>     "id": 3,
>>     "parts": "Screen",
>>     "numberTest": 40,
>>     "make": "Tamsung"
>> }
>>
>> Please Guide. Array is still absent in response.
>>
>>
>> With Regards,
>> Aditya
>>
>>
>>
>>
>> On Sun, Oct 29, 2017 at 3:55 PM, Sudharma Subasinghe <[email protected]>
>> wrote:
>>
>>> These fixes are available with the latest release Enterprise Integrator
>>> 6.1.1-update7. which is available for download from here
>>> <https://github.com/wso2/product-ei/releases/tag/v6.1.1-update7>.
>>>
>>> Thanks
>>> Sudharma
>>>
>>> On Sun, Oct 29, 2017 at 12:58 PM, aditya shivankar <
>>> [email protected]> wrote:
>>>
>>>> Hi Sudharma,
>>>>
>>>> Thanks for the reply.
>>>> Request you to please provide a link to download the version of wso2 
>>>> esb(WSO2
>>>> EI) , in which these defects are fixed. So that I do not end up , in
>>>> downloading wrong versions.
>>>> Thanks
>>>>
>>>> With Regards,
>>>> Aditya
>>>>
>>>> On Fri, Oct 27, 2017 at 4:49 PM, Sudharma Subasinghe <
>>>> [email protected]> wrote:
>>>>
>>>>> Hi Aditya,
>>>>>
>>>>> This has been fixed with[1] and you can try with latest WSO2
>>>>> Enterprise Integrator(WSO2 EI), integrator profile. There you can avoid
>>>>> above both issues by enabling 
>>>>> *synapse.json.to.xml.processing.instruction.enable
>>>>> *in synapse.properties file.
>>>>>
>>>>> Please refer[2] for more info about using EI.
>>>>>
>>>>> [1] https://wso2.org/jira/browse/ESBJAVA-4721
>>>>> [2] https://docs.wso2.com/display/EI611/
>>>>>
>>>>> Thanks
>>>>> Sudharma
>>>>>
>>>>> On Thu, Oct 26, 2017 at 3:00 PM, aditya shivankar <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Few more similar things, I found regarding this same flow .
>>>>>> If the request consists of an empty. It gets disappeared in response
>>>>>> completely.
>>>>>> For E.g.
>>>>>>
>>>>>> Request :
>>>>>>        {
>>>>>> "id" : "3",
>>>>>> "parts" : ["Screen"],
>>>>>> "test" : [],
>>>>>> "numberTest" : 40
>>>>>> }
>>>>>>
>>>>>>
>>>>>> Actual Response :
>>>>>>     {
>>>>>>     "id": "3",
>>>>>>     "parts": "Screen",
>>>>>>     "numberTest": "40",
>>>>>>     "make": "Tamsung"
>>>>>>    }
>>>>>>
>>>>>> Desired Response :
>>>>>>     {
>>>>>>        "id": "3",
>>>>>>        "parts": ["Screen"],
>>>>>>        "test" : [],
>>>>>>        "numberTest": "40",
>>>>>>        "make": "Tamsung"
>>>>>>     }
>>>>>>
>>>>>>
>>>>>> Issue :
>>>>>>
>>>>>>   In the actual response , the empty array named "test" is missing.
>>>>>>
>>>>>>   So overall there are two issues scenarios.
>>>>>> 1. When there is a array in request , with a single(one) element in
>>>>>> it .
>>>>>> 2. When there is an empty array in request.
>>>>>>
>>>>>>
>>>>>> With Regards,
>>>>>> Aditya
>>>>>> ------------------------------------------------------------
>>>>>> ------------------------------------------------------------
>>>>>> ---------------------------------------------------
>>>>>>
>>>>>> On Wed, Oct 25, 2017 at 5:37 PM, aditya shivankar <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> Let me reformat(summarize) the remaining issue now, as one issue is
>>>>>>> resolved.
>>>>>>> The issue which still needs to be addressed is.
>>>>>>>
>>>>>>>
>>>>>>> Below is the sample service I have created to Highlight the issue I
>>>>>>> am facing in my project(In actual project service, the request and 
>>>>>>> response
>>>>>>> are very big, dynamic and this issue is repeating at many places).
>>>>>>>
>>>>>>> Request : { "id" : "3", "parts" : ["Screen"] }
>>>>>>>
>>>>>>> Actual Response : { "id": "3", "parts": "Screen", "make": "Tamsung" }
>>>>>>>
>>>>>>> Desired Response :
>>>>>>>
>>>>>>> { "id": "3", "parts": ["Screen"], "make": "Tamsung" }
>>>>>>> ------------------------------
>>>>>>>
>>>>>>> Issue :
>>>>>>>
>>>>>>>    1.
>>>>>>>
>>>>>>>    "parts": "Screen",
>>>>>>>
>>>>>>>    should have been like below
>>>>>>>
>>>>>>>    "parts": ["Screen"],
>>>>>>>
>>>>>>>    i.e. it does not remain array anymore. I understand the array
>>>>>>>    consist only one element. But the third party system to which the 
>>>>>>> output of
>>>>>>>    this service is sent as input(request) expects the element as array. 
>>>>>>> So I
>>>>>>>    need it to be as array.
>>>>>>>
>>>>>>> ------------------------------------------------------------
>>>>>>> ------------------------------------------------------------
>>>>>>> ------------
>>>>>>>
>>>>>>> I think , I cannot recreate the message using payloadFactory
>>>>>>> because,
>>>>>>>    " the message(payload) I am modifying with enrich mediator is a
>>>>>>> "huge and dynamic response from Third party service". This response I 
>>>>>>> need
>>>>>>> to modify/enrich at many places in my service and send it to another 
>>>>>>> third
>>>>>>> party service as input.
>>>>>>>
>>>>>>>    With "Dynamic" :  I mean, some things in the message(payload) are
>>>>>>> different(change) everytime service receives the request, depending on 
>>>>>>> some
>>>>>>> factors in the request received by the third party service whose output 
>>>>>>> is
>>>>>>> input message to this service.
>>>>>>>
>>>>>>>    so I think I cannot recreate message using payloadFactory like
>>>>>>> this
>>>>>>>
>>>>>>>    <payloadFactory media-type="json">
>>>>>>>          <format>{"id" : $1, "parts" : $2, "make" :
>>>>>>> "Tamsung"}</format>
>>>>>>>           <args>
>>>>>>>                      <arg evaluator="json" expression="$.id"></arg>
>>>>>>>                      <arg evaluator="json"
>>>>>>> expression="$.parts"></arg>
>>>>>>>           </args>
>>>>>>> </payloadFactory>
>>>>>>>
>>>>>>>    as it will be dynamic response from a third party service.
>>>>>>> So we cannot recreate the message in payloadFactory it being not
>>>>>>> static.
>>>>>>>
>>>>>>> ------------------------------------------------------------
>>>>>>> ------------------------------------------------------------
>>>>>>> ------------
>>>>>>>
>>>>>>> arrayTest.xml :
>>>>>>>
>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>> <api context="/arrayTest" name="arrayTest" xmlns="
>>>>>>> http://ws.apache.org/ns/synapse";>
>>>>>>>     <resource methods="POST GET">
>>>>>>>         <inSequence>
>>>>>>>
>>>>>>>             <enrich>
>>>>>>>                 <source clone="true" type="inline">
>>>>>>>                     <make xmlns="">Tamsung</make>
>>>>>>>                 </source>
>>>>>>>                 <target action="child" xpath="//jsonObject"/>
>>>>>>>             </enrich>
>>>>>>>             <enrich>
>>>>>>>                 <source clone="true" xpath="//jsonObject"/>
>>>>>>>                 <target type="body"/>
>>>>>>>             </enrich>
>>>>>>>
>>>>>>>             <respond/>
>>>>>>>         </inSequence>
>>>>>>>         <outSequence/>
>>>>>>>         <faultSequence/>
>>>>>>>     </resource>
>>>>>>> </api>
>>>>>>>
>>>>>>> ------------------------------------------------------------
>>>>>>> ------------------------------------------------------------
>>>>>>> ------------------
>>>>>>>
>>>>>>> Please guide...
>>>>>>>
>>>>>>> With Regards,
>>>>>>> Aditya
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Sudharma Subasinghe,
>>>>> Software Engineer,
>>>>> WSO2 Inc.
>>>>> Email: [email protected] <[email protected]>
>>>>> Mobile : +94 710 565 157 <%2B94%20718%20210%20200>
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Sudharma Subasinghe,
>>> Software Engineer,
>>> WSO2 Inc.
>>> Email: [email protected] <[email protected]>
>>> Mobile : +94 710 565 157 <%2B94%20718%20210%20200>
>>>
>>
>>
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Himasha Guruge
Senior Software Engineer
WS*O2* *Inc.*
Mobile: +94 777459299
[email protected]
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to