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 <
shivankar.adit...@gmail.com> 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 <
> shivankar.adit...@gmail.com> 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: sudhar...@wso2.com <hasi...@wso2.com>
Mobile : +94 710 565 157 <%2B94%20718%20210%20200>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to