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
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to