0

Background

I need to display the list of Top 3 downloaded file, in an widget when a person logs into a Community.

I am using Social Business Toolkit at the backend to fetch that data, and send it as JSON string to the widget, to display the same.

Question:

To fetch the Files from the community via SBT requires authentication (endpoint access).

In this scenario how can the user credentials from iWidget be passed to the customized servlet, so that it can fetch all the files from the same Connections Community

I would avoid re-authentication as the user has already authenticated when he enters the Community.


Get the following error when called from the iWidget

java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest at org.apache.http.impl.client.AbstractHttpClient.determineTarget(AbstractHttpClient.java:584) at 
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:576) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:554) at com.ibm.sbt.services.client.ClientService.executeRequest(ClientService.java:1108) at com.ibm.sbt.services.client.ClientService._xhr(ClientService.java:1071) at com.ibm.sbt.services.client.ClientService.execRequest(ClientService.java:1037) at com.ibm.sbt.services.client.ClientService.xhr(ClientService.java:997) at com.ibm.sbt.services.client.ClientService.get(ClientService.java:873) at com.ibm.sbt.services.client.ClientService.get(ClientService.java:869) at com.ibm.sbt.services.client.base.BaseService.retrieveData(BaseService.java:371) at com.ibm.sbt.services.client.base.BaseService.retrieveData(BaseService.java:395) at com.ibm.sbt.services.client.base.BaseService.retrieveData(BaseService.java:346) at com.ibm.sbt.services.client.base.BaseService.getEntities(BaseService.java:205) at com.ibm.sbt.services.client.connections.communities.CommunityService.getMyCommunities(CommunityService.java:260) at 
com.ibm.sbt.services.client.connections.communities.CommunityService.getMyCommunities(CommunityService.java:244) at com.ibm._jsp._Test._jspService(_Test.java:124) at 

This is what the Lib folder looks inside enter image description here

bukubapi
  • 497
  • 2
  • 5
  • 13

1 Answers1

0

You should use the ConnectionsSSOEndpoint in your managed-beans.xml file

<!-- Connections SSO -->    
<managed-bean>
<managed-bean-name>connections</managed-bean-name>
<managed-bean-class>com.ibm.sbt.services.endpoints.ConnectionsSSOEndpoint</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>url</property-name>
<value>${connectionsUrl}</value>
</managed-property>
<!-- Trust the connection -->
<managed-property>
<property-name>forceTrustSSLCertificate</property-name>
<value>true</value>
</managed-property>
<managed-property>
<property-name>serviceMaps</property-name>
<value>${connectionsMaps}</value>
</managed-property>
</managed-bean>

The SSO Endpoint uses the ltpatoken and ltpatoken2 tokens from the existing session to automatically log you in to the backend service

Paul Bastide
  • 1,505
  • 4
  • 17
  • 22
  • Added the error that I am getting when called from iWidget using Connections SSO – bukubapi Mar 19 '15 at 09:49
  • Just quickly to add - I installed the sbt.sample-1.0.3.20140723-1200.ear on my WAS that has connections. When I try to access any snippets like GetCommunityFiles, I get the following error. "org/apache/http/client/HttpClient.execute(Lorg/apache/http/client/methods/HttpUriRequest;)Lorg/apache/http/HttpResponse;" – bukubapi Mar 19 '15 at 11:09
  • change the classloading policy to PARENT_LAST for your war file – Paul Bastide Mar 19 '15 at 11:52
  • After Change in WAS, I get the following error now. - Error 500: java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest. Just to add, I am getting the same error in the sbt sample application too – bukubapi Mar 19 '15 at 12:10
  • I restarted the server. The error got resolved. But now facing a different error.Error 500: javax.servlet.ServletException: Filter [SBTFilter]: not a filter class. This application was working on a Tomcat Server, before I deployed it on WAS 8.0.05. Anything that I am missing here – bukubapi Mar 19 '15 at 12:21
  • I'd say that the classes are not in the right locations, maybe add them to the WEB-INF/lib directory – Paul Bastide Mar 19 '15 at 12:59
  • All the jar files are in the web-inf/lib directory. Have added a snapshot to the original question – bukubapi Mar 19 '15 at 16:25
  • if you can't find the Filter, I would suggest the class is not being found. That leads to the ClassPath issues, restarting and checking. also, you want to check that your web.xml is configured the same. – Paul Bastide Mar 19 '15 at 16:36
  • Tried all the things suggested, not sure where the classpath breaks. The web.xml is the same available in the sample war. Any pointers would help – bukubapi Mar 20 '15 at 09:22
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/73411/discussion-between-paul-bastide-and-bukubapi). – Paul Bastide Mar 20 '15 at 11:24