Hi Samisa/Anjana, I've faced the same problem sometime back when I was working on a DSS based solution. At that I've raised the same concern in the dev list with the following subject.
"Enabling Http Content Negotiation by default in AS and DSS." Looks like this change is not available in the axis2.xml in 4.2.0 based products. Thanks, Sameera. On Wed, Dec 4, 2013 at 3:01 PM, Anjana Fernando <anj...@wso2.com> wrote: > Hi, > > Yeah, maybe it should. Sameera, can we add this change to kernel's > axis2.xml? .. @Chanika, check if we get the axis2.xml from the kernel, or > if we have our own one. > > Cheers, > Anjana. > > > On Wed, Dec 4, 2013 at 2:54 PM, Samisa Abeysinghe <sam...@wso2.com> wrote: > >> Cool, that works. BTW, should not that parameter be set by default? >> >> Thanks, >> Samisa... >> >> >> Samisa Abeysinghe >> >> Vice President Training >> >> WSO2 Inc. >> http://wso2.com >> >> >> >> On Wed, Dec 4, 2013 at 2:22 PM, Anjana Fernando <anj...@wso2.com> wrote: >> >>> Hi Samisa, >>> >>> I forgot one part, you need to add the following to the axis2.xml. >>> >>> <parameter name="httpContentNegotiation">true</parameter> >>> >>> Cheers, >>> Anjana. >>> >>> >>> On Wed, Dec 4, 2013 at 2:14 PM, Samisa Abeysinghe <sam...@wso2.com>wrote: >>> >>>> That seems a bug that accept does not work, but content-type does? >>>> >>>> Thanks, >>>> Samisa... >>>> >>>> >>>> Samisa Abeysinghe >>>> >>>> Vice President Training >>>> >>>> WSO2 Inc. >>>> http://wso2.com >>>> >>>> >>>> >>>> On Wed, Dec 4, 2013 at 2:13 PM, Samisa Abeysinghe <sam...@wso2.com>wrote: >>>> >>>>> However, I figured that >>>>> curl -H "Content-Type: application/json" -X GET >>>>> http://localhost:9763/services/samples/ResourcesSample.HTTPEndpoint/products >>>>> works! >>>>> >>>>> >>>>> Thanks, >>>>> Samisa... >>>>> >>>>> >>>>> Samisa Abeysinghe >>>>> >>>>> Vice President Training >>>>> >>>>> WSO2 Inc. >>>>> http://wso2.com >>>>> >>>>> >>>>> >>>>> On Wed, Dec 4, 2013 at 2:11 PM, Samisa Abeysinghe <sam...@wso2.com>wrote: >>>>> >>>>>> With the REST sample, I tried >>>>>> curl -H "Accept: application/json" -X GET >>>>>> http://localhost:9763/services/samples/ResourcesSample.HTTPEndpoint/products >>>>>> >>>>>> but it still returns XML. >>>>>> >>>>>> Thanks, >>>>>> Samisa... >>>>>> >>>>>> >>>>>> Samisa Abeysinghe >>>>>> >>>>>> Vice President Training >>>>>> >>>>>> WSO2 Inc. >>>>>> http://wso2.com >>>>>> >>>>>> >>>>>> >>>>>> On Wed, Dec 4, 2013 at 2:04 PM, Anjana Fernando <anj...@wso2.com>wrote: >>>>>> >>>>>>> Hi Samisa, >>>>>>> >>>>>>> We don't actually have a specific sample for JSON as I know, Chanika >>>>>>> was writing an article for this, with some scenarios, but didn't publish >>>>>>> yet as I know. Chanika, do put a section to the docs to mention how to >>>>>>> do >>>>>>> JSON with DSS. >>>>>>> >>>>>>> The content negotiation in data service simply works by setting the >>>>>>> HTTP header "Accept", with the content type as the value. For example, >>>>>>> to >>>>>>> get a JSON response, you would have a HTTP header like the following: >>>>>>> >>>>>>> "Accept: application/json". >>>>>>> >>>>>>> Cheers, >>>>>>> Anjana. >>>>>>> >>>>>>> >>>>>>> On Wed, Dec 4, 2013 at 12:52 PM, Samisa Abeysinghe >>>>>>> <sam...@wso2.com>wrote: >>>>>>> >>>>>>>> To ask a related question, how do I do content negotiation with DSS >>>>>>>> REST? >>>>>>>> >>>>>>>> Thanks, >>>>>>>> Samisa... >>>>>>>> >>>>>>>> >>>>>>>> Samisa Abeysinghe >>>>>>>> >>>>>>>> Vice President Training >>>>>>>> >>>>>>>> WSO2 Inc. >>>>>>>> http://wso2.com >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Wed, Dec 4, 2013 at 12:32 PM, Samisa Abeysinghe <sam...@wso2.com >>>>>>>> > wrote: >>>>>>>> >>>>>>>>> I am looking to do REST with JSON as content type with DSS. >>>>>>>>> >>>>>>>>> Do we have a sample that I can use to get started with? >>>>>>>>> >>>>>>>>> Thanks, >>>>>>>>> Samisa... >>>>>>>>> >>>>>>>>> >>>>>>>>> Samisa Abeysinghe >>>>>>>>> >>>>>>>>> Vice President Training >>>>>>>>> >>>>>>>>> WSO2 Inc. >>>>>>>>> http://wso2.com >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> *Anjana Fernando* >>>>>>> Technical Lead >>>>>>> WSO2 Inc. | http://wso2.com >>>>>>> lean . enterprise . middleware >>>>>>> >>>>>> >>>>>> >>>>> >>>> >>> >>> >>> -- >>> *Anjana Fernando* >>> Technical Lead >>> WSO2 Inc. | http://wso2.com >>> lean . enterprise . middleware >>> >> >> > > > -- > *Anjana Fernando* > Technical Lead > WSO2 Inc. | http://wso2.com > lean . enterprise . middleware > -- Sameera Jayasoma, Architect, WSO2, Inc. (http://wso2.com) email: same...@wso2.com blog: http://sameera.adahas.org twitter: https://twitter.com/sameerajayasoma flickr: http://www.flickr.com/photos/sameera-jayasoma/collections Mobile: 0094776364456 Lean . Enterprise . Middleware
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev