Can you the uri.var prefix from property names, and try?

On Tuesday, December 24, 2013, indika prasad wrote:

> Hi,
>
> In the development of the connector for LinkedIn, we are getting problem
> related to sending JSON via the POST method.
>
> LinkedIn requires a JSON string in the following format to be posted:
> {
>         "contentType":"linkedin-html",
>         "body":"update body"
> }
>
> The properties defined in the synapse template for this method are as
> follows:
>
> <property name="uri.var.linkedinUrl" expression="$func:appUri" />
> <property name="uri.var.accessToken" expression="$func:accessToken" />
> <property name="uri.var.contentType" expression="$func:contentType" />
> <property name="uri.var.postBody" expression="$func:postBody" />
>
> I have turned on Axis2 JSON stream builder options, and also have added the
> messageType Axis2 property to the synapse template.
>
> When using a payload factory in the following manner:
>                 <payloadFactory media-type="json">
>                         <format>
>                                 {
>                                         "contentType":"$1",
>                                         "body":"$2"
>                                 }
>                         </format>
>                         <args>
>                             <arg
> expression="get-property('uri.var.contentType')" />
>                             <arg
> expression="get-property('uri.var.postBody')" />
>                         </args>
>                 </payloadFactory>
>
> The JSON being sent out by the ESB to the LinkedIn API (monitored via TCP
> Mon) is this:
> {
>
>
> "accessToken":"AQWvIwvrmVtaIp-o0PCeFfLtLXxNGmIf5pYaRrLUriuts-baLgWVp_6eYBTEDOepQZ5BOb34OLY2m3X4lWNMiCPncKPQ6iNE4RJ-cXAwLvdQXjHE6mg6WK_nNv184XYjpSV0wqr6TXVknJHy5B5RaJSfCja6KG7ScL7SniN7fLaew3GNtLg",
>    "contentType":"linkedin-html",
>    "postBody":"Hello",
>    "jsonObject":{
>       "contentType":"linkedin-html",
>       "body":"Hello"
>    }
> }
>
> Upon removing the PayloadFactory and sending, the ESB sends out the
> following JSON object:
>
> {
>    "appUri":"https:\/\/api.linkedin.com\/v1",
>
>
> "accessToken":"AQWvIwvrmVtaIp-o0PCeFfLtLXxNGmIf5pYaRrLUriuts-baLgWVp_6eYBTEDOepQZ5BOb34OLY2m3X4lWNMiCPncKPQ6iNE4RJ-cXAwLvdQXjHE6mg6WK_nNv184XYjpSV0wqr6TXVknJHy5B5RaJSfCja6KG7ScL7SniN7fLaew3GNtLg",
>    "contentType":"linkedin-html",
>    "postBody":"Hello"
> }
>
> Both formats are not accepted by the LinkedIn API.
>
> I'd greatly appreciate if I could get some suggestions on how to format
> this
> JSON properly via the synapse template.
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://wso2-oxygen-tank.10903.n7.nabble.com/JSON-string-in-request-being-reformatted-by-ESB-tp90183.html
> Sent from the WSO2 Development mailing list archive at Nabble.com.
> _______________________________________________
> Dev mailing list
> [email protected] <javascript:;>
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>


-- 
*Kasun Gajasinghe*
Software Engineer;
WSO2 Inc.; http://wso2.com


 ,
*email: *
*kasung AT spamfree wso2.com <http://wso2.com>  ** cell: **+94 (77)
678-0813*
*linked-in: *http://lk.linkedin.com/in/gajasinghe



*blog: **http://kasunbg.org* <http://kasunbg.org>



*twitter: **http://twitter.com/kasunbg* <http://twitter.com/kasunbg>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to