2 Replies Latest reply on Jul 16, 2010 6:35 AM by beginnerram

    SQL Query for Webservice

    beginnerram

      Hi,

       

      I am new to Teiid and checking the features of it. I need to know how can we query a webservice resouce. I am using teiid 7.0. IN the 7.0dist example they had specified rwo ways of quering a webservice

       

           1. select t.* from  (call weather.invoke(action='GET', endpoint=querystring('', '38.99,-77.02 39.70,-104.80 47.6,-122.30' as listLatLon,
                  'time-series' as product, '2004-01-01T00:00:00' as "begin", '2013-04-20T00:00:00' as "end", 'maxt' as maxt, 'mint' as  mint) )) w,
          XMLTABLE('/dwml/data/location' passing w.result columns "location-key" string, lattitude string path 'point/@latitude', longitude string path 'point/@longitude') t

       

      and 2nd method was

           2. select xmlserialize(document w.result as string) from (call weather.invoke(action='http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl#LatLonListZipCode',
              endpoint='http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php',
              binding='SOAP11',    request='..............')) as w

       

      I would like to know is there any other way to query a webservice as already the endpoint information are stored in configuration file and  also the end resource is know as a webservice so is it mandatory to use "invoke method " and again fetch it from XML table.

       

      I just want to know why it cant be queried like a database call as we already know that the end resource we are quering is a Webservice. Is that not been handled by the Translators. Same for even  a text file.

        • 1. Re: SQL Query for Webservice
          shawkins

          Hi Ramya,

           

          invoke is necessary, but the parameters are flexible based upon you're needs.  In the first example we're invoking rest so more endpoint information is needed to specify the query parameters.  In the second example we're calling a different endpoint altogether than the one in the configuration.  Typically if you just calling a soap service, you won't need to specify the endpoint as part of the procedure call.

           

          With these dynamic vdb examples, you don't currently have the ability to further specify views and procedures to encapsulate the invoke procedures.  That feature will be availble in Teiid 8.  With non-dynamic vdbs, you can use Teiid Designer to add as many view and procedures as necessary to get your data in the form that you want.

           

          As for having things look like a database automatically, I assume you mean querying tables instead of a procedure that returns XML.  In Teiid Designer 7.1 they should get to retargeting XML-Relational import logic to generate the relational views and underlying invoke procedure calls for you given a WSDL.  In general, except for rpc style calls with simple parameter types, generating the relational form of XML schemas - both input and output documents, is not simple and is best suited for a wizard.  For 7.0 though that will have to be a manual exercise.

           

          Importer logic for text files also doesn't exist in Designer 7.0, and I'm not sure if it will be part of 7.1.

           

          Steve

          • 2. Re: SQL Query for Webservice
            beginnerram

            Thanks Steven .. I am now trying to create VDB for webservice from Teiid designer 6.2 (in Galelio). I am using import Webservice as relational DB and then generate the DB for it. It perfectly works for Dpcument Literal webservice but for RPC encoded webservice i face some issues.

             

            The soap request generated using teiid is

            <?xml version="1.0" ?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
            <S:Body>
            <tns:testOp xmlns:tns="http://test.tcs.com" xmlns:mmn0="http://test.tcs.com">
            <CheckinInput xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">dd</CheckinInput>
            </tns:testOp></S:Body></S:Envelope>

             

             

            But the expected request by the server is

            <?xml version="1.0" encoding="UTF-8" ?>
            <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <SOAP-ENV:Body>
            <ns0:testOp SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns0="http://test.tcs.com">
              <CheckinInput xsi:type="xsd:string">ljkl</CheckinInput>
              </ns0:testOp>
              </SOAP-ENV:Body>
              </SOAP-ENV:Envelope>

             


            The error i get is xmlns:xsd is not defined.. U could note the namespace for xsd is not generated in the soap request. Please let me know what sholud be done