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