[LinkedIn Connector] Demo not working - "An error has occurred while calling a service"

Forge Component
Published on 2018-12-11 by OutSystems R&D
4 votes
Published on 2018-12-11 by OutSystems R&D
I'm trying to integrate linkedIn into my app but having troubles using Profile_CurrentMember action - I have  "An error has occurred while calling a service" error on debug and page redirects to internal error page.
Also action GetLinkedInTokenToken doesn't set any values.
Will apreciate any help.
Thank you.
Hey there, Mykola,

Sorry for the late reply. I just tested the Demo for the connector on our environment and everything looks fine (it's using the 'Profile_CurrentMember' action, as well).

Can you access Service Center's Error Logs page and show us the stack? If possible, would you also share the Integration logs for the 'LinkedInConnector' REST endpoints (be careful not to share sensitive information, like API keys or login details)?

My guess is it might be configuration-related, so both of these should point us in the right direction.

Best regards,
Carlos Simões
Hi Carlos,

I was testing and trying to find out the reason of demo not working and discovered that  ProfileCurrentMember failes with 404 error and message from LinkedIn:
"Could not find person based on: ~%3A%28id%2Cformatted-name%2Cpicture-url%2Clocation%2Cindustry%2Cheadline%2Cpublic-profile-url%29"
The endpoint is 

 and stack is 
An error has occurred while calling a service
  ssLinkedinConnector.Actions.CcLinkedinCallbacks.FlowLinkedinActionOnAfterResponse(HeContext heContext, STHTTPResponseStructure inParamResponse, STHTTPResponseStructure& outParamModifiedResponse)
   at ssLinkedinConnector.CcLinkedin.ActionProfileCurrentMember(HeContext heContext, ICcLinkedinCallbacks _callbacks, String inParamAcceptLanguage, String inParamFieldSelector, STProfile3Structure& outParamResponse)

I think that it may be related to URL encoding as when I try to call basic info API https://api.linkedin.com/v1/people/~?format=json it works fine but as soon as I add profile fields I start having this error. Ifhttps://api.linkedin.com/v1/people/~:(id,num-connections,picture-url)?format=json

and puting it to official linkedin API console https://apigee.com/console/linkedin gives same error. Meanwhile decodin URL to https://api.linkedin.com/v1/people/~:(id,formatted-name,picture-url,location,industry,headline,public-profile-url) is working perfectly in console.

Hmm, I'm assuming you haven't changed the field selector parameter from its ":(id,num-connections,picture-url)" value, right? Looking at LinkedInConnector, the OnBeforeRequest action takes the FieldSelector parameter and adds a colon immediately before of it in the resulting URL, so we shouldn't pass it with a colon included.

It's working fine on our server, and that's the only thing I can think of off the top of my head. If that's not the case, could you share your stack and Platform version, please? That might give us something to go on, that would explain why we are seeing a different behavior.
Hi Carlos,
I've managed to get it working by replacing encoded URL sybmobs with non encoded ("(",")",":",",") in OnBeforeRequest Action in ModifiedRequest.URLPath

I've noticed that on original Field selectors replace flow  "%2c" and "%3a" are used and in my case I had to use appercase %2C and %3A. I've tried to do this small change to original flow but it didn't help (I will give it another try later becouse for my purpose the porblem is solved with abve mentioned workaround).

So It might be related to case sensitivity settings (if there are any) or platform version as few weeks ago it was working perfectly and I suspect that platform version was another then.

Here is more info from this error:

Platform version is Version 9.1.300.1

Environment Information:
eSpaceVer: 18 (Id=1239, PubId=1233, CompiledWith=9.1.300.1)
RequestUrl: https://darwinlabs.outsystemscloud.com/LinkedinConnDemo/YourProfile.aspx (Method: GET)
AppDomain: /LM/W3SVC/28/ROOT/LinkedinConnDemo-443-131050221521294711
FilePath: C:\OutSystems\Sandboxes\ZD2UXF027\Platform Server\running\LinkedinConnDemo\YourProfile.aspx
Locale: en-US
DateFormat: yyyy-MM-dd
PID: 39600 ('w3wp', Started='3/29/2016 2:50:06 PM', Priv=885Mb, Virt=18430Mb)
TID: 352
Thread Name: 
.NET: 4.0.30319.34209

I've added some additional info in error messsage (responce status and messsage)

An error has occurred while calling a service 404 {
  "errorCode": 0,
  "message": "Could not find person based on: ~%28id%2Cnum-connections%2Cpicture-url%2Cformatted-name%2Clocation%29",
  "requestId": "A8GUWSDXKU",
  "status": 404,
  "timestamp": 1460548708747
   at ssLinkedinConnector.CcLinkedin.ActionProfileCurrentMember2(HeContext heContext, ICcLinkedinCallbacks _callbacks, String inParamFieldSelector, String inParamSecureURLs, String inParamAcceptLanguage, STProfileStructure& outParamProfile)
   at ssLinkedinConnector.Actions.ActionProfile_CurrentMember(HeContext heContext, String inParamFieldSelector, String inParamSecureURLs, String inParamAcceptLanguage, STProfileStructure& outParamProfile)
   at ssLinkedinConnDemo.RsseSpaceLinkedinConnector.MssProfile_CurrentMember(HeContext heContext, String inParamFieldSelector, String inParamSecureURLs, String inParamAcceptLanguage, IRecord& outParamProfile)
   at ssLinkedinConnDemo.Flows.FlowMainFlow.ScrnYourProfile.Preparation(HeContext heContext)
   at ssLinkedinConnDemo.Flows.FlowMainFlow.ScrnYourProfile.Page_Load(Object sender, EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Thanks for sharing your solution, Nick!

Our test server is a few versions behind, so I suspected that could be related. We're going to analyse this behavior sometime in the future, so it's consistent with the latest Platform behavior.

Is this workaround acceptable for your intended purposes?
Yes, this workaround is perfectly fine for our purposes)

I was also trying to use the demo of this component and i'm having the same issue. I did the fix Mykola suggested but still have the same error. 

Anyone knows what can it be that i'm doing wrong?

Thx in advance.

Hey, Marcelo, Mykola,

We just released a new version of the connector with this issue fixed for 9.1.601.0.

Would you please test it and if you still bump into problems, would you lets know?

Best regards,

Carlos Simões