Hi Godwin,

As a workaround you can try the following.

This happens because of the following property contains null as string
value
<property name="Id" expression="json-eval($.id)" scope="default"
type="STRING"/>

So instead of reading the property in the argument, evaluating the JSON
path will solve I think
i.e
<arg evaluator="json" expression="$.id"/>

Regards
Senduran

On Wed, Mar 7, 2018 at 5:13 PM, Godwin Shrimal <god...@wso2.com> wrote:

> Hi All,
>
> If we pass a JSON Payload with a null value, it is considering that null
> value as "null" string. Please see a sample API and payload
>
> API
> ====
>
> <resource methods="POST" uri-template="/testapi">
>
>       <inSequence>
>
>          <property name="Id" expression="json-eval($.id)" scope="default"
> type="STRING"/>
>
>          <property name="ContractId" expression="json-eval($.contractid)"
> scope="default" type="STRING"/>
>
>          <property name="DealId" expression="json-eval($.dealid)"
> scope="default" type="STRING"/>
>
>          <payloadFactory media-type="xml">
>
>             <format>
>
>                <m1:updateForOperation xmlns:m1="http://www.test.com.";>
>
>                   <m1:iId>$1</m1:iId>
>
>                   <m1:iBitrixDealId>$2</m1:iBitrixDealId>
>
>                   <m1:iBitrixContractId>$3</m1:iBitrixContractId>
>
>                </m1:egateUpdateForBitrixOperation>
>
>             </format>
>
>             <args>
>
> *               <arg evaluator="xml" expression="get-property('Id')"/>*
>
>                <arg evaluator="xml" expression="get-property('DealId')"/>
>
>                <arg evaluator="xml" expression="get-property('
> ContractId')"/>
>
>             </args>
>
>          </payloadFactory>
>
>          <log level="full"/>
>
>          <send>
>
>             <endpoint key="conf:DSEndpoint"/>
>
>          </send>
>
>          <respond/>
>
>       </inSequence>
>
>       <outSequence>
>
>          <send/>
>
>       </outSequence>
>
>    </resource>
>
> Payload
> ======
>
> {
>
>            "id":null,
>
>            "contractid":"test",
>
>            "dealid":"test1"
>
> }
>
> According to above sample highlight argument passing to dss service as
> "null" string. It looks this is a bug.
>
>
> Thanks
> Godwin
>
> --
> *Godwin Amila Shrimal*
> Associate Technical Lead
> WSO2 Inc.; http://wso2.com
> lean.enterprise.middleware
>
> mobile: *+94772264165*
> linkedin: *https://www.linkedin.com/in/godwin-amila-2ba26844/
> <https://www.linkedin.com/in/godwin-amila-2ba26844/>*
> twitter: https://twitter.com/godwinamila
> <http://wso2.com/signature>
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to