1. Simone Olianti
  2. PowerServer Mobile (Obsolete)
  3. Friday, 28 August 2020 13:49 PM UTC

PowerServer (PB Edition) 2020 Build 2323.00
PowerBuider 2019R2 Build 2353

Hello, i have two similar applications for web and mobile (Android) that consume a rest service using HTTPClient to create an event on google calendar using Google Calendar Api.
The app running on the web browser (and iwa) working great, but the same function fails on the mobile app returning a "400 Bad Request Error".

I've already tried a full deploy after updating the PowerServer Template Manager, also have tried different approaches on the mobile app but getting same error.
I've read somewhere that PowerServer Mobile 2020 supports HttpClient, am i wrong?

Any ideas?

tia,

 simone

 

here is an example extrapolated from the method i'm using to communicate with the calendar api:

//creating the simple Json structure needed by calendar api
ls_string = '{"summary":"' + ls_rag + '","description":"' + is_tit_new + '   ' + char(13) +char(10) + is_des_new + '","location":"' + ls_loc + '",'
ls_string = ls_string + '"start":{"dateTime":"' + string(id_dataint_new, "yyyy-mm-dd") + ls_tini + '","timeZone":"Europe/Rome"},"end":{"dateTime":"' + string(id_dataint_new, "yyyy-mm-dd") + ls_tfin + '","timeZone":"Europe/Rome"},'
ls_string = ls_string + '"attendees":[{"displayName":"' + ls_nomeut + '","email":"' + ls_mailut + '"}]}'

//using the generated token before
ln_http = create httpclient
ls_URL = ls_gc_uri + '/calendars/' + calendarId + '/events'
as_conferenceDataVersion = '&conferenceDataVersion=' + string(conferenceDataVersion)
as_maxAttendees = '&maxAttendees=' + string(maxAttendees)
sendNotifications = '&sendNotifications=' + sendNotifications
supportsAttachments = '&supportsAttachments=' + supportsAttachments

ls_access = 'access_token=' + ls_access_token
ls_parm = ls_access + as_conferenceDataVersion + as_maxAttendees + sendNotifications + supportsAttachments
ls_url = ls_url + '?' + ls_parm
bdata = blob(ls_string, EncodingUTF8!)

ls_mime = 'application/json'
ln_http.SetRequestHeader("Content-Type", ls_mime)

li_ret = ln_http.sendrequest( 'POST', ls_url, bdata)  
if li_ret = 1 then
    li_rc = ln_http.GetResponseStatusCode()
    ls_response = nvl(ln_http.getresponsestatustext( ), '')
    if li_rc = 200 then  //OK!
        ln_http.GetResponseBody(ls_string)        
        rtparm = ls_string     
        destroy ln_http
        return 1               
    else
        ln_http.GetResponseBody(ls_string)
        ls_string = '('+string(li_rc) + ') ' + ls_response + '~r~n'+ls_string        
        messagebox("of_post_events_insert", ls_string, stopsign!, ok!)    
        destroy ln_http
        return 0
    end if
else
    messagebox("of_post_events_insert", "Connection error!", stopsign!, ok!)
    destroy ln_http
    return 0
end if 

Accepted Answer
Kai Zhao @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 2 September 2020 06:52 AM UTC
  2. PowerServer Mobile (Obsolete)
  3. # Permalink

Hi Simone,

The httpclient issue on Mobile had been fixed in Mobile templates build 2328, please follow steps
below to solve it.

1 Go to Toolkit > Package > PowerServer Mobile Templates Manager to install
template 'PowerServer 2020 build 2328'.

2 Add new package profile which use above template.

3 Package application again.


Regards,
ZhaoKai

Comment
  1. Kai Zhao @Appeon
  2. Wednesday, 2 September 2020 23:56 PM UTC
Please try package customized Appeon Workspace to see if it is work well.
  1. Helpful
  1. Simone Olianti
  2. Thursday, 3 September 2020 10:51 AM UTC
seems like the app it's crashing both ways on my enviroment
  1. Helpful
  1. Kai Zhao @Appeon
  2. Friday, 4 September 2020 00:11 AM UTC
Does other applications work well? please provide a simple PB case to reproduce the issue to us for more study, thanks.
  1. Helpful
There are no comments made yet.


There are replies in this question but you are not allowed to view the replies from this question.