cancel
Showing results for 
Search instead for 
Did you mean: 

Problem authenticating POST request

workingpeter
Champ in-the-making
Champ in-the-making
I have a web script based on the file upload example, using Community 2.9B.  I am failing to get a form-based client to authenticate when issuing a POST to the web script. The script has the authentication attribute set to "user". After entering the basic auth credentials, the script executes but an exception is thrown that "companyhome is not defined". This seems to be consistent with executing the script as an unauthenticated user.

GET requests to other scripts that also use companyhome do not have this problem. Is this a problem with POST's?

Note that the same script executes correctly under Enterprise 2.1.1. Am I trying to implement an Enterprise-only feature?

Thanks.
14 REPLIES 14

leoputz
Champ in-the-making
Champ in-the-making
someone found a solution?

Im with the same problem using get…. with post and delete its ok….

but when i try to use get method … appears the problem (company home is not defined) i tried using root … and the problem persist…

rosemaryl
Champ in-the-making
Champ in-the-making
Hi leoputz,
I just skimmed your entire thread since I'm looking for a solution for a different problem I'm having, but have you taken a look at this post http://forums.alfresco.com/viewtopic.php?p=35267 ?  The wiki page (http://wiki.alfresco.com/wiki/JavaScript_API#Root_Scope_Objects) says that you can only access certain root scope objects through a rule/action, in the Web-Client or through the Script Command Processor.  For webscripts the aforementioned forum post suggests passing in companyhome as a parameter. 

If I'm totally off, my apologies – like I said I didn't read the entire post.

Best of luck.

~Rosemary

sanket
Champ on-the-rise
Champ on-the-rise
Hi, I am getting the following error.
org.mozilla.javascript.EcmaError: ReferenceError: "formdata" is not defined.

File: upload.post.js
Line: for each (field in formdata.fields)

I have tried to check on safari, IE and mozilla. Its not working.
Version i am using is Alfresco3.2

Is "formdata" available in this version ?
Or its some other problem ?

Please help.

gyro_gearless
Champ in-the-making
Champ in-the-making
Hi,I suppose you only get the 'formdata' field if you are doing a POST with encoding set to "multipart/form-data", for example from an HTML page:

<form action="127.0.0.1:8080/alfresco/service/hau/mich/blau" method="post" enctype="multipart/form-data">

</form>
HTH

Gyro

sanket
Champ on-the-rise
Champ on-the-rise
Yes I have already done that.