Hi Piriya
Above approach, you can implement in the POST and PUT.
The resource type GET produces a request that does not have a body
(payload),
hence we set the required parameter as a query parameter when you set the
resource GET while creating the API in publisher. (please refer to the
attached image )
Then the request parameter is accessed within the payload mediator of the
proxy service ( within the <args> element) in ESB as the following example.
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:ser="http://service.sample.oasis.com"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="
http://dto.service.sample.oasis.com/xsd">
<soapenv:Header>1</soapenv:Header>
<soapenv:Body>
<ser:deleteOrderData>
<!--Optional:-->
<ser:orderNumber>$1</ser:orderNumber>
</ser:deleteOrderData>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg evaluator="xml" expression="$url:order_id" xmlns:ns="
http://org.apache.synapse/xsd"/>
</args>
</payloadFactory>
please refer to the following link for better understanding of the REST
Parameters
https://www.soapui.org/rest-testing/understanding-rest-parameters.html
many thanks
On Wed, Nov 15, 2017 at 5:19 PM, Piriya Sivalingam <[email protected]> wrote:
> Hi Dushantha,
>
> Since I have GET, POST,PUT, DELETE methods in my proxy, do you say the
> above-suggested method will work for GET. I have tried it but could not
> achieve it.
> And if I am correct, your example is about POST or PUT method.
> Could you please let me know whether I can use the same way for all four
> methods or only specific to POST method.
>
> Thank you.
>
>
> On Wed, Nov 15, 2017 at 3:10 PM, Dushantha Batuwita <[email protected]>
> wrote:
>
>> please refer to the above answers
>>
>> Regards
>>
>> On Wed, Nov 15, 2017 at 2:35 PM, Dushantha Batuwita <[email protected]>
>> wrote:
>>
>>> Hi Buddhimala
>>> Accessing the JSON payload parameters and retrieving those within the
>>> proxy service can be achieved with the <args> element of the Payload
>>> factory mediator according to your scenario.
>>> Setting already retrieved parameters to the predefined soap structure is
>>> accomplished within the <format> element.
>>>
>>> suppose that we need to access the following JSON structure
>>>
>>> {
>>> "orderLine": {
>>>
>>> "ordername": "Cooking Item",
>>> "orderid": "123456",
>>> "product": {
>>>
>>> "productname": "coconutoil",
>>> "productgrade": "drade1",
>>> "productcolour": "white"
>>>
>>> }
>>> }
>>> }
>>>
>>>
>>> and retrieve the values in order to set to the soap structure given
>>> bellow within the payload factory is as follows refer to document[1] for
>>> further details
>>> <payloadFactory media-type="xml">
>>> <format>
>>> <soapenv:Envelope
>>> xmlns:ser="http://service.sample.oasis.com"
>>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="
>>> http://dto.service.sample.oasis.com/xsd">
>>> <soapenv:Header/>
>>> <soapenv:Body>
>>> <ser:addOrderLineRecord>
>>> <ser:orderLine>
>>> <xsd:product>
>>> <xsd:productname>$1</xsd:ordername>
>>> <xsd:productgrade>$2</xsd:orderid>
>>> <xsd:productcolour>$3</xsd:pro
>>> ductcolour>
>>> </xsd:product>
>>> <xsd:ordername>$4</xsd:ordername>
>>> <xsd:orderid>$5</xsd:orderid>
>>>
>>> </ser:orderLine>
>>> </ser:addOrderLineRecord>
>>> </soapenv:Body>
>>> </soapenv:Envelope>
>>> </format>
>>> <args>
>>> <arg *evaluator="json"*
>>> *expression="$.orderLine.product.productname"*/>
>>> <arg evaluator="json" expression="$.orderLine.produc
>>> t.productgrade"/>
>>> <arg evaluator="json" expression="$.orderLine.produc
>>> t.productcolour"/>
>>> <arg evaluator="json" expression="$.orderLine.ordername"/>
>>> <arg evaluator="json" expression="$.orderLine.orderid"/>
>>> </args>
>>> </payloadFactory>
>>>
>>> NOTE: when you set the $n parameter to be couches to follow the order in
>>> which the args are defined. i.e. the first line of the arg refer to $1..
>>> and etc
>>>
>>> Regards
>>>
>>> On Wed, Nov 15, 2017 at 2:32 PM, Buddhimala Ranasinghe <
>>> [email protected]> wrote:
>>>
>>>> Hi All,
>>>>
>>>> I need to pass a json payload from an API to ESB proxy service. In ESB,
>>>> I'm using parameters in the passed JSON payload inside payloadFactory
>>>> mediator in my ESB which will be sent towards a secured SOAP BE. Can you
>>>> please guide me on this? I need to know how could those parameters can be
>>>> addressed inside my proxy service.
>>>>
>>>> Regards,
>>>> Buddhimala
>>>>
>>>> --
>>>>
>>>>
>>>> *Buddhimala Ranasinghe*
>>>> Software Engineer-Support Team | WSO2
>>>> Emil: [email protected]
>>>> Mobile:+94771563138 <+94%2077%20156%203138>
>>>> Web:http://wso2.com
>>>> [image: https://wso2.com/signature] <https://wso2.com/signature>
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> [email protected]
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>>
>>> --
>>> *Dushantha Nayanajith Chandima Batuwita*
>>> Software Engineer Support | WSO2
>>> [email protected]
>>> mobile : 0094777453010
>>>
>>
>>
>>
>> --
>> *Dushantha Nayanajith Chandima Batuwita*
>> Software Engineer Support | WSO2
>> [email protected]
>> mobile : 0094777453010
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Regards,
>
> *Piriya Sivalingam*
>
> *Software Engineer - Support Team*
>
> *WSO2*
> *Mobile : +94 77 8462039 <+94%2077%20846%202039>*
>
> [image: http://wso2.com/signature] <http://wso2.com/signature>
>
>
--
*Dushantha Nayanajith Chandima Batuwita*
Software Engineer Support | WSO2
[email protected]
mobile : 0094777453010
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev