7 Replies Latest reply on Jan 11, 2012 3:36 PM by Steven Hawkins

    REST source with HTTPS

    Mónica L.A. Newbie

      My problem is the next:

      I've created a source model configured with WS translator and a Web services datasource (non SOAP) defined with the connection URL "https://www.googleapis.com/freebase/v1/search", then I deploy the VDB and try to test it with the next query:

      select x.* from (call "FreebaseLocation".invoke(binding=>'HTTP', action=>'GET', endpoint=>'?query=Palencia&domain=Location&indent=true')) as x;

      but I obtain the next error:

      Remote org.teiid.core.TeiidProcessingException: FreebaseLocation: null

      With other call to http://www.google.es/ig/api in the same way, no errors is obtained. Could it be the protocol https ¿?

        • 1. Re: REST source with HTTPS
          Ramesh Reddy Master

          Check the server log for any details for exceptions. I do not think it is with https. Does service under any authentication?

          • 2. Re: REST source with HTTPS
            Mónica L.A. Newbie

            Bo, the service don't require an authentication. The server log is:

            17:38:24,240 INFO  [HttpsURLConnectionFactory] The cipher suites have been set t

            o SSL_RSA_WITH_RC4_128_MD5, SSL_RSA_WITH_RC4_128_SHA, TLS_RSA_WITH_AES_128_CBC_S

            HA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, SSL_RSA_

            WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_

            EDE_CBC_SHA, SSL_RSA_WITH_DES_CBC_SHA, SSL_DHE_RSA_WITH_DES_CBC_SHA, SSL_DHE_DSS

            _WITH_DES_CBC_SHA, SSL_RSA_EXPORT_WITH_RC4_40_MD5, SSL_RSA_EXPORT_WITH_DES40_CBC

            _SHA, SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_S

            HA, TLS_KRB5_WITH_RC4_128_SHA, TLS_KRB5_WITH_RC4_128_MD5, TLS_KRB5_WITH_3DES_EDE

            _CBC_SHA, TLS_KRB5_WITH_3DES_EDE_CBC_MD5, TLS_KRB5_WITH_DES_CBC_SHA, TLS_KRB5_WI

            TH_DES_CBC_MD5, TLS_KRB5_EXPORT_WITH_RC4_40_SHA, TLS_KRB5_EXPORT_WITH_RC4_40_MD5

            , TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA, TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5.

            17:38:25,098 INFO  [PhaseInterceptorChain] Interceptor has thrown exception, unw

            inding now

            java.lang.RuntimeException: Couldn't parse stream.

                    at org.apache.cxf.staxutils.StaxUtils.toNextElement(StaxUtils.java:312)

                    at org.apache.cxf.binding.xml.interceptor.XMLMessageInInterceptor.handle

            Message(XMLMessageInInterceptor.java:67)

                    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercept

            orChain.java:236)

                    at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:645)

                    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleR

            esponseInternal(HTTPConduit.java:2132)

                    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleR

            esponse(HTTPConduit.java:2015)

                    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(H

            TTPConduit.java:1940)

                    at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:6

            6)

                    at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:627)

             

             

                    at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndi

            ngInterceptor.handleMessage(MessageSenderInterceptor.java:62)

                    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercept

            orChain.java:236)

                    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:471)

                    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:301)

                    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:253)

                    at org.apache.cxf.endpoint.ClientImpl.invokeWrapped(ClientImpl.java:288)

             

             

                    at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:257)

                    at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:195)

                    at org.teiid.translator.ws.WSProcedureExecution.execute(WSProcedureExecu

            tion.java:132)

                    at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWor

            kItem.java:264)

                    at org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTie

            rTupleSource.java:338)

                    at org.teiid.dqp.internal.process.DataTierTupleSource.access$000(DataTie

            rTupleSource.java:80)

                    at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTup

            leSource.java:138)

                    at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTup

            leSource.java:135)

                    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

                    at java.util.concurrent.FutureTask.run(FutureTask.java:138)

                    at org.teiid.dqp.internal.process.DQPCore$FutureWork.run(DQPCore.java:11

            9)

                    at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkCon

            text.java:194)

                    at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.ru

            n(ThreadReuseExecutor.java:118)

                    at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseE

            xecutor.java:288)

                    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec

            utor.java:886)

                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor

            .java:908)

                    at java.lang.Thread.run(Thread.java:619)

            Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{

            ' (code 123) in prolog; expected '<'

            at [row,col {unknown-source}]: [1,1]

                    at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:

            648)

                    at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.ja

            va:2047)

                    at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)

                    at org.apache.cxf.staxutils.DepthXMLStreamReader.next(DepthXMLStreamRead

            er.java:220)

                    at org.apache.cxf.staxutils.StaxUtils.toNextElement(StaxUtils.java:302)

                    ... 31 more

            17:38:25,113 WARN  [CONNECTOR] Connector worker process failed for atomic-reques

            t=poaIVjJrnBSG.0.2.0

            [TranslatorException]

            1 [HTTPException]

            2 [RuntimeException]Couldn't parse stream.

            3 [WstxUnexpectedCharException]Unexpected character '{' (code 123) in prolog; ex

            pected '<'

            at [row,col {unknown-source}]: [1,1]

                    at org.teiid.translator.ws.WSProcedureExecution.execute(WSProcedureExecu

            tion.java:136)

                    at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWor

            kItem.java:264)

                    at org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTie

            rTupleSource.java:338)

                    at org.teiid.dqp.internal.process.DataTierTupleSource.access$000(DataTie

            rTupleSource.java:80)

                    at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTup

            leSource.java:138)

                    at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTup

            leSource.java:135)

                    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

                    at java.util.concurrent.FutureTask.run(FutureTask.java:138)

                    at org.teiid.dqp.internal.process.DQPCore$FutureWork.run(DQPCore.java:11

            9)

                    at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkCon

            text.java:194)

                    at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.ru

            n(ThreadReuseExecutor.java:118)

                    at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseE

            xecutor.java:288)

                    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec

            utor.java:886)

                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor

            .java:908)

                    at java.lang.Thread.run(Thread.java:619)

            Caused by: javax.xml.ws.http.HTTPException

                    at org.apache.cxf.jaxws.DispatchImpl.mapException(DispatchImpl.java:221)

             

             

                    at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:264)

                    at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:195)

                    at org.teiid.translator.ws.WSProcedureExecution.execute(WSProcedureExecu

            tion.java:132)

                    ... 14 more

            Caused by: java.lang.RuntimeException: Couldn't parse stream.

                    at org.apache.cxf.staxutils.StaxUtils.toNextElement(StaxUtils.java:312)

                    at org.apache.cxf.binding.xml.interceptor.XMLMessageInInterceptor.handle

            Message(XMLMessageInInterceptor.java:67)

                    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercept

            orChain.java:236)

                    at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:645)

                    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleR

            esponseInternal(HTTPConduit.java:2132)

                    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleR

            esponse(HTTPConduit.java:2015)

                    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(H

            TTPConduit.java:1940)

                    at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:6

            6)

                    at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:627)

             

             

                    at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndi

            ngInterceptor.handleMessage(MessageSenderInterceptor.java:62)

                    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercept

            orChain.java:236)

                    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:471)

                    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:301)

                    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:253)

                    at org.apache.cxf.endpoint.ClientImpl.invokeWrapped(ClientImpl.java:288)

             

             

                    at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:257)

                    ... 16 more

            Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{

            ' (code 123) in prolog; expected '<'

            at [row,col {unknown-source}]: [1,1]

                    at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:

            648)

                    at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.ja

            va:2047)

                    at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)

                    at org.apache.cxf.staxutils.DepthXMLStreamReader.next(DepthXMLStreamRead

            er.java:220)

                    at org.apache.cxf.staxutils.StaxUtils.toNextElement(StaxUtils.java:302)

                    ... 31 more

            17:38:25,129 WARN  [PROCESSOR] Processing exception 'FreebaseLocation: null' for

            request poaIVjJrnBSG.0.  Exception type org.teiid.core.TeiidProcessingException

            thrown from com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.jav

            a:648). Enable more detailed logging to see the entire stacktrace.

            Thanks

            • 3. Re: REST source with HTTPS
              Steven Hawkins Master

              This should be the same issue as http://community.jboss.org/thread/175554?tstart=0.  The invoke call is expecting a well-formed XML document to be returned.  Try invokeHttp instead.

               

              Steve

              • 4. Re: REST source with HTTPS
                Mónica L.A. Newbie

                Thanks a lot: I used invokeHttp and I solved my problem. But now I have another one: Same invoke to JASON service: https://www.googleapis.com/freebase/v1/search?query=Palencia&domain=/location/&indent=true, but in my query:

                SELECT t.* from (EXEC "FreebaseLocation".invokeHttp(action=>'GET', endpoint=>'?query=Palencia&domain=Location&indent=true')) as x, xmltable('/Locations/result' PASSING JSONTOXML('Locations', x.result) COLUMNS mid string PATH 'result/mid', name string PATH 'result/name', notable_name string PATH 'result/notable/name', notable_id string PATH 'result/notable/id', lang string PATH 'result/lang', score double PATH 'result/score') AS t;

                I've got two problems:

                - In my different attemps only this query return data. but I don't understand why prefix result has to be put twice, first in the first parameter of xmltable function '/Locations/result', and then in every column of the function.

                - By other hand, with this query, only one register is obtained, when the service return different elements results

                Thanks a lot for your help,

                Mónica

                • 5. Re: REST source with HTTPS
                  Mónica L.A. Newbie

                  Lucky day ! Finally I resolved with this query. Thanks a lot !

                  SELECT t.* from (EXEC "FreebaseLocation".invokeHttp(action=>'GET', endpoint=>'?query=Palencia&domain=Location&indent=true')) as x, xmltable('/Locations/result/*' PASSING JSONTOXML('Locations', x.result) COLUMNS mid string PATH 'mid', name string PATH 'name', notable_name string PATH 'notable/name', notable_id string PATH 'notable/id', lang string PATH 'lang', score double PATH 'score') AS t;

                  1 of 1 people found this helpful
                  • 6. Re: REST source with HTTPS
                    Steven Hawkins Master

                    Mónica,

                     

                    On the first problem, this is an issue with the conversion to XML.  As per the reference we should not double wrap non-root array elements.  I'll log an issue about this.  It sounds like you have already answered the second part.

                     

                    Thanks,

                    Steve

                    • 7. Re: REST source with HTTPS
                      Steven Hawkins Master

                      https://issues.jboss.org/browse/TEIID-1896 was logged and worked to correct the generated XML.