Hi Yashothara,

I think this happens due to the use of script mediator. You do not need to
use script mediator here. Just use the payload factory mediator to build
the payload or use data mapper mediator if you need to do more complex
mapping.

[1]
https://docs.wso2.com/display/ESB481/PayloadFactory+Mediator#PayloadFactoryMediator-Example2:JSON

Thanks,
Nuwan

On Wed, Sep 21, 2016 at 10:33 AM, Yashothara Shanmugarajah <
yashoth...@wso2.com> wrote:

> Please find the template[1] and proxy[2].
>
> [1]
> <template name="createTicket" xmlns="http://ws.apache.org/ns/synapse";>
>     <!--Required Parameters-->
>     <parameter name="requesterId" description="User ID of the requester."/>
>     <sequence>
>         <property name="uri.var.requesterId" expression="$func:requesterId"/>
>
>     <log level="custom">
>       <property name="909090909090909090909090909"
> expression="$ctx:uri.var.requesterId"/>
>     </log>
>         <payloadFactory media-type="json">
>             <format>
>                 {
>
>                 }
>             </format>
>             <args>
>
>             </args>
>         </payloadFactory>
>
>         <!-- Constructing payload with optional parameters -->
>         <script language="js">
>             <![CDATA[
>          payload = mc.getPayloadJSON();
>
>          var requesterId = mc.getProperty("uri.var.requesterId");
>
>          if (requesterId != null && requesterId != ""){
>          var requesterIdInt = parseInt(mc.getProperty("uri.
> var.requesterId"));
>             payload["requester_id"] = requesterIdInt;
>          }
>
>          mc.setPayloadJSON(payload);
>          ]]>
>         </script>
>
>         <call>
>             <endpoint>
>                 <http method="post" uri-template="{uri.var.apiUrl}
> /api/v2/tickets"/>
>             </endpoint>
>         </call>
>
>         <!-- Remove response custom header information -->
>         <header name="X-Runtime" scope="transport" action="remove"/>
>         <header name="X-Powered-By" scope="transport" action="remove"/>
>
>     </sequence>
> </template>
>
>
>
> [2] <?xml version="1.0" encoding="UTF-8"?>
> <proxy xmlns="http://ws.apache.org/ns/synapse";
>        name="createTicket"
>        startOnLoad="true"
>        statistics="disable"
>        trace="disable"
>        transports="https,http">
>    <target>
>       <inSequence onError="faultHandlerSeq">
>          <property expression="json-eval($.apiUrl)" name="apiUrl"/>
>          <property expression="json-eval($.apiKey)" name="apiKey"/>
>          <property expression="json-eval($.requesterId)"
> name="requesterId"/>
>          <log level="custom">
>             <property expression="get-property('requesterId')"
>                       name="121212121212121212121212121212"/>
>          </log>
>          <freshdesk.init>
>             <apiKey>{$ctx:apiKey}</apiKey>
>             <apiUrl>{$ctx:apiUrl}</apiUrl>
>          </freshdesk.init>
>          <freshdesk.createTicket>
>             <requesterId>{$ctx:requesterId}</requesterId>
>          </freshdesk.createTicket>
>          <respond/>
>       </inSequence>
>       <outSequence>
>          <log/>
>          <send/>
>       </outSequence>
>    </target>
>    <description/>
> </proxy>
>
>
> Best Regards,
> Yashothara.S
> Software Engineer
> WSO2
> http://wso2.com
> https://wso2.com/signature
> <https://www.google.com/url?q=https%3A%2F%2Fwso2.com%2Fsignature&sa=D&sntz=1&usg=AFQjCNFqSCK3YQC9g0l53f6yjvsVrxRHXg>
>
> On Wed, Sep 21, 2016 at 10:20 AM, Malaka Silva <mal...@wso2.com> wrote:
>
>> Hi Yashothara,
>>
>> Can you share the config you used.
>>
>> On Wed, Sep 21, 2016 at 9:33 AM, Yashothara Shanmugarajah <
>> yashoth...@wso2.com> wrote:
>>
>>> Hi,
>>>
>>> I need to send JSON payload with long (for e.g 19000010655) not as
>>> String. In the back end it changes as a scientific notation 
>>> (1.9000096356E10)
>>> in ESB 5.0.0. Is there any way to resolve this?
>>>
>>> Thanks.
>>>
>>> Best Regards,
>>> Yashothara.S
>>> Software Engineer
>>> WSO2
>>> http://wso2.com
>>> https://wso2.com/signature
>>> <https://www.google.com/url?q=https%3A%2F%2Fwso2.com%2Fsignature&sa=D&sntz=1&usg=AFQjCNFqSCK3YQC9g0l53f6yjvsVrxRHXg>
>>>
>>
>>
>>
>> --
>>
>> Best Regards,
>>
>> Malaka Silva
>> Senior Technical Lead
>> M: +94 777 219 791
>> Tel : 94 11 214 5345
>> Fax :94 11 2145300
>> Skype : malaka.sampath.silva
>> LinkedIn : http://www.linkedin.com/pub/malaka-silva/6/33/77
>> Blog : http://mrmalakasilva.blogspot.com/
>>
>> WSO2, Inc.
>> lean . enterprise . middleware
>> https://wso2.com/signature
>> http://www.wso2.com/about/team/malaka-silva/
>> <http://wso2.com/about/team/malaka-silva/>
>> https://store.wso2.com/store/
>>
>> Don't make Trees rare, we should keep them with care
>>
>
>


-- 
----------------------------------------------------------

*Nuwan Chamara Pallewela*


*Software Engineer*

*WSO2, Inc. *http://wso2.com
*lean . enterprise . middleware*

Email   *nuw...@wso2.com <nuw...@wso2.com>*
Mobile  *+94719079739@*
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to