Hi Marco,

does the customer exists in OTRS? To check that, login to the admin interface of OTRS (http://localhost/otrs/index.pl) -> Admin -> Customer user

Did you set the "User" and "Password" (please use correct wording, you have used "password") data in your script? In the program you have shown, you just use empty strings.
Did you sent the hidden values? This is the form shown in customer.pl

       <form action="/otrs/customer.pl" method="post" 
enctype="application/x-www-form-urlencoded" name="login">
         <input type="hidden" name="Action" value="Login"/>
         <input type="hidden" name="RequestedURL" value=""/>
         <input type="hidden" name="Lang" value="de"/>
         <input type="hidden" name="TimeOffset" value=""/>
         <table cellspacing="8" cellpadding="2">

           <tr>
             <td>Benutzername:</td>
             <td><input type="text" name="User" value="" size="18"/></td>
           </tr>
           <tr>
             <td>Passwort:</td>
             <td><input type="password" name="Password" size="18"/></td>
           </tr>

         </table>
         <input class="button" type="submit" value="Login" onclick="return 
submit_form();"/>
       </form>

Here you see at least one parameter that is needed, too: Action.

Cheers,
Renée

[email protected] schrieb:


Hi.I'm Marco from Italy (Tuscany).
I'm a novice otrs user and i have a big problem to solve!
I've correctly installed OTRS on my local host using database PostgresSQL.

I'm developing a java web site in wich i have insert a simple html form to open ticket. I need to link this form to the open ticket service offered by OTRS to give possibility to the customers to open ticket.

So, i think to use "httpclient lib" in my java application to link my form to OTRS system via httpclient but I've problem in the login-customer phase!


I want to know if it need to change some configuration in OTRS config.pm file or in other files.

This is the code i've used in my java application to try to login the customer in otrs system:



public String execute() throws IOException {
DefaultHttpClient httpclient = new DefaultHttpClient(); // make the initial get to get the JSESSION cookie

HttpGet get = new HttpGet("http://localhost/otrs/customer.pl";); HttpResponse response;
                        response = httpclient.execute(get);
HttpEntity entity;
                        entity = response.getEntity();
System.out.println("Login form get: " + response.getStatusLine()); if (entity != null)
                        entity.consumeContent();
// sezione cookies

                System.out.println("Initial set of cookies:");

List<Cookie> cookies = httpclient.getCookieStore().getCookies();
            if (cookies.isEmpty()) {
                System.out.println("None");
            } else {
                for (int i = 0; i < cookies.size(); i++) {
                    System.out.println("- " + cookies.get(i).toString());
                }
            }

// authorize HttpPost post = new HttpPost("http://localhost/otrs/customer.pl";); List <NameValuePair> dati = new ArrayList <NameValuePair>(); dati.add(new BasicNameValuePair("User", " ")); dati.add(new BasicNameValuePair("password", " ")); post.setEntity(new UrlEncodedFormEntity(dati, HTTP.UTF_8));

response = httpclient.execute(post); entity = response.getEntity(); System.out.println("Double check we've got right page " + EntityUtils.toString(entity)); System.out.println("Login form get: " + response.getStatusLine());

                if (entity != null) {
                    entity.consumeContent();
                        }

                  System.out.println("Post logon cookies:");
                    cookies = httpclient.getCookieStore().getCookies();
                    if (cookies.isEmpty()) {
                        System.out.println("None");
                    } else {
                        for (int i = 0; i < cookies.size(); i++) {
System.out.println("- " + cookies.get(i).toString());
                                }
                        }

httpclient.getConnectionManager().shutdown();
                System.out.println("Username: "+User);
System.out.println("Password: "+password);

return "success"; }

This is output:

[STDOUT] Login form get: HTTP/1.1 200 OK
10:04:38,046 INFO  [STDOUT] Post logon cookies:
10:04:38,046 INFO  [STDOUT] None
10:04:38,047 INFO  [STDOUT] Username: mark
10:04:38,047 INFO  [STDOUT] Password : mark


but i can't login in otrs!

Please i need to solve the problem.

thank'you and sorry for my "terrible" english.

Marco

------------------------------------------------------------------------

---------------------------------------------------------------------
OTRS mailing list: dev - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/dev
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/dev

NEW! ENTERPRISE SUBSCRIPTION - Get more information NOW!
http://www.otrs.com/en/support/enterprise-subscription/


--
Perl-Magazin: http://perl-magazin.de
Perl-Nachrichten: http://perl-nachrichten.de


---------------------------------------------------------------------
OTRS mailing list: dev - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/dev
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/dev

NEW! ENTERPRISE SUBSCRIPTION - Get more information NOW!
http://www.otrs.com/en/support/enterprise-subscription/

Reply via email to