0
votes

I have a very simple Worklight project that has two adapters. The first is talking to LinkedIn OAuth services to return an access token. The second takes the access token and calls LinkedIn's API services. The code works beautifully in project A. Project A is a larger project and includes a bunch of other things. I took the working adapters and copied them into project B. The adapters are word for word the same. The security settings between the projects are identical. Both adapters are deployed and I can verify them on the Worklight Console. However, in project B, when i call the oauth adapter i get the access token just fine, when i turn around and call the api adapter I get an error immediately saying that the host is unresponsive. UNRESPONSE_HOST "The service is currently not available".

Here is the logcat messages: 01-16 15:42:44.298: D/LinkedIn(3101): Request [http://192.168.245.1:10080/LinkedInDevWorks/apps/services/api/LinkedIn/android/query] 01-16 15:42:44.488: E/LinkedIn(3101): [http://192.168.245.1:10080/LinkedInDevWorks/apps/services/api/LinkedIn/android/query] Host is not responsive. Try to manually access the URL through the android emulator browser to verify connectivity.

I'm running out of ideas... I looked at this article: http://www.ibm.com/developerworks/websphere/techjournal/1212_paris/1212_paris.html on adapter error messages but the settings between the two projects are identical so it's odd that it works on one and not the other.

I am running worklight 6.0

1
If you run both apps (from project A and B) side-by-side, appA works and appB fails? Are the 2 projects hosted on the same Worklight Server?Idan Adar
Yes, the two projects are hosted on the same worklight server, and yes, appA works and appB fails when ran side by side. I did some more digging and it could be a timing issue? When i call the second adapter within the success handler from the first adapter or from within the wlCommonInit() method it does NOT throw the UNRESPONSIVE_HOST error.ldeluca
in project B, are you calling WL.Client.connect() twice?Zarathuztra
No, it's not called at once. As per the comment in the generated file option 1 connectOnStartup = true was set. but same error if false.ldeluca
If you say that the second adapter needs the token from the first adapter, it would make sense to me to make sure adapter1 finished before calling adapter2 (hence your success while running it from the success handler)Nathan H

1 Answers

0
votes

I still haven't found a solution to this problem but I wanted to post the workaround as an answer for others facing a similar problem:

"When i call the second adapter within the success handler from the first adapter or from within the wlCommonInit() method it does NOT throw the UNRESPONSIVE_HOST error."