31 Replies Latest reply on May 9, 2016 9:55 PM by akhila

    Can someone share an example to implement rest web services in jive 7 Plugin!

    shipra Beginner

      Hello,

       

      I had implemented a restful web service using jax ws in my plugin code as given in the community :Building your own web service

       

      While migrating this plugin to jive 7 the web services are not working. I have tried few things but nothing seem to work. If someone has implemented any code in jive 7 using rest please share it.

      It will be of great help.

        • Re: Can someone share an example to implement rest web services in jive 7 Plugin!
          kparoth Novice

          Hi,

           

          I've implemented an example to use custom rest services.

           

          At first we implement a simple service class, based on the "com.jivesoftware.api.core.v2.services.BaseService", because we can use Jive implemented api.core.v2 features.

          CustomUserService.java

          @Produces("application/json")
          @Path("/users")
          public class CustomUserService extends BaseService {
          
              // Dependency Injections
              private UserProvider userProvider;
              
              /**
               * Sets the value of userProvider.
               * @param userProvider the userProvider to set.
               */
              @Required
              public void setUserProvider(UserProvider userProvider) {
                  this.userProvider = userProvider;
              }
          
              /**
               * Returns the current user.
               * @return the current user.
               */
              @GET
              public UserEntity getCurrentUser() {
                  // Return the current user...
                  return userProvider.getMyUser();
              }
          }
          

           

          And now we need the possibility to register our new service class. The "CoreApiExtensionManager" allows to register own service extensions.

          ServiceRegistrar.java

          public class ServiceRegistrar {
          
              // Dependency Injections
              private CoreApiExtensionManager coreApiExtensionManager;
              private List<Object> serviceBeans;
              private String version;
              private String name;
              
              /**
               * Sets the value of coreApiExtensionManager.
               * @param coreApiExtensionManager the coreApiExtensionManager to set.
               */
              @Required
              public void setCoreApiExtensionManager(
                      CoreApiExtensionManager coreApiExtensionManager) {
                  this.coreApiExtensionManager = coreApiExtensionManager;
              }
              
              /**
               * Sets the value of serviceBeans.
               * @param serviceBeans the serviceBeans to set.
               */
              @Required
              public void setServiceBeans(List<Object> serviceBeans) {
                  this.serviceBeans = serviceBeans;
              }
              
              /**
               * Sets the value of version.
               * @param version the version to set.
               */
              @Required
              public void setVersion(String version) {
                  this.version = version;
              }
              
              /**
               * Sets the value of name.
               * @param name the name to set.
               */
              @Required
              public void setName(String name) {
                  this.name = name;
              }
              
              /**
               * Registers Spring defined services.
               */
              public void register() {
                  register(name, version, serviceBeans);
              }
          
              /**
               * Registers the given service beans.
               * @param name the service name.
               * @param version the service API version.
               * @param serviceBeans the service beans to register.
               */
              public void register(String name, String version, List<Object> serviceBeans) {
                  coreApiExtensionManager.registerServiceExtension(name, version,
                          serviceBeans);
              }
          }
          

           

          We would like to register our service during the Plugin initialization.

          RestPlugin.java

          public class RestPlugin implements Plugin {
          
              // Dependency Injections
              private ServiceRegistrar serviceRegistrar;
              
              /**
               * Sets the value of serviceRegistrar.
               * @param serviceRegistrar the serviceRegistrar to set.
               */
              @Required
              public void setServiceRegistrar(ServiceRegistrar serviceRegistrar) {
                  this.serviceRegistrar = serviceRegistrar;
              }
          
              /* (non-Javadoc)
               * @see com.jivesoftware.base.plugin.Plugin#initPlugin()
               */
              @Override
              public void initPlugin() {
                  // Register services...
                  serviceRegistrar.register();
              }
          
              /* (non-Javadoc)
               * @see com.jivesoftware.base.plugin.Plugin#destroy()
               */
              @Override
              public void destroy() {
                  // Nothing to do!
              }
          
          }
          

           

          ...and we have to define the spring context.

          spring.xml

          <?xml version="1.0" encoding="UTF-8"?>
          <beans xmlns="http://www.springframework.org/schema/beans"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xmlns:util="http://www.springframework.org/schema/util"
                 xmlns:core="http://www.jivesoftware.com/schema/core"
                 xsi:schemaLocation="
                  http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
                  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                  http://www.jivesoftware.com/schema/core classpath:/com/jivesoftware/api/core/spring/core.xsd"
                 default-autowire="no" default-init-method="init" default-destroy-method="destroy">
              
              <bean class="de.unoso.plugin.RestPlugin">
                  <property name="serviceRegistrar" ref="serviceRegistrar" />
              </bean>
              
              <!-- Service Initialization -->
              <core:service id="customUserServiceImpl" v="2" class="de.unoso.plugin.services.CustomUserService" parent="baseServiceV2">
                  <property name="userProvider" ref="userProviderV2"/>
              </core:service>
              
              <!-- Service Registration -->
              <!-- <jive.context>/api/core/ext/custom/v2/<service.url> -->
              <bean id="serviceRegistrar" class="de.unoso.plugin.services.ServiceRegistrar">
                  <property name="coreApiExtensionManager" ref="coreApiExtensionManager" />
                  <property name="version" value="v2" />
                  <property name="serviceBeans">
                      <list>
                          <ref bean="customUserServiceImpl" />
                      </list>
                  </property>
                  <property name="name" value="custom" />
              </bean>
          </beans>
          

           

          That's it!

           

          Regards,

          Kai

          2 people found this helpful
            • Re: Can someone share an example to implement rest web services in jive 7 Plugin!
              srilasyab Novice

              Hi,

              Thanks for the example. I am trying to implement this and I got an error in my spring.xml file.

               

              Multiple annotations found at this line:

                  - cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element

                   'core:service'.


              Do you have any idea about this?

                • Re: Can someone share an example to implement rest web services in jive 7 Plugin!
                  kparoth Novice

                  Hi,

                   

                  comparisons again your declaration:

                  <beans xmlns="http://www.springframework.org/schema/beans" 

                         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 

                         xmlns:util="http://www.springframework.org/schema/util" 

                         xmlns:core="http://www.jivesoftware.com/schema/core" 

                         xsi:schemaLocation=" 

                          http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd 

                          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 

                          http://www.jivesoftware.com/schema/core classpath:/com/jivesoftware/api/core/spring/core.xsd

                         default-autowire="no" default-init-method="init" default-destroy-method="destroy">


                  And look for the required file "core.xsd" (Located in your jive-core-7xx.jar -> /com/jivesoftware/api/core/spring/).

                   

                  Regards,

                  Kai

                    • Re: Can someone share an example to implement rest web services in jive 7 Plugin!
                      srilasyab Novice

                      There were some class path issues in my eclipse. I apologize for not providing more detail about this error. I don't see this error when I package the plugin using maven.

                      • Re: Re: Can someone share an example to implement rest web services in jive 7 Plugin!
                        allenh Novice

                        Kai Paroth First of all, thank you so much for posting the plugin sample.

                        I built a plugin from it, and the installion went well. After that, when I tested with http://localhost:8080/api/core/ext/custom/v2/users/, the Tomcat console showed error as following:

                         

                        I also attached the plugin.

                         

                        Could you please take a look at it and see why it errored out?

                        Thanks

                         

                        [WARNING] [talledLocalContainer] Dec 20, 2014 9:34:28 PM org.apache.catalina.core.StandardWrapperValve invoke

                        [WARNING] [talledLocalContainer] SEVERE: Servlet.service() for servlet [APICXFServlet] in context with path [] threw exception

                        [WARNING] [talledLocalContainer] java.lang.RuntimeException: org.apache.cxf.interceptor.Fault

                        [WARNING] [talledLocalContainer]        at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:116)

                        [WARNING] [talledLocalContainer]        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:331)

                        [WARNING] [talledLocalContainer]        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)

                        [WARNING] [talledLocalContainer]        at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:239)

                        [WARNING] [talledLocalContainer]        at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)

                        [WARNING] [talledLocalContainer]        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:203)

                        [WARNING] [talledLocalContainer]        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:137)

                        [WARNING] [talledLocalContainer]        at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:158)

                        [WARNING] [talledLocalContainer]        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:168)

                        [WARNING] [talledLocalContainer]        at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)

                        [WARNING] [talledLocalContainer]        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:219)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.community.web.filter.NoCacheDevModeFilter.doFilterInternal(NoCacheDevModeFilter.java:39)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.community.web.struts.JiveFilterDispatcher.doFilter(JiveFilterDispatcher.java:87)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:39)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.community.web.filter.ActivityRequestFilter.doFilter(ActivityRequestFilter.java:100)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at org.directwebremoting.servlet.DwrWebContextFilter.doFilter(DwrWebContextFilter.java:91)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.community.robots.RobotDetectorFilter.doFilterInternal(RobotDetectorFilter.java:62)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.community.aaa.UserResponseHeaderFilter.doFilter(UserResponseHeaderFilter.java:45)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:163)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.base.profiling.http.RequestProfilingFilter.doFilter(RequestProfilingFilter.java:47)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.community.web.filter.P3PCompactPolicyFilter.doFilter(P3PCompactPolicyFilter.java:48)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.community.web.filter.RemoveJsessionIdFilter.doFilter(RemoveJsessionIdFilter.java:40)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.community.web.filter.ApplicationStateFilter.doFilter(ApplicationStateFilter.java:157)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:163)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.api.core.filters.CoreApiTermsAndConditionsAcceptanceFilter.doFilter(CoreApiTermsAndConditionsAcceptanceFilter.java:32)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.api.core.runas.CoreApiRunAsFilter.doFilter(CoreApiRunAsFilter.java:73)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.api.core.v2.filters.AllowGuestAccessFilter.doFilter(AllowGuestAccessFilter.java:94)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.api.audit.RequestResponseAuditServletFilter.doFilter(RequestResponseAuditServletFilter.java:63)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.api.common.filters.ApiExceptionTranslatorFilter.doFilter(ApiExceptionTranslatorFilter.java:49)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.community.aaa.JiveRememberMeAuthenticationFilter.doFilter(JiveRememberMeAuthenticationFilter.java:79)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.api.core.filters.ClientIDContextFilter.doFilter(ClientIDContextFilter.java:34)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.community.oauth2.filter.JiveOAuth2ResourceRequestFilter.doFilter(JiveOAuth2ResourceRequestFilter.java:54)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.community.aaa.JiveBasicAuthenticationFilter.doFilter(JiveBasicAuthenticationFilter.java:37)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.community.oauth.filter.OAuth2PasscodeRequiredFilter.doFilter(OAuth2PasscodeRequiredFilter.java:60)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.community.oauth.spring.JiveOAuth2ProtectedResourceFilter.doFilter(JiveOAuth2ProtectedResourceFilter.java:43)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.oauth2.provider.OAuth2ExceptionHandlerFilter.doFilter(OAuth2ExceptionHandlerFilter.java:36)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:163)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.api.core.filters.CoreApiContextFilter.doFilter(CoreApiContextFilter.java:53)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.community.webservices.server.RequireSSLFilter.doFilter(RequireSSLFilter.java:53)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:163)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.api.core.filters.LogCorrelationIDFilter.doFilter(LogCorrelationIDFilter.java:96)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

                        [WARNING] [talledLocalContainer]        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.community.web.filter.AbstractApplicationStateFilter.doFilter(AbstractApplicationStateFilter.java:61)

                         

                         

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.community.web.filter.XFrameOptionsFilter.doFilter(XFrameOptionsFilter.java:50)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.base.plugin.PluginFilter.doFilter(PluginFilter.java:54)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.community.web.filter.ResourceRoutingFilter.doFilter(ResourceRoutingFilter.java:44)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.base.profiling.http.ServerLatencyFilter.doFilter(ServerLatencyFilter.java:62)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)

                        [WARNING] [talledLocalContainer]        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.community.web.security.XHRTokenFilter.doFilter(XHRTokenFilter.java:42)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.community.web.filter.MetricsFilter.doFilter(MetricsFilter.java:120)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.community.web.filter.SetRequestCharacterEncodingFilter.doFilter(SetRequestCharacterEncodingFilter.java:75)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.community.web.filter.DispatchContextResetFilter.doFilter(DispatchContextResetFilter.java:39)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)

                        [WARNING] [talledLocalContainer]        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)

                        [WARNING] [talledLocalContainer]        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)

                        [WARNING] [talledLocalContainer]        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)

                        [WARNING] [talledLocalContainer]        at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2430)

                        [WARNING] [talledLocalContainer]        at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2419)

                        [WARNING] [talledLocalContainer]        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

                        [WARNING] [talledLocalContainer]        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

                        [WARNING] [talledLocalContainer]        at java.lang.Thread.run(Thread.java:745)

                        [WARNING] [talledLocalContainer] Caused by: org.apache.cxf.interceptor.Fault

                        [WARNING] [talledLocalContainer]        at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)

                        [WARNING] [talledLocalContainer]        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128)

                        [WARNING] [talledLocalContainer]        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:198)

                        [WARNING] [talledLocalContainer]        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:100)

                        [WARNING] [talledLocalContainer]        at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)

                        [WARNING] [talledLocalContainer]        at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)

                        [WARNING] [talledLocalContainer]        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)

                        [WARNING] [talledLocalContainer]        ... 178 more

                        [WARNING] [talledLocalContainer] Caused by: java.lang.NullPointerException

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.api.core.v2.cxf.CxfServiceRegistry.getTypeServiceInfo(CxfServiceRegistry.java:74)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.api.core.v2.converters.uri.CoreRegistryUriConverter.getTypeServiceInfo(CoreRegistryUriConverter.java:70)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.api.core.v2.converters.uri.CoreRegistryUriConverter.apply(CoreRegistryUriConverter.java:47)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.api.core.v2.converters.uri.CoreRegistryUriConverter.apply(CoreRegistryUriConverter.java:1)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.api.core.v2.converters.links.StaticKeyLinkConverter.apply(StaticKeyLinkConverter.java:54)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.api.core.v2.converters.links.StaticKeyLinkConverter.apply(StaticKeyLinkConverter.java:1)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.api.core.v2.util.ConversionUtils.addLinks(ConversionUtils.java:64)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.api.core.v2.converters.BaseEntityConverter.addLinks(BaseEntityConverter.java:31)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.api.core.v2.converters.users.UserSummaryConverter.createEntity(UserSummaryConverter.java:90)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.api.core.v2.converters.users.UserEntityConverter.createEntity(UserEntityConverter.java:50)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.api.core.v2.converters.MyUserEntityConverter.createEntity(MyUserEntityConverter.java:65)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.api.core.v2.converters.MyUserEntityConverter.apply(MyUserEntityConverter.java:60)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.api.core.v2.converters.users.UserEntityConverter.apply(UserEntityConverter.java:1)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.api.core.v2.converters.users.UserSummaryConverter.apply(UserSummaryConverter.java:1)

                        [WARNING] [talledLocalContainer]        at com.jivesoftware.api.core.v2.providers.users.UserProvider.getMyUser(UserProvider.java:170)

                        [WARNING] [talledLocalContainer]        at de.unoso.plugin.services.CustomUserService.getCurrentUser(CustomUserService.java:54)

                        [WARNING] [talledLocalContainer]        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                        [WARNING] [talledLocalContainer]        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                        [WARNING] [talledLocalContainer]        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                        [WARNING] [talledLocalContainer]        at java.lang.reflect.Method.invoke(Method.java:606)

                        [WARNING] [talledLocalContainer]        at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)

                        [WARNING] [talledLocalContainer]        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)

                        [WARNING] [talledLocalContainer]        ... 183 more

                        [WARNING] [talledLocalContainer]

                    • Re: Can someone share an example to implement rest web services in jive 7 Plugin!
                      cgum Intermediate

                      Thanks a lot for posting this, Kai Paroth.  This information really helped me out while upgrading a number of Jive 6 plugins to Jive 7.

                       

                      I owe you a beer.

                      • Re: Can someone share an example to implement rest web services in jive 7 Plugin!
                        tomsinicki Beginner

                        Works also fine for Jive8 and v3 services. Owe you a beer too

                        • Re: Can someone share an example to implement rest web services in jive 7 Plugin!
                          Likrant Advanced

                          Thanks, Kai, it was helpful.

                           

                          I have overwrote class CoreApiExtensionManagerImpl, changed url path to "core/v3/myservice" and call that manager directly so now it looks like v3

                          • Re: Can someone share an example to implement rest web services in jive 7 Plugin!
                            nayanasyamala Novice

                            Hi,

                            This is a useful post for adding custom web services.

                            I have a plugin which I am developing to create two custom services.

                            In service registration , I am passing a list of  two beans , which represents my two custom services.

                            However, only one of them gets registered. The other one, while invoking is giving 404.

                            Can't we use plugin to register more than one services?

                             

                            Thanks,

                            Nayana

                              • Re: Can someone share an example to implement rest web services in jive 7 Plugin!
                                kparoth Novice

                                Hi Nayana Chemmukathu Syamala,

                                 

                                yes, you can register more than one service.

                                 

                                Here my example for V3 services:

                                 

                                <?xml version="1.0" encoding="UTF-8"?>

                                <beans xmlns="http://www.springframework.org/schema/beans"

                                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                                       xmlns:util="http://www.springframework.org/schema/util"

                                       xmlns:core="http://www.jivesoftware.com/schema/core"

                                       xsi:schemaLocation="

                                        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd

                                        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

                                        http://www.jivesoftware.com/schema/core classpath:/com/jivesoftware/api/core/spring/core.xsd"

                                       default-autowire="no" default-init-method="init" default-destroy-method="destroy">

                                   

                                    <bean class="de.unoso.plugin.RestPlugin">

                                        <property name="serviceRegistrar" ref="serviceRegistrar" />

                                    </bean>

                                   

                                    <!-- Service Initialization -->

                                    <core:service id="customUserServiceImpl" v="3" class="de.unoso.plugin.services.CustomUserService" parent="abstractServiceV3">

                                        <property name="userManager" ref="userManagerImpl"/>

                                        <property name="registrationManager" ref="registrationManagerImpl"/>

                                    </core:service>   

                                    <core:service id="customProfileServiceImpl" v="3" class="de.unoso.plugin.services.CustomProfileService" parent="abstractServiceV3">

                                        <property name="userManager" ref="userManagerImpl"/>

                                        <property name="profileManager" ref="profileManagerImpl"/>

                                    </core:service>

                                   

                                    <!-- Service Registration -->

                                    <!-- <jive.context>/api/core/ext/custom/v3/<service.url> -->

                                    <bean id="serviceRegistrarV3" class="de.unoso.plugin.services.ServiceRegistrar">

                                        <property name="coreApiExtensionManager" ref="coreApiExtensionManager" />

                                        <property name="version" value="v3" />

                                        <property name="serviceBeans">

                                            <list>

                                                <ref bean="customUserServiceImpl" />

                                                <ref bean="customProfileServiceImpl" />

                                            </list>

                                        </property>

                                        <property name="name" value="custom" />

                                    </bean>

                                </beans>

                                 

                                Regards

                                Kai

                                  • Re: Can someone share an example to implement rest web services in jive 7 Plugin!
                                    nayanasyamala Novice

                                    Hi Kai Paroth,

                                    Thank you for your reply showing an example . Appreciate that.

                                    This was how I tried first, but I found that only the first service gets invoked (Here customreviewsverviceimpl) . I couldn't find out why, though I could see two beans getting passed in CoreApiExtensionManager.registerServiceExtension().

                                    I have two services , one for review and another for rating. While invoking second one(rating), I always get  below line sbs.log

                                    "org.apache.cxf.jaxrs.utils.JAXRSUtils - No operation matching request path "/api/core/ext/custom/v3/ratings/1005/4" is found" .

                                    It is as if the service at that endpoint doesn't exist. But if I interchange the order or comment out reviewService, then rating service gets invoked.

                                     

                                    First version, some section in package name masked

                                    <?xml version="1.0" encoding="UTF-8"?>

                                    <beans xmlns="http://www.springframework.org/schema/beans"

                                           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                                           xmlns:util="http://www.springframework.org/schema/util"

                                           xmlns:core="http://www.jivesoftware.com/schema/core"

                                           xsi:schemaLocation="

                                            http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd

                                            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

                                            http://www.jivesoftware.com/schema/core http://www.jivesoftware.com/schema/core.xsd"

                                            default-autowire="no" default-init-method="init" default-destroy-method="destroy">

                                     

                                        <bean class="com.*.communities.TestCommunitiesPlugin">

                                               <property name="serviceRegistration" ref="serviceRegistration" />

                                        </bean>

                                      

                                        <core:service id="customReviewServiceImpl" v="3" class="com.*.communities.plugin.service.CustomReviewService" parent="abstractServiceV3"> 

                                            <property name="commentProvider" ref="commentProviderV3"/> 

                                        </core:service>

                                      

                                        <core:service id="customRatingServiceImpl" v="3" class="com.*.communities.plugin.service.CustomRatingService" parent="abstractServiceV3">

                                          <property name="ratingServiceImpl" ref="ratingServiceImpl"/>

                                        </core:service>

                                     

                                    <bean id="serviceRegistration" class="com.*.communities.plugin.service.ServiceRegistration"> 

                                            <property name="coreApiExtensionManager" ref="coreApiExtensionManager" /> 

                                            <property name="version" value="v3" />

                                            <property name="serviceBeans"> 

                                                <list>

                                                  <ref bean="customReviewServiceImpl" />

                                                   <ref bean="customRatingServiceImpl" /> 

                                                </list>

                                            </property>

                                            <property name="name" value="custom" />

                                        </bean>

                                    </beans>

                                     

                                     

                                    Second version, I ended up creating two service registrations with different uri, This one worked. Though it didn't make sense to me passing only one bean in a list of beans to service registration.

                                    <?xml version="1.0" encoding="UTF-8"?>

                                    <beans xmlns="http://www.springframework.org/schema/beans"

                                           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                                           xmlns:util="http://www.springframework.org/schema/util"

                                           xmlns:core="http://www.jivesoftware.com/schema/core"

                                           xsi:schemaLocation="

                                            http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd

                                            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

                                            http://www.jivesoftware.com/schema/core http://www.jivesoftware.com/schema/core.xsd"

                                            default-autowire="no" default-init-method="init" default-destroy-method="destroy">

                                     

                                        <bean class="com.*.communities.TestCommunitiesPlugin">

                                           <property name="ratingServiceRegistration" ref="ratingServiceRegistration" />

                                            <property name="reviewServiceRegistration" ref="reviewServiceRegistration" />

                                        </bean>

                                      

                                        <core:service id="customReviewServiceImpl" v="3" class="com.*.communities.plugin.service.CustomReviewService" parent="abstractServiceV3"> 

                                            <property name="commentProvider" ref="commentProviderV3"/> 

                                        </core:service>

                                      

                                        <core:service id="customRatingServiceImpl" v="3" class="com.*.communities.plugin.service.CustomRatingService" parent="abstractServiceV3">

                                          <property name="ratingServiceImpl" ref="ratingServiceImpl"/>

                                        </core:service>

                                      

                                        <bean id="ratingServiceRegistration" class="com.*.communities.plugin.service.ServiceRegistration"> 

                                            <property name="coreApiExtensionManager" ref="coreApiExtensionManager" /> 

                                            <property name="version" value="v3" />

                                            <property name="serviceBeans"> 

                                                <list>

                                                  <ref bean="customRatingServiceImpl" /> 

                                                </list>

                                            </property>

                                           <property name="name" value="ratings" /> 

                                        </bean>

                                      

                                           <bean id="reviewServiceRegistration" class="com.*.communities.plugin.service.ServiceRegistration"> 

                                            <property name="coreApiExtensionManager" ref="coreApiExtensionManager" /> 

                                            <property name="version" value="v3" />

                                            <property name="serviceBeans"> 

                                                <list>

                                                  <ref bean="customReviewServiceImpl" /> 

                                                </list>

                                            </property>

                                            <property name="name" value="reviews" /> 

                                        </bean>

                                      

                                     

                                    </beans>

                                     

                                    Thanks,

                                    Nayana

                                      • Re: Can someone share an example to implement rest web services in jive 7 Plugin!
                                        Scott A Johnson Advanced

                                        Hey Nayana,

                                         

                                        The reason your first example doesn't work is that the custom service endpoint "name" is being reused in that custom service registration class. Effectively creating two services for the same url. One has to win.

                                         

                                        My understanding was that you shouldnt need to create a custom service registration class.

                                         

                                        Here's an example:

                                         

                                        spring.xml

                                            <core:service id="customUserService" v="3" parent="abstractServiceV3" class="com.custom.v3.services.CustomUserServiceV3">
                                                <property name="customUserProvider" ref="customUserProvider" />
                                            </core:service>
                                        

                                         

                                         

                                        CustomUserServiceV3.java

                                         

                                        package com.custom.v3.services;
                                        
                                        
                                        ...
                                        
                                        
                                        
                                        
                                        @Path("/users")
                                        @CoreApiExtensionService(name = "my-custom", version = "3")
                                        public class CustomUserServiceV3 extends AbstractService {
                                        
                                          private CustomUserProvider customUserProvider;
                                        
                                        
                                          @GET
                                          @Path("/recentModifiedUsers/{cutoffTimestamp}")
                                          @RequiresAuthentication
                                          @Trace
                                          @Produces(MediaType.APPLICATION_XML)
                                          public CustomUserEntitiesList getRecentModifedUsers(@PathParam("cutoffTimestamp") long cutoffTimestamp)
                                          throws BadRequestException, ForbiddenException, NotFoundException {
                                        
                                          ...
                                          }
                                        
                                        
                                          public void setCustomUserProvider(CustomUserProvider customUserProvider) {
                                          this.customUserProvider = customUserProvider;
                                          }
                                        }
                                        

                                         

                                        This creates a service at a url such as below which produces an XML output.

                                         

                                        .../api/core/ext/my-custom/v3/users/recentModifiedUsers/1458496901000

                                         

                                        The name and thus the url of the extension service is defined by the annotation CoreApiExtensionService, the endpoint "/users/recentModifiedUsers/{parameter}" is defined by the Path annotations on the class and method.

                                         

                                        Hope this helps.

                                         

                                        Scott

                                        2 people found this helpful
                                • Re: Can someone share an example to implement rest web services in jive 7 Plugin!
                                  atishc Intermediate

                                  Hi Shipra,

                                       If you want your SOAP based Web Service to work below is the code in spring.xml file. Note that you will not be able to use Jive shipped SOAP based service that you were using before as those class doesn't exisit in Jive 7 binary.You have to define your won set of functionality.

                                   

                                  <beans ...... xmlns:jaxws="http://cxf.apache.org/jaxws" .... xsi:schemaLocation=".... http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd..." >

                                  ...

                                  <jaxws:endpoint id="createByEmialListSoapService" address="/soap/CreateByEmialListService" bus="rpcCxfBus">

                                          <jaxws:implementor>

                                              <ref bean="createByEmialListServiceImpl" />

                                          </jaxws:implementor>

                                          <jaxws:outFaultInterceptors>

                                              <ref bean="serverExceptionInterceptor" />

                                          </jaxws:outFaultInterceptors>

                                          <jaxws:inInterceptors>

                                              <ref bean="saajInInterceptor" />

                                              <ref bean="wss4jInInterceptor" />

                                              <ref bean="validationCheckInterceptor" />

                                          </jaxws:inInterceptors>

                                      </jaxws:endpoint>

                                   

                                  <bean id="createByEmialListServiceImpl" class="com.vmware.community.mail.impl.CreateByEmialListServiceImpl">

                                          <property name="createByEmailManager" ref="createByEmailManager"/>       

                                  </bean>

                                   

                                  I have tested it using Jive 7.0.2 version.

                                   

                                  ~Atish

                                  • Re: Can someone share an example to implement rest web services in jive 7 Plugin!
                                    prabhakar.pateti Novice

                                    Shipra Singh

                                    Hello Shipra,

                                    I am Prabhakar. I am looking for solution that "How to invoke web service call from Jive for a particular activity " ( Ex., when new document posted, when new reply came in etc ) from a 3rd party Server.

                                    Basically we are working on Automatic Push Notification task., and whenever there is new post in my Jive, I should be able to get push from Jive to my Mobile App to notify the news / feeds in my personnel community  Can you please help me if possible ?

                                    Prabhakar