Hi Himasha,

Please refer this article [1]. It has a complete example w.r.t your
requirement. You can try that out and see how it works.

[1]
https://wso2.com/library/articles/2017/03/article-introducing-sdk-support-with-wso2-api-manager/#example

Thanks.

On Wed, Feb 21, 2018 at 9:17 PM, Jason De Silva <jas...@wso2.com> wrote:

> Hi Himasha,
>
> I tried this scenario in a wum updated pack referring [1] for the
> pizzashack api and it worked for me OOB. Did you also try it out in a wum
> updated pack?
>
> [1] https://docs.wso2.com/display/AM210/Write+a+Client+
> Application+Using+the+SDK
>
> Regards,
> Jason
>
> Jason De Silva
> *Software Engineer - QA*
> Mobile: +94 (0) 772 097 678
> Email: jas...@wso2.com
> WSO2 Inc. www.wso2.com
> <http://wso2.com/signature>
>
> On Wed, Feb 21, 2018 at 8:11 PM, Himasha Guruge <himas...@wso2.com> wrote:
>
>> Hi,
>>
>> I'm trying out [1] with Api Manager 2.1.0. I have downloaded the java SDK
>> of PizzaShackAPI and tried to run APIClient main method. At first with the
>> exact same code, I was getting below error.
>>
>>
>> com.google.gson.JsonSyntaxException: java.lang.IllegalStateException:
>> Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2
>>
>>  To sort it out I updated defaultAPI.java code of the SDK, to return a
>> List<Menu> instead, and it got sorted. (See changes below)
>>
>>  public List<Menu> menuGet() throws ApiException {
>>         ApiResponse<List<Menu>> resp = menuGetWithHttpInfo();
>>         return resp.getData();
>>     }
>>
>>
>>        public ApiResponse<List<Menu>> menuGetWithHttpInfo() throws
>> ApiException {
>>         com.squareup.okhttp.Call call = menuGetCall(null, null);
>>         Type localVarReturnType = new TypeToken<List<Menu>>(){}.getT
>> ype();
>>         return apiClient.execute(call, localVarReturnType);
>>     }
>>
>>
>>  However, now I'm getting a response but the menu list is empty. Any idea
>> what could be the issue?
>>
>>
>> [1]https://docs.wso2.com/display/AM210/Write+a+Client+Applic
>> ation+Using+the+SDK#1a97b57b1791422f99d81743523b612e
>>
>> Thanks,
>> Himasha Guruge
>> Senior Software Engineer
>> WS*O2* *Inc.*
>> Mobile: +94 777459299 <+94%2077%20745%209299>
>> himas...@wso2.com
>>
>> _______________________________________________
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>


-- 
Chamin Dias
Mobile : 0716097455
Email : cham...@wso2.com
LinkedIn : https://www.linkedin.com/in/chamindias
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to