On Mon, Feb 27, 2012 at 3:06 PM, Miyuru Wanninayaka <[email protected]> wrote:

> Hi Prabath,
>
> It's true that ESB does not nativity support Accept header and response
> content type will be same as request content type if not overridden using
> messageType header in outSequence.
>

Not just ESB. None of the Axis2 HTTP transports support this properly.


>
> Your workaround is acceptable.
>
> However there is few cases which we do not have proper solutions:
>
> * Accept header does not contain any contetn type which particular ESB
> does not have message formatter
> * Accept header contains multiple content types
>
> On Sun, Feb 26, 2012 at 11:48 AM, Prabath Siriwardena <[email protected]>wrote:
>
>> This what I want to - I want to send the request in SOAP and get the
>> response as JSON..
>>
>> So - this is how I used curl for it.. by setting Accept header to
>> application/json - and I was expecting a JSON response..
>>
>> curl -d @request.soap -H "Content-Type: application/soap+xml
>> action=getQuote" -H "Accept: application/json"
>> http://localhost:8080/services/test
>>
>> But this always returned back a SOAP response - ignoring the Accept
>> header..
>>
>> Do I have to do anything else to get this work..? I also set
>> httpContentNegotiation to true in axis2.xml but the same result..
>>
>> This is the workaround I followed and it worked..
>>
>> <inSequence>
>>                <property name="IN_ACCEPT_HEADER"
>> expression="$trp:Accept"/>
>>  </inSequence>
>>  <outSequence>
>>                <log level="custom">
>>                    <property name="IN_ACCEPT_HEADER"
>> expression="get-property('IN_ACCEPT_HEADER')"/>
>>                </log>
>>                <property name="messageType"
>> expression="get-property('IN_ACCEPT_HEADER')" scope="axis2"/>
>>                <send/>
>>   </outSequence>
>>
>> What would be the acceptable solution for this...?
>>
>>
>> --
>> Thanks & Regards,
>> Prabath
>>
>> Mobile : +94 71 809 6732
>>
>> http://blog.facilelogin.com
>> http://RampartFAQ.com
>>
>> _______________________________________________
>> Carbon-dev mailing list
>> [email protected]
>> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>>
>>
>
>
> --
> Thanks,
> Miyuru
>
> _______________________________________________
> Carbon-dev mailing list
> [email protected]
> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>
>


-- 
Hiranya Jayathilaka
Associate Technical Lead;
WSO2 Inc.;  http://wso2.org
E-mail: [email protected];  Mobile: +94 77 633 3491
Blog: http://techfeast-hiranya.blogspot.com
_______________________________________________
Carbon-dev mailing list
[email protected]
http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev

Reply via email to