13 Replies Latest reply on Feb 4, 2010 1:43 PM by John Doyle

    Authorized SOAPRequest

    Thomas Karras Newbie

      I am trying to use a web service as a data source.  The issue I am running into is that the web service requires a username and password and Teiid doesn't seem to be supplying the authentication information I have entered in the VDB file.

       

      If I try to query through the eclipse plugin, a popup comes up to allow me to enter the username and password.  Once I do this the eclipse plugin works fine, but when I'm running Teiid stand-alone through a simple test case the only place I can enter in the authentication info is in the VDB.

       

      I have followed along in the source code and it's throwing a MMSQLException up in the SOAPRequest class on the dispatch.invoke call saying that the request is Unauthorized.  The username and password is set in the secToken object but this doesn't seem to be used anywhere.

       

      I am using Teiid 6.2.

       

      Any help to figure this out would be appreciated, Thanks!

        • 1. Re: Authorized SOAPRequest
          Ramesh Reddy Master

          Inside the VDB, in the "ConfigurationInfo.def" file should detail all the details about the connection and auth information. Open the VDB with any zip tool and inspect this file and make sure the settings are right. Desinger writes this file with all the information you entered. There are two separate settings for authorizations. First, you need to select if this is WS-Security or HTTP Basic, if it is WS-Security then there are further settings to define what kind of ws-secuirty you are using.

          • 2. Re: Authorized SOAPRequest
            Thomas Karras Newbie

            I have looked at this file already.  The 'AuthPassword' and  'AuthUserName" properties are both set and the SecurityType property is set to HTTPBasic.  There is no WS-Security used on the web service I am trying to connect to.

            • 3. Re: Authorized SOAPRequest
              John Doyle Apprentice

              Thomas,

               

              Are your referring to the secToken in com.metamatrix.connector.xml.soap.SOAPRequest? (there are two SOAP connectors).  This code appears incomplete as you said, secToken is loaded but not used.  I logged a JIRA for this defect.  https://jira.jboss.org/jira/browse/TEIID-945

               

              Can i suggest that you call this service with the SOAP source connector?

               

              ~john

              • 4. Re: Authorized SOAPRequest
                Ramesh Reddy Master
                What is the alternative to call a SOAP service that is behind a HTTPBasic auth? or is this not supported in 6.2?
                • 5. Re: Authorized SOAPRequest
                  John Doyle Apprentice
                  The alternative is the SOAP Source connector, I believe that Thomas is using the SOAP - Relational connector.
                  • 6. Re: Authorized SOAPRequest
                    Thomas Karras Newbie

                    Yep that is correct, I was using the SOAP - Relational Connector.  I'm in the process of switching the connector and will let you know the results.

                     

                    Thanks!

                    • 7. Re: Authorized SOAPRequest
                      Ramesh Reddy Master

                      Thomas, that is not possible. You can not switch XML-Relational Connector to a XML Source connector.

                       

                      A XML source connector will make the call to the SOAP service but it will return the results to the Teiid runtime as SQLXML.This is primarly to be used with XQuery transformations.

                       

                      Where as XML-Relational connector will modify the XML into relational table contents based on the model you created using the Designer and provide the Teiid runtime with that mapped data.

                       

                      What I still do not understand is how it worked in the Desinger. John?

                      • 8. Re: Authorized SOAPRequest
                        Thomas Karras Newbie
                        Ahh, that probably explains why the designer was freezing up on me when I tried switching the connector to the regular soap connector.
                        • 9. Re: Authorized SOAPRequest
                          John Doyle Apprentice

                          I don't think it worked in the Designer.  We don't have the capability to pop up a prompt as Thomas descirbed.  I think he was talking about using eclipse Web Tools to test the service.  Is that so Thomas?

                           

                          ~jd

                          • 10. Re: Authorized SOAPRequest
                            Thomas Karras Newbie
                            The way I did it was I opened up the vdb file in the Designer and hit the Execute button.  This opened up the SQLExplorer perspective which I assume is from eclipse web tools?  Then when I executed a query to access the web service eclipse prompted me for a user name and password.
                            • 11. Re: Authorized SOAPRequest
                              John Doyle Apprentice

                              Thomas,

                               

                              I have no idea how that is possible.  The connector is meant to run in a server, so it has no capability to pop up a dialog.  I realize that you're not going to use this connector because of the bug you found, but If you want you can attach a screen shot of of the dialog, that might help me figure out what is happening.

                               

                              Have you had any luck with the SOAP Source connector?

                               

                              ~jd

                              • 12. Re: Authorized SOAPRequest
                                Thomas Karras Newbie

                                John,

                                 

                                I had some issues switching to the SOAP Source connector, the teiid designer kept freezing up my eclipse instance.  I will see if I can get it working today. Just double checking but I am trying to change the Connector Type on the vdb file from XML-Relational SOAP Connector to the XML SOAP Connector.

                                 

                                Here are the screenshots, the first one is the username/password prompt that appears, and in the background is the SQLExplorer view in my eclipse instance with the query I executed.  The second screenshot is the error message that appears if I hit cancel.  If I enter in the correct information into the prompt the query executes fine.

                                 

                                Here is also the exception in the logs when I cancel the username/password prompt.

                                 

                                !ENTRY net.sourceforge.sqlexplorer 4 4 2010-02-04 10:49:30.068
                                !MESSAGE Error processing query
                                !STACK 0
                                com.metamatrix.jdbc.MMSQLException: Error occurred on connector Connector<26> - The server sent HTTP status code 401: Unauthorized
                                    at com.metamatrix.jdbc.MMSQLException.create(MMSQLException.java:123)
                                    at com.metamatrix.jdbc.MMSQLException.create(MMSQLException.java:71)
                                    at com.metamatrix.jdbc.MMStatement.executeSql(MMStatement.java:423)
                                    at com.metamatrix.jdbc.MMStatement.execute(MMStatement.java:318)
                                    at net.sourceforge.sqlexplorer.sqlpanel.SqlExecProgress.processQuery(SqlExecProgress.java:192)
                                    at net.sourceforge.sqlexplorer.sqlpanel.SqlExecProgress.run(SqlExecProgress.java:121)
                                    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
                                Caused by: [MetaMatrixComponentException]Error occurred on connector Connector<26> - The server sent HTTP status code 401: Unauthorized
                                1 [ConnectorException]Error occurred on connector Connector<26> - The server sent HTTP status code 401: Unauthorized
                                2 [ConnectorException]The server sent HTTP status code 401: Unauthorized
                                3 [ClientTransportException]The server sent HTTP status code 401: Unauthorized
                                    at org.teiid.dqp.internal.process.DataTierTupleSource.switchBatch(DataTierTupleSource.java:128)
                                    at org.teiid.dqp.internal.process.DataTierTupleSource.nextTuple(DataTierTupleSource.java:89)
                                    at com.metamatrix.query.processor.relational.AccessNode.nextBatchDirect(AccessNode.java:132)
                                    at com.metamatrix.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:261)
                                    at com.metamatrix.query.processor.relational.BatchCollector.collectTuples(BatchCollector.java:58)
                                    at com.metamatrix.query.processor.relational.BatchCollector.collectTuples(BatchCollector.java:52)
                                    at com.metamatrix.query.processor.relational.SourceState.collectTuples(SourceState.java:107)
                                    at com.metamatrix.query.processor.relational.PartitionedSortJoin.loadLeft(PartitionedSortJoin.java:142)
                                    at com.metamatrix.query.processor.relational.JoinNode.nextBatchDirect(JoinNode.java:189)
                                    at com.metamatrix.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:261)
                                    at com.metamatrix.query.processor.relational.ProjectNode.nextBatchDirect(ProjectNode.java:165)
                                    at com.metamatrix.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:261)
                                    at com.metamatrix.query.processor.relational.RelationalPlan.nextBatch(RelationalPlan.java:110)
                                    at com.metamatrix.query.processor.QueryProcessor.process(QueryProcessor.java:160)
                                    at org.teiid.dqp.internal.process.RequestWorkItem.processMore(RequestWorkItem.java:261)
                                    at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:207)
                                    at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:44)
                                    at com.metamatrix.common.queue.WorkerPoolFactory$StatsCapturingSharedThreadPoolExecutor$1.run(WorkerPoolFactory.java:211)
                                    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
                                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
                                    at java.lang.Thread.run(Thread.java:619)
                                Caused by: org.teiid.connector.api.ConnectorException: Error occurred on connector Connector<26> - The server sent HTTP status code 401: Unauthorized
                                    at org.teiid.dqp.internal.datamgr.impl.ConnectorWorkItem.handleError(ConnectorWorkItem.java:238)
                                    at org.teiid.dqp.internal.datamgr.impl.ConnectorWorkItem.process(ConnectorWorkItem.java:174)
                                    at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:44)
                                    at org.teiid.dqp.internal.datamgr.impl.SynchConnectorWorkItem.run(SynchConnectorWorkItem.java:69)
                                    ... 4 more
                                Caused by: org.teiid.connector.api.ConnectorException: The server sent HTTP status code 401: Unauthorized
                                    at com.metamatrix.connector.xml.soap.SOAPRequest.executeRequest(SOAPRequest.java:89)
                                    at com.metamatrix.connector.xml.http.HTTPRequest.getDocumentStream(HTTPRequest.java:100)
                                    at com.metamatrix.connector.xml.http.HTTPExecutor.getXMLDocuments(HTTPExecutor.java:72)
                                    at com.metamatrix.connector.xml.streaming.BaseStreamingExecution.next(BaseStreamingExecution.java:89)
                                    at org.teiid.dqp.internal.datamgr.impl.ConnectorWorkItem.handleBatch(ConnectorWorkItem.java:371)
                                    at org.teiid.dqp.internal.datamgr.impl.ConnectorWorkItem.processNewRequest(ConnectorWorkItem.java:283)
                                    at org.teiid.dqp.internal.datamgr.impl.ConnectorWorkItem.process(ConnectorWorkItem.java:157)
                                    ... 6 more
                                Caused by: com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 401: Unauthorized
                                    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.checkStatusCode(HttpTransportPipe.java:196)
                                    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:168)
                                    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:83)
                                    at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:105)
                                    at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:587)
                                    at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:546)
                                    at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:531)
                                    at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:428)
                                    at com.sun.xml.internal.ws.client.Stub.process(Stub.java:211)
                                    at com.sun.xml.internal.ws.client.dispatch.DispatchImpl.doInvoke(DispatchImpl.java:169)
                                    at com.sun.xml.internal.ws.client.dispatch.DispatchImpl.invoke(DispatchImpl.java:195)
                                    at com.metamatrix.connector.xml.soap.SOAPRequest.executeRequest(SOAPRequest.java:80)
                                    ... 12 more

                                • 13. Re: Authorized SOAPRequest
                                  John Doyle Apprentice

                                  That is bizzare.  Could be that the underlying SOAP client we're using prompts by itself because we haven't provided the correct credentials up front.  I'll look into it.

                                   

                                  I assume to get to the point where you are now you used the WSDL to Relational import Wizard to create a model from your WSDL.  You can't just replace the connector bound to this model with the SOAP Source Connector.  These two connectors treat XML in completely different ways and require different models.

                                  XML to Relational uses XPaths in a model to create an XML request document from criteria in a SQL Query, and converts the XML response document to tabular results.

                                  The SOAP Source connector cannot be bound not to a Relational Model, but must be bound to a XML Service Source model.  This kind of model can contain Procedures that take an XMLLiteral as input (the body of the request) and output an XMLLiteral (the response body).     The 'Name in Source' property of the  procedure maps the the name of the web service operation.  You then have to use XQuery transformations to get the data out of the response.  I don't know if this usage model fits the requirements of your case.

                                   

                                  ~jd