14 Replies Latest reply on Oct 20, 2010 10:47 AM by Ted Jones

    WS access to VDB...

    Guzman Llambi­as Novice

      Hi!! I've been looking through the teiid docs and read that the VDB can be accessed through JDBC, but I couldn't find if there is other ways, let's say for example, Web Services (SOAP or REST). Could you please tell me if it's possible an access like this or where I could find info about it (docs, examples)?

       

      Thank your very much!

      Regards

      Guzmán

        • 1. Re: WS access to VDB...
          Ramesh Reddy Master

          SOAP based VDB access feature is coming in version 7.1, which slated to release middle to late August, 2010.

           

          Being said that, even with current version (6.2 or 7.0) you could enable the SOAP or REST with some amount of work. Teiid Desinger lets the user create VDB with WebService model, however there is no runtime environment for deploy. But you can write your own web service access on top to make it work. Check the forums, there were few users who took this route. For REST support take look at this document.

           

          Thank you.

           

          Ramesh..

          • 2. Re: WS access to VDB...
            Guzman Llambi­as Novice

            Ramesh,

             

            Thank you very much for the info and the quick answer! It was very usefull!

             

            Regards

            Guzmán

            • 3. Re: WS access to VDB...
              jinpeng.dong Newbie

              Ramesh,

               

              For Teiid 7.1, is there any improvement in accessing VDB via WS API?

              I could not find it in the documentation.

               

              Or I should treat VDB as a normal DB, and write either WS or RESTful service on top of it?

               

              Thanks a lot.

              • 4. Re: WS access to VDB...
                Ramesh Reddy Master

                Jinpeng,

                 

                You always need to treat your VDB as DB. However Teiid Designer has a new feature where you can create WAR file based the VDB, that can expose parts of the VDB through SOAP.

                 

                Here are some basic steps:

                 

                1) Create model by importing the schema from a database.

                2) Right click on this model "modeling -> Create web service", this will create a default web service model.

                3) Or if you have WSDL, then import it and create "web-service" model and write transformations for it.

                4) Build a  VDB with these models.

                5) Right click on the VDB, "modeling -> Generate JBossWS-CXF War", this will create a WAR file.

                6) Now deploy the WAR and VDB to the same JBoss AS instance, then access the the VDB's WS model through SOAP.

                 

                Let is know if you run into issues in separate discussion thread.

                 

                Thanks

                 

                Ramesh..

                • 5. Re: WS access to VDB...
                  jalen zhong Newbie

                  Hi Ramesh,

                   

                  I got this exception when doing the step 5 "Generate JBossWS-CXF War"

                   

                  java.lang.NullPointerException
                  at org.teiid.designer.dqp.webservice.war.DefaultWebArchiveBuilderImpl.createProviderJavaClasses(DefaultWebArchiveBuilderImpl.java:490)
                  at org.teiid.designer.dqp.webservice.war.DefaultWebArchiveBuilderImpl.createWebArchive(DefaultWebArchiveBuilderImpl.java:230)
                  at org.teiid.designer.dqp.webservice.war.ui.wizards.WarDeploymentInfoDialog.execute(WarDeploymentInfoDialog.java:184)
                  at org.teiid.designer.dqp.webservice.war.ui.wizards.WarDeploymentInfoDialog$1.run(WarDeploymentInfoDialog.java:150)
                  at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
                  at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
                  at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507)
                  at org.teiid.designer.dqp.webservice.war.ui.wizards.WarDeploymentInfoDialog.okPressed(WarDeploymentInfoDialog.java:159)
                  at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:472)
                  at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
                  at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
                  at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
                  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
                  at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
                  at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
                  at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
                  at org.eclipse.jface.window.Window.open(Window.java:801)
                  at org.teiid.designer.runtime.ui.GenerateWarAction.run(GenerateWarAction.java:93)
                  at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
                  at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
                  at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
                  at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
                  at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
                  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
                  at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
                  at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
                  at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
                  at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
                  at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
                  at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
                  at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
                  at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
                  at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
                  at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
                  at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
                  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
                  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
                  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
                  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                  at java.lang.reflect.Method.invoke(Unknown Source)
                  at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
                  at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
                  at org.eclipse.equinox.launcher.Main.run(Main.java:1407)

                  • 6. Re: WS access to VDB...
                    Ted Jones Master

                    Jalen,

                     

                    Make sure you are using a JDK vs a JRE to run your Designer instance. Based on where it's failing it makes me think it can't find the compiler.

                     

                    Thanks,

                    Ted

                    • 7. Re: WS access to VDB...
                      jalen zhong Newbie

                      Hi Ted,

                       

                      After switching to JDK, the war has been generated successfully. But when deploying it to JBoss, there are some errors.

                       

                      Following is the error message and my VDB file and WAR.

                       

                      18:31:07,093 ERROR [AbstractKernelController] Error installing to Real: name=vfszip:/D:/Green/jboss-5.1.0.GA/server/default/deploy/jalenPocDrWsVdb.war
                      / state=PreReal mode=Manual requiredState=Real
                      org.jboss.deployers.spi.DeploymentException: Error during deploy: vfszip:/D:/Green/jboss-5.1.0.GA/server/default/deploy/jalenPocDrWsVdb.war/
                              at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
                              at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:177)
                              at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
                              at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
                              at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
                              at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                              at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
                              at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
                              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
                              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
                              at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
                              at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
                              at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
                              at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
                              at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
                              at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
                              at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
                              at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:361)
                              at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                              at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
                              at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
                              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
                              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
                              at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
                              at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
                              at org.jboss.system.server.profileservice.repository.AbstractProfileService.activateProfile(AbstractProfileService.java:306)
                              at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:271)
                              at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
                              at org.jboss.Main.boot(Main.java:221)
                              at org.jboss.Main$1.run(Main.java:556)
                              at java.lang.Thread.run(Thread.java:619)
                      Caused by: org.jboss.ws.WSException: Cannot build meta data: Could not find jalenPocDrWsVdb.wsdl in the additional metadatafiles!
                              at org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderJSE.buildMetaData(JAXWSMetaDataBuilderJSE.java:73)
                              at org.jboss.wsf.stack.jbws.UnifiedMetaDataDeploymentAspect.start(UnifiedMetaDataDeploymentAspect.java:64)
                              at org.jboss.wsf.framework.deployment.DeploymentAspectManagerImpl.deploy(DeploymentAspectManagerImpl.java:129)
                              at org.jboss.wsf.container.jboss50.deployer.ArchiveDeployerHook.deploy(ArchiveDeployerHook.java:76)
                              at org.jboss.wsf.container.jboss50.deployer.AbstractWebServiceDeployer.internalDeploy(AbstractWebServiceDeployer.java:60)
                              at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
                              at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
                              ... 29 more
                      Caused by: java.io.IOException: Could not find jalenPocDrWsVdb.wsdl in the additional metadatafiles!
                              at org.jboss.wsf.framework.deployment.ArchiveDeploymentImpl.getMetaDataFileURL(ArchiveDeploymentImpl.java:143)
                              at org.jboss.ws.metadata.builder.jaxws.JAXWSProviderMetaDataBuilder.buildProviderMetaData(JAXWSProviderMetaDataBuilder.java:125)
                              at org.jboss.ws.metadata.builder.jaxws.JAXWSServerMetaDataBuilder.setupProviderOrWebService(JAXWSServerMetaDataBuilder.java:55)
                              at org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderJSE.buildMetaData(JAXWSMetaDataBuilderJSE.java:61)
                              ... 35 more

                      • 8. Re: WS access to VDB...
                        jalen zhong Newbie

                        This war is generated by Teiid Designer automatically. Any help will be greatly appreciated.

                        • 9. Re: WS access to VDB...
                          Ted Jones Master

                          Do you have JBossWS-CXF (3.1.2.SP6 - although should be compatible with newer versions as well) installed on your JBoss instance? That is a requirement to use the generated war.

                          • 10. Re: WS access to VDB...
                            Fei Gao Newbie
                            1. After installing JBOSSWS-CXF, the problem about "can not find wsdl" has been solved. However, the web service still can not be deployed because schema location is wrong for namespace "http://www.metamatrix.com/metamodels/SimpleDatatypes-instance" refered in output.xsd.
                            2. I investigated teiid designer source code and found the missing schema should be "builtInDataTypes.xsd", so I changed the shema location in output.xsd and add builtInDataTypes.xsd into the war and vdb package. After this the web service is deployed successfully.
                            3. However, when I try to invoke the web service in my client, the following problem comes out "javax.xml.ws.WebServiceException: Unsupported endpoint address: /jalenPocDrWsVdb/jalenMapping_subject".
                            4. Then I use SOAPUI and set the endpoint explicitly as "http://localhost:8080/jalenPocDrWsVdb/jalenMapping_subject". SOAPUI is able to call the web service. but it returns the following error

                                   <soap:Fault>
                                     <faultcode>soap:Server</faultcode>
                                     <faultstring>wrong number of arguments while invoking public javax.xml.transform.Source org.teiid.soap.provider.jalenMapping_subject.invoke(javax.xml.transform.Source) with params null.</faultstring>
                                  </soap:Fault>

                             

                                  I investigated the WSDL and find that the generated input has no "part", is this the cause of this problem?

                             

                             

                            It really took us a long time to create web service for VDB using teiid designer and the problem is still not solved. Can you provide an sample vdb/ws and the according ws client?

                            • 11. Re: WS access to VDB...
                              Ted Jones Master

                              Fei,

                               

                              The issue with the missing builtInDataTypes.xsd has been corrected in the latest Designer (7.1.1 which is currently in Beta). The reason you are seeing the soap fault is due to no input parameters to the service. I have seen this in older versions of CXF. If you add a primary index to the table you are generating the web service from an input parameter will be added. Otherwise, you can upgrade your JBossWS-CXF to a more recent version (3.2.*) which will allow you to execute a web service with no args.

                               

                              Thanks,

                              Ted

                              • 12. Re: WS access to VDB...
                                jalen zhong Newbie

                                We have updated the generated WAR and it worked.

                                 

                                But the only operation generated is for "get" (select), there is no operations for insert/update/delete even our view model support i/u/d.

                                 

                                Is there any way to update the virtual DB through WS?

                                • 13. Re: WS access to VDB...
                                  Ted Jones Master

                                  Glad you were able to make progress. The generated get operation is really intended to be a starting point. From there you can add model more operations including operations that perform inserts/updates/deletes. You can insert directly from the web service model operations procedure, or you can expose other Teiid models that perform CRUD operations using the web service. Here are the steps to accomplish the latter:

                                   

                                  1. Create a relational view model in Teiid Designer.

                                  2. Add a new base table and add the appropriate transformation sql to source your new table. This will be determined by what data you are exposing and wish to i/u/d.

                                  3. Select the "Support Updates" checkbox to enable the update/insert/delete tabs. Add your insert/update/delete transformations.

                                  4. Now to expose our new model. Create a new web service model or use the generated one you've been working with.

                                  5. Add a new interface to your model and a new operation.

                                  6. You will need to model (or import) schemas that will map to your inputs to each web service operation in you add. Once you have your input schema for the new operation in your workspace, you can add it to the "Content via Element" property of the input message.

                                  7. You can now add your transformation sql to the web service procedure using the input elements from the schema you defined. The sql can insert, update or delete using the virtual table.

                                   

                                  This is one way to model a web service model for CRUD support usign a virtual model with federated sources, but there are other approaches that are just as valid. You can try starting out by going directly against a single physical source just to get your feet wet, but what fun is there in that? ;-) .

                                   

                                  Let me know if you run into any issues.

                                   

                                  Thanks,

                                  Ted

                                  • 14. Re: WS access to VDB...
                                    Ted Jones Master

                                    jalen,

                                     

                                    I have created an example of adding CRUD operations to your web service models... you can find it here: http://community.jboss.org/wiki/CreatingandDeployinganUpdateableTeiidWebServiceWar

                                     

                                    Let me know if you have any questions.

                                     

                                    Thanks,

                                    Ted