Hi Indika,

This is a JSON to JSON scenario? In that case you can try something like
the following:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse";
       name="TestProxy"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>

         <property name="uri.var.linkedinUrl"
expression="json-eval($.appUri)"/>
         <property name="uri.var.accessToken"
expression="json-eval($.accessToken)"/>
         <property name="uri.var.contentType"
expression="json-eval($.contentType)"/>
         <property name="uri.var.postBody"
expression="json-eval($.postBody)"/>
         <header name="x-li-format" scope="transport" value="json"/>

         <payloadFactory media-type="json">
            <format>
                                {
                                        "contentType":"$1",
                                        "body":"$2"
                                }
                        </format>
            <args>
               <arg evaluator="xml"
expression="get-property('uri.var.contentType')"/>
               <arg evaluator="xml"
expression="get-property('uri.var.postBody')"/>
            </args>
         </payloadFactory>

         <property name="messageType" value="application/json"
scope="axis2"/>

         <property name="FORCE_HTTP_1.0" value="true" scope="axis2"/>
         <call>
            <endpoint>
               <http method="post" uri-template="http://localhost:8281/"/>
            </endpoint>
         </call>
         <drop/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>



On Thu, Dec 26, 2013 at 7:07 PM, Dushan Abeyruwan <[email protected]> wrote:

> HI
>  Enable wire logs and post the logs
>
>
> On Thu, Dec 26, 2013 at 4:32 PM, indika prasad <[email protected]>wrote:
>
>> Reposting:
>>
>> Hi Dushan,
>>
>> Thanks for your response.
>>
>> However, we're seeing the correct output with the proxy you provided, but
>> the request times out with our synapse template + proxy combo.
>>
>> Contents of the template:
>>
>> <template xmlns="http://ws.apache.org/ns/synapse"; name="sendActivity">
>>
>>    <sequence>
>>
>>       <header name="x-li-format" scope="transport" value="json"></header>
>>
>>       <payloadFactory media-type="json">
>>
>>          <format>     {"contentType":"linkedin-html","body":"hello Test"}
>> </format>
>>
>>       </payloadFactory>
>>
>>       <property name="messageType" value="application/json"
>> scope="axis2"></property>
>>
>>      <property name="FORCE_HTTP_1.0" value="true"
>> scope="axis2"></property>
>>
>>       <call>
>>
>>          <endpoint>
>>
>>             <http method="post"
>> uri-template="http://localhost:8281/";></http>
>>
>>          </endpoint>
>>
>>       </call>
>>
>>    </sequence>
>>
>> </template>
>>
>> Proxy:
>>
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <proxy xmlns="http://ws.apache.org/ns/synapse";
>>        name="sendActivity"
>>        transports="https,http"
>>        statistics="disable"
>>        trace="disable"
>>        startOnLoad="true">
>>    <target>
>>       <inSequence>
>>          <call-template target="sendActivity">
>>          </call-template>
>>          <respond/>
>>       </inSequence>
>>       <outSequence>
>>          <send/>
>>       </outSequence>
>>    </target>
>>    <description/>
>> </proxy>
>>
>> The JSON message sent out to TCP Mon is correct now. Copy pasting the TCP
>> mon request headers and body to SoapUI and running as a REST project
>> returns
>> the correct 201 status from the LinkedIn API, so we know this
>> configuration
>> is sending out the correct message. When redirecting the synapse template
>> to
>> LinkedIn by setting the correct URL in it, the request times out. Could
>> this
>> be because LinkedIn is returning an HTTP 201 status?
>>
>>
>>
>> Thanks.
>>
>>
>>
>> --
>> View this message in context:
>> http://wso2-oxygen-tank.10903.n7.nabble.com/JSON-string-in-request-being-reformatted-by-ESB-tp90183p90195.html
>> Sent from the WSO2 Development mailing list archive at Nabble.com.
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>
>
>
> --
> Dushan Abeyruwan | Associate Tech Lead
> Integration Technologies Team
> PMC Member Apache Synpase
> WSO2 Inc. http://wso2.com/
> Blog:http://dushansview.blogspot.com/
> Mobile:(0094)713942042
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
*Ravi Undupitiya*
Software Engineer; WSO2 Inc.; http://wso2.com


*E-mail: [email protected] <http://wso2.com>**M: **+94 772 930 712*

Lean . Enterprise . Middleware
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to