irontec / zsugar

Zimbra SugarCRM integration zimlet (unmaintained, see README)
3 stars 8 forks source link

417 - Expectation Failed #6

Closed amernet closed 10 years ago

amernet commented 10 years ago

Hello, I have Zsugar 1.4.11 installed. Zimbra 8.5.0_GA_3042 (build 20140828191919) SugarCRM CE Version 6.5.16 (Build 1082)

I kept getting "Incorrect Authentication" and not sure what went wrong. I have tried all different URL combinations. http://mysugcrm.com/CRM/ https://mysugcrm.com/CRM/ http://mysugcrm.com/ https://mysugcrm.com/

Please advise what else could cause this issue.

Thanks! Charles

Kaian commented 10 years ago

Hi Charles!

Check #2 for JSP configuration in Zimbra 8.5

Zimbra 8.5 comes with JSP Servlet support disabled, so maybe that's the problem.

A mailbox restart is also required after installing the zimlet for thie first time.

Best regards, Kaian

amernet commented 10 years ago

Hello Kaian,

I have tried to enable the jsp as followed

root@zimbra01:~# su - zimbra zimbra@zimbra01:~$ zmprov gs zimbra01.amer.net | grep zimbraZimletJspEnabled (Nothing showed) zimbra@zimbra8-dev:~$ zmprov ms zimbra8-dev.irontec.com zimbraZimletJspEnabled TRUE zimbra@zimbra8-dev:~$ zmcontrol restart

I also checked https://zimbra01.amer.net/service/zimlet/com_irontec_zsugar/redirect.jsp and it seems ok without any 500 error.

I still getting the authentication error as before.

Please advise!

Thanks! Charles

Kaian commented 10 years ago

Nothing Showed? Thats strange...

Do you get zimbra01.amer.net from:

zmprov gas

And a list of properties from:

zmprov gs zimbra01.amer.net
amernet commented 10 years ago

Sorry, I had a typo and it's enabled.

I checked and the zimbraZimletJspEnabled : TRUE.

I zmcontrol restart and did zmmailboxdctl restart then log back in but still getting Incorrect Authentication.

Please advise whatelse I missed.

Thanks! Charles

Kaian commented 10 years ago

Well then we have to debug the request.

If you're using Firefox, you can install https://addons.mozilla.org/es/firefox/addon/firebug/ to get zimlet requests and their responses.

Press F12 and a panel will apperar with some tabs. Click the console tab while you're in zimbra. Refresh and search for a request like this:

https://zimbra01.amer.net/service/zimlet/com_irontec_zsugar/redirect.jsp

Click on it's response tab and we will get a hint.

Maybe the zimbra server can't reach the sugarcrm or cant resolve its dns. Maybe the sugarcrm url is HTTPS and is using an invalid certificate. Lets find out.

amernet commented 10 years ago

OK. At first, when I right click Force Authentication, the console showed response time ok as followed, [05:32:27.599] POST https://zimbra01.amer.net/service/zimlet/com_irontec_zsugar/redirect.jsp [HTTP/1.1 200 OK 99ms]

https://zimbra01.amer.net/service/zimlet/com_irontec_zsugar/redirect.jsp Request Method: POST Status Code: HTTP/1.1 200 OK Request Headers 05:50:55.000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0 Referer: https://zimbra01.amer.net/ Pragma: no-cache Host: zimbra01.amer.net Content-Type: application/x-www-form-urlencoded; charset=UTF-8 Content-Length: 270 Connection: keep-alive Cache-Control: no-cache Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 Sent Cookie ZM_TEST: true ZM_AUTH_TOKEN: 0_9d7349329b0c23d63ecd72f82e06efefe6a5e38c_69643d33363a63333938323239332d366538632d346436382d393566662d3831643239636432616532643b6578703d31333a313431343431343133323931373b747970653d363a7a696d6272613b7469643d393a3337363738313434373b76657273696f6e3d31333a382e352e305f47415f333034323b637372663d313a313b JSESSIONID: 5f2kp2wtlzu73kdehnqy8r _ga: GA1.2.507866516.1387455851 __utma: 226435397.507866516.1387455851.1388469496.1388899614.8 Response Headers Δ83ms Server: nginx Date: Sat, 25 Oct 2014 12:50:55 GMT Content-Type: text/html; charset=UTF-8 Content-Length: 363 Connection: keep-alive


If I copied and load https://zimbra01.amer.net/service/zimlet/com_irontec_zsugar/redirect.jsp then I get the following error, you mentioned this is normal.

HTTP ERROR 500

Problem accessing /service/zimlet/com_irontec_zsugar/redirect.jsp. Reason:

Server Error

Powered by Jetty://

I also tested to ping the callcenter01.amer.net within Zimbra server and I can get name resolved.

Thanks and please let me know what other info/debug you need.

Charles

Kaian commented 10 years ago

Copying and loading wont work. It must be debugged when the request is done from your zimbra session.

When you click a request in firebug there are some different tabs, one with the data we send to redirect.jsp and another with its response :)

We're inrterested in the Response tab of the firebug. What you have copied is the http request data :D

Kaian commented 10 years ago

Also the Sugar URL you should have in zimlet configuration is http://callcenter01.amer.net/

amernet commented 10 years ago

Hello Kaian,

Sorry for not giving you the right info. I went under the Web Developer then Console tab. Here's the request and response I copied from the pop-up (Inspece Network Request).

POST https://zimbra01.amer.net/service/zimlet/com_irontec_zsugar/redirect.jsp

Request Body

method=login&input_type=JSON&response_type=JSON&rest_data=%5B%7B%22password%22%3A%224cca1f732a72e9cc9d18781031792f64%22%2C%22user_name%22%3A%22ckung%22%7D%2C%22ironsugar%20zimlet%22%2C%5B%5D%5D&sugar_url=http%3A%2F%2Fcallcenter01.amer.net%2F%2Fservice%2Fv2%2Frest.php

Response Body Δ0ms

<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>417 - Expectation Failed</title> </head> <body> <h1>417 - Expectation Failed</h1> </body> </html> 

Please advise if this is the info you need. Thanks! Charles

Kaian commented 10 years ago

This is the first time I see that error, most probably caused by:

client.getParams().setParameter("http.protocol.expect-continue", true);

Let me remove that line, and generate a new version so you can test :)

Kaian commented 10 years ago

Hi Charles!!

Can you please try 1.4.12-rc1

https://github.com/irontec/zsugar/releases/tag/v1.4.12-rc1

You must restart your mailbox after the zip deploy (because the change is in the JSP file). If it doesn't fix the problem and gives you diferent response, paste it again.

su - zimbra -c "zmmailboxdctl restart"

Thanks to you for the all the debugging !!

amernet commented 10 years ago

Hello Kaian,

Great! It's authenciated. You fixed it. Quick question on the "Send to SugarCRM" Once it's clicked then got "No results found." as expected since there's no mail sent out from SugarCRM with matching FROM and Subject. Correct?

I try to use the pull down option "Create Lead" under More Option menu but it didn't do anything. Please advise how to set it up properly since all the items were checked in the SugarCRM integration preferences except the LDAP Authenication.

Thanks for your help again! Charles

Kaian commented 10 years ago

Hi Charles!

The zimlet will search SugarCRM contacts and leads those who match the address in the combobox, displaying them with (if enabled in properties) thir related accounts, opportunities and projects.

So, if no result is printed, then there is no Contact/Lead that has the selected address in SugarCRM. Otherwise, the list where "No results found." texts appears will be filled with icons like in this screenshot (a bit old, taken from zimbra gallery):

https://gallery.zimbra.com/sites/default/files/imagecache/screenshot_large/users/370/screenshots/mainTab.jpg

Then you select the items you want and the zimlet will create a Email object in SugarCRM linked to those selected items.

The create Lead is special feature that we wanted to implement in case no object existed with a given address. bTactic implemented some other features (create_objects branch) but those are not released.

Anyway, I'm testing the zimlet in our Zimbra 8.5 environment and I see awful behaviours.

Fetching data and exporting mails to selected items seems to work, but there are some bugs that must be fixed for Zimbra 8.5 to make the zimlet usable...

I think we should fix those problems in other issues, and close this one, with a title related to the 417 error printed in your response.

Thanks a lot for your time :smile:

Kaian commented 10 years ago

I've created #7 and #8

Thanks!