6 Replies Latest reply on Sep 24, 2014 2:58 PM by Ramesh Reddy

    System properties within Web Service translator

    Bernie Raap Newbie

      I'm using the Teiid 8.7 Web Service translator and I am attempting to connect to a Web Service deployed within my local JBOSS.
      However, I wanted to make my end point dynamic so that regardless of how JBOSS AS was installed, I could always use the JBOSS bind address
      and http port to access it. I attempted:

      SELECT A.address AS Address, A.instance AS InstanceName, A.name AS EngineName,  
             A.protocol AS Protocol, A.type AS EngineType  
      FROM 
            (EXEC restCAM.invokeHttp('GET', null, 'http://${jboss.bind.address}:${jboss.web.http.port}/cam/engines', 'TRUE')) AS f,   
                  XMLTABLE('/engines/engine' PASSING XMLPARSE(DOCUMENT f.result)     
                  COLUMNS      
                  address string PATH 'address/text()', 
                  instance string PATH 'instance/text()', 
                  name string PATH 'name/text()', 
                  protocol string PATH 'protocol/text()', 
                  type string PATH 'type/text()') AS A

      Thinking that this would pull in 127.0.0.1 (e.g. local host) and the port that JBOSS was installed to use. When I run this, I get a
      "TEIID30504 Remote org.teiid.core.TeiidProcessingException: TEIID30504 restCAM: The use of a relative endpoint in a procedure call
      requires a a default endpoint on the datasource." error.

      Can you provide some guidance on using the system properties to generate the end point?

      Thanks... in advance,

      Bernie Raap

        • 1. Re: System properties within Web Service translator
          Ramesh Reddy Master

          Bernie,

           

          you can not use system JBoss System properties in the transformation SQL as you showed above. The URL above can take absolute or relative URL, but does not resolve system properties. If you want to use system properties, in -ds.xml or resource-adapter fragment you defined for the web-service in standalone-teiid.xml file, you can define base URL with system properties. Then in above transformation use the relative path to the defined base URL.

           

          Ramesh..

          • 2. Re: System properties within Web Service translator
            Steven Hawkins Master

            There is the env function, which reads system properties, that can be enabled - see System Functions - Teiid 8.9 (draft) - Project Documentation Editor You can also use a UDF if you more control over how variables are resolved.

            • 3. Re: System properties within Web Service translator
              Bernie Raap Newbie

              Ramesh,

               

              I interpreted your reply to mean that I could add into my web service ds.xml file something like:

              config-property name="EndPoint" and give it a value of http://localhost:"the jboss variable"

               

              However, regardless of what is in the name parameter (I've tried EndPointName, Wsdl and NamespaceUri), what gets added into the conf.xml file always substitutes name=ParentDirectory and then I get errors within the log saying:

               

              ERROR [org.jboss.msc.service.fail] (MSC service thread 1-13)  MSC00001: Failed to start service jboss.ra.deployment.CAM-REST-DS_1: org.jboss.msc.service.StartException in service jboss.ra.deployment.CAM-REST-DS_1: org.jboss.msc.service.StartException in anonymous service: JBAS010446: Failed to start RA deployment [CAM-REST-DS]
              at org.jboss.as.connector.services.resourceadapters.deployment.ResourceAdapterXmlDeploymentService.start(ResourceAdapterXmlDeploymentService.java:131)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA.jar:1.0.4.GA]
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA.jar:1.0.4.GA]
              at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_17]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_17]
              at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_17]
              Caused by: org.jboss.msc.service.StartException in anonymous service: JBAS010446: Failed to start RA deployment [CAM-REST-DS]
              at org.jboss.as.connector.services.resourceadapters.deployment.ResourceAdapterXmlDeploymentService.start(ResourceAdapterXmlDeploymentService.java:115)
              ... 5 more
              Caused by: org.jboss.jca.deployers.common.DeployException: IJ020060: Unable to inject: org.teiid.resource.adapter.ws.WSManagedConnectionFactory property: ParentDirectory value: http://localhost:31004/
              at org.jboss.jca.deployers.common.AbstractResourceAdapterDeployer.createObjectsAndInjectValue(AbstractResourceAdapterDeployer.java:1913)
              at org.jboss.as.connector.services.resourceadapters.deployment.ResourceAdapterXmlDeploymentService$AS7RaXmlDeployer.doDeploy(ResourceAdapterXmlDeploymentService.java:183)
              at org.jboss.as.connector.services.resourceadapters.deployment.ResourceAdapterXmlDeploymentService.start(ResourceAdapterXmlDeploymentService.java:108)
              ... 5 more

              INFO  [org.jboss.as.controller] (management-handler-thread - 6)  JBAS014774: Service status report
              JBAS014777:   Services which failed to start:      service jboss.ra.deployment.CAM-REST-DS_1: org.jboss.msc.service.StartException in service jboss.ra.deployment.CAM-REST-DS_1: org.jboss.msc.service.StartException in anonymous service: JBAS010446: Failed to start RA deployment [CAM-REST-DS]

               

              Where did I go wrong?

               

              Bernie

              • 4. Re: System properties within Web Service translator
                Ramesh Reddy Master

                Bernie,

                 

                Can you attach your standalone-teiid.xml file? If the configuration in this file under resource adapters should like like

                 

                <resource-adapter id="webservice">

                    <module slot="main" id="org.jboss.teiid.resource-adapter.webservice"/>

                    <transaction-support>NoTransaction</transaction-support>

                    <connection-definitions>

                        <connection-definition class-name="org.teiid.resource.adapter.ws.WSManagedConnectionFactory"

                                jndi-name="java:/wsDS"

                                enabled="true"

                                use-java-context="true"

                                pool-name="teiid-ws-ds">

                               

                              <config-property name="EndPoint">http://${jboss.bind.address}:${jboss.web.http.port}</config-property>

                        </connection-definition>

                    </connection-definitions>

                </resource-adapter>

                 

                I am thinking that should resolve corrrectly, granted both above properties are either available or supplied with -D option on startup.

                 

                Ramesh..

                • 5. Re: Re: System properties within Web Service translator
                  Bernie Raap Newbie

                  Ramesh,

                   

                  I've attached the ds.xml file that I'm using as well as the standalone xml file being used as well as the server log file.

                   

                  I can say that the generated adapter doesn't look like what your email depicts.

                   

                  Let me know if you need anything else.

                   

                  Bernie

                  • 6. Re: Re: System properties within Web Service translator
                    Ramesh Reddy Master

                    That is because you cut-and-pasted the file resource adapter configuration for "web-service". Take look in "<jboss-as>/docs/teiid/datasources/web-service" for template for web-service resource-adapter configuration. That one should close to what I have given.