3 Replies Latest reply: Aug 4, 2012 11:59 AM by m-basil@northwestern.edu RSS

    Interacting with the Database in a Web Service

    Gary Williams

      Has anyone created a web service via a Jive plugin where they've connected to the database?  I done this using the DAO model when creating a widget but when I do the same thing in a web service get java.lang.NullPointerException errors as I try to connect to via the standard Manager to DAO process.  I have a widget in the same plugin that's able to connect without an issue so I can't figure out why the web service wouldn't work when it's calling the exact same code.

       

      Any ideas?

       

      Thanks.

       

      -Garyd

        • Re: Interacting with the Database in a Web Service
          jrlarson

          Sounds like it may be related to the request context - the service may not have an appropriate context when compared with the widget.

            • Re: Interacting with the Database in a Web Service
              Gary Williams

              That's what I was starting to think as well John.  If I manually create the Manager (like MyManagerName something= new MyManagerNameImpl()) and then in the Manager do the same with the DAO I can move the same error to the Jive sourse so now I get:

               

              java.lang.NullPointerException

                      at com.jivesoftware.base.database.dao.JiveJdbcOperationsTemplate.getJdbcOperations(JiveJdbcOperationsTemplate.java:82)

               

              ...but I haven't been able get past that.  There's probably something I can do in the web service itself to give the right context there but I can't figure out what that might be.

            • Re: Interacting with the Database in a Web Service
              m-basil@northwestern.edu

              Gary,

               

              I need to do the same thing.  I've been able to get widgets to work properly, but am struggling with how to configure the plugin for a web service. 

               

              Specifically, how does a custom web service (REST) become available via URL?  I don't see how to map it like the widgets and actions.

               

              I'd be happy to dig in further if I can get past this issue.

               

              Thanks