1 2 3 Previous Next 38 Replies Latest reply on Dec 28, 2011 8:32 AM by ram-biradar Go to original post
      • 30. Re: Connecting to GWT Console by Rest interface, login problem
        npereira

        Sorry,

         

        I made a mistake.

         

        When I said:

        npereira wrote:

         

         

        But if I comment the first requestPostService and do the authentication first I  get the follwing error,

         

        the error that I'm getting is,

         

        <html><head><title>JBoss Web/2.1.3.GA - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 408 - The time allowed for the login process has been exceeded. If you wish to continue you must either click back twice and re-click the link you requested or close and re-open your browser</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>The time allowed for the login process has been exceeded. If you wish to continue you must either click back twice and re-click the link you requested or close and re-open your browser</u></p><p><b>description</b> <u>The client did not produce a request within the time that the server was prepared to wait (The time allowed for the login process has been exceeded. If you wish to continue you must either click back twice and re-click the link you requested or close and re-open your browser).</u></p><HR size="1" noshade="noshade"><h3>JBoss Web/2.1.3.GA</h3></body></html>

         

        Regards

        • 31. Re: Connecting to GWT Console by Rest interface, login problem
          melc

          Hi,

          Based on the approach i have described, you should not start calling the web service with the authentication first. The reason is because the server is not expecting authentication parameters and when you call first the authentication, the server suddenly receives authentication parameters and gives this response. So this occurrs when you call directly the authenticate method without first the server to prompt for authentication. The server prompts for authentication when you try to access a web service the very first time.

           

          So to make it work you need to do the following in the order stated,

           

          1. call a web service

              1a. if you're authenticated the server will respond with the result of the web service and you're done :-)

              1b. if you're not authenitcated the server will respond with prompt for authentication and it will expect authentication parameters

               NOTE: Thus, it is normal to receive a prompt to authenticate the very first time.

           

          2. since it is asking for authentication now it is a good time to send authentication parameters via the authenticate method mentioned above

           

          3. then you call your web service from step 1

           

           

          Afterwards, you can call other web services without the need to authenticate, unless the session expires or a new session is used. In this case just authenticate again and call web services. Actually it is quite easy to accomodate this logic (a.call ws , b.if response ok - done , c. if not - authenticate and go to a.) in a method that calls any of the ws.

           

          If you run in this sequence in the end does the process start?

           

          (Bear in mind that if you try to start a process that has a task form related to the process in order to start (i.e. when the task form name is the_process_id.ftl, for example the sample evaluation process), then it will not start this way, i haven't checked for the exact approach that would be required, possibly by providing the expected form parameters within the http request (i'm not even sure if it supported by the specific web service.... anyway). But that is one other issue....  )

          • 32. Re: Connecting to GWT Console by Rest interface, login problem
            npereira

            Hi Chris,

             

            Thank you for your insight. If I follow your logic it definitly works.

             

            My question is, is this the way it should work? Or is it a workaround?

             

            Even following HTTP standards, when I ask to authenticate shoudn't I be prompted with the form?

             

            Regards

            • 33. Re: Connecting to GWT Console by Rest interface, login problem
              melc

              Hello,

              No problem, i'm glad everything works allright for you. I'm not  sure if you could authenticate directly. Possibly by using some special authentication related headers in the post, on an initial authentication request.

              • 34. Re: Connecting to GWT Console by Rest interface, login problem
                npereira

                Hi Chris,

                 

                Thank for all the help.

                 

                One last question.

                 

                How can identify if the response is ok, the b. point on your logic?

                 

                I have been going through the HttpResponse, but wasn't able to identify if there is a way to understand if the return response is an error or not.

                Is there any mehtod that can tell me this?

                 

                Regards

                • 35. Re: Connecting to GWT Console by Rest interface, login problem
                  melc

                  Hello,

                  Well normally you would get a json response, so any other http response would mean that something went wrong.

                  For example i check if the response contains the string j_username

                  (i.e.

                  ....

                  responseString = requestPostService(....);

                              if (responseString.contains(KEY_USERNAME)) { //KEY_USERNAME equals j_username

                                  authenticate(address, "admin", "admin");

                                  responseString = requestPostService(....);

                              }

                  ....

                  ), then i know for sure that it is the html of the login form so i send the authenticate request.

                  • 36. Re: Connecting to GWT Console by Rest interface, login problem
                    npereira

                    Hi Chris,

                     

                    Thanks for all the help.

                     

                    Regards

                    • 37. Re: Connecting to GWT Console by Rest interface, login problem
                      pierx83

                      Hi, I created the POJO DataEntity  and it works perfectly.

                      Therefore, I need a way to make a POJO object more dynamic without specifying the parameter names inside it.

                       

                      How can I do that?

                       

                      Thanks in advance,

                      Pierpaolo

                      • 38. Re: Connecting to GWT Console by Rest interface, login problem
                        ram-biradar

                        Hi Victor/Jiff/Chris/Serkan,

                         

                        I've written ManagementClient.java as u suggested in the above link.But,its returning username and password null.and returning exception as java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory,even if i added low level API required jars.

                         

                        How to connect to gwt console through the code.I've referred the link http://bazaar.launchpad.net/~alexei-tarnakin/+junk/jbpm-rest/files.But,unable to download the project.could you please suggest me how to download that project and connect to gwt-console

                        1 2 3 Previous Next