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
>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev