Hi Dev, I've noticed that we haven't enabled the Http content negotiation by default in our products. Basically we've set the following parameter to false.
<parameter name="httpContentNegotiation">true</parameter> I would to see why we haven't enabled it by default. When I enable it, following use cases works for a data service. I've deployed RESTful data service and trying get xml and JSON. Super tenant mode --------------------------- 1) GET https://sam-test.sam.com:9449/services/SpringSampleCustomer.SecureHTTPEndpoint/customer/1 Accept: application/xml 2) GET https://sam-test.sam.com:9449/services/SpringSampleCustomer.SecureHTTPEndpoint/customer/1 Accept: application/json MT mode -------------------------- 3) GET https://sam-test.sam.com:9449/services/t/wso2.com/SpringSampleCustomer.SecureHTTPEndpoint/customer/1 Accept: application/xml 4) GET https://sam-test.sam.com:9449/services/t/wso2.com/SpringSampleCustomer.SecureHTTPEndpoint/customer/1 Accept: application/json The 4th scenario does not work. Basically there are few problems in REST support in MT mode. I have a fix for that and I will address that in a different thread. I found some useful blogs by Keith[1] and Sanjiva[2] on this feature. Shall we enable it by default, if there are no issues? Thanks, sameera. [1] http://www.keith-chapman.org/2008/09/http-content-negotiation-with-apache.html [2] http://sanjiva.weerawarana.org/2008/10/http-content-negotiation-in-axis2.html ---------- Forwarded message ---------- From: Hiranya Jayathilaka <[email protected]> Date: Mon, Feb 27, 2012 at 5:29 AM Subject: Re: [Carbon-dev] ESB does not honor Accept header... [?] To: [email protected] 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 -- Sameera Jayasoma Senior Technical Lead WSO2, Inc. (http://wso2.com) email: [email protected] blog: http://sameera.adahas.org Lean . Enterprise . Middleware
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
