Android Question Webview Error with Parameters

andrewj

Active Member
Licensed User
Longtime User
Hi,

I am calling a REST API using webClient in OKHTTPUtils2 . I am migrating a VB.Net application which works perfectly, so I know my calls are correct.

With simple calls which have no parameters, everything works fine. E.g.
Dim sAPI As String = "/v2.0/cloud/space/child"
Dim sParameters() As String
Dim webClient As HttpJob
'webClient.Download(sCallURI) ' This works fine as well
webClient.Download2(sCallURI,sParameters)
webClient.GetRequest.SetHeader("client_id", sClientID) ' Set the request headers
webClient.GetRequest.SetHeader("access_token", sToken)
webClient.GetRequest.SetHeader("t", sTimestamp)
webClient.GetRequest.SetHeader("sign_method", "HMAC-SHA256")
webClient.GetRequest.SetHeader("sign", sSignature)
Wait For (webClient) JobDone(webClient As HttpJob) ' Execute the job

However, as soon as I set the parameters, the web job fails with the error message "java.net.UnknownHostException: Unable to resolve host "openapi.tuyaeu.com": No address associated with hostname". The behaviour is the same regardless of whether I build a parameter string, add it to the URI with a "?", and use Download, or if I build it as a string array and use Download2, e.g.:
Dim sParameters() As String = Array As String ("page_no", iPage, "page_size", "20", "space_id", sSpaceID)

What can be causing this? It looks like the act of adding parameters is somehow corrupting the base URI. Any ideas?

Thanks, Andrew
 
with okhttp2 if user forgets to add a scheme, erel graciously provides https. host not found error generally means somebody is not online.
 
Upvote 0
Back
Top