留言板

add-user No JSON web service action associated

Cesar Rodriguez,修改在6 年前。

add-user No JSON web service action associated

New Member 帖子: 5 加入日期: 17-10-12 最近的帖子
Greetings, I am trying to add a new user using liferay(6.2 ga5) api json web services. I've successfully added a new user using the add-user method via GET request (not 100% success, though. See my previous post: https://web.liferay.com/community/forums/-/message_boards/message/96755040). However when trying to use this method with POST, I receieve always the following error message:
[JSONWebServiceServiceAction:97] No JSON web service action associated with path /user/add-user and method POST for /

I believe this error message appears when the request is malformed, however I haven't found the error yet as I am basing my request in the example provided by the liferaypath/api/jsonws web interface. Here is a curl example:
curl -k https://liferayaddress:port/api/jsonws/user/add-user -H "Authorization: Basic base64encodedstring" -H "Content-Type: application/json; charset=utf-8" -d companyId=1-d autoPassword=true -d password1='' -d password2='' -d autoScreenName=true -d screenName='' -d emailAddress='someone@mail.com' -d facebookId=0 -d openId='0' -d locale= -d firstName='test' -d middleName='' -d lastName='Müller' -d prefixId=0 -d suffixId=0 -d male=true -d birthdayMonth=1 -d birthdayDay=1 -d birthdayYear=1970 -d jobTitle='ab' -d groupIds= -d organizationIds= -d roleIds= -d userGroupIds= -d sendEmail=true

and also like this:
curl -k "https://liferayaddress:port/api/jsonws/user/add-user" -H "Authorization: Basic base64encodedstring" -H "Content-Type: application/json; charset=utf-8" -d "{\"companyId\":10,\"autoPassword\":true,\"password1\":\"\",\"password2\":\"\",\"autoScreenName\":true,\"screenName\":\"Hans\",\"emailAddress\":\"comeone@mail.com\",\"facebookId\":0,\"openId\":\"0\",\"locale\":,\"firstName\":\"test\",\"middleName\":\"\",\"lastName\":\"müller\",\"prefixId\":0,\"suffixId\":0,\"male\":true,\"birthdayMonth\":1,\"birthdayDay\":1,\"birthdayYear\":1970,\"jobTitle\":\"Person\",\"groupIds\":,\"organizationIds\":,\"roleIds\":,\"userGroup\":false}"

Unfortunately the logged error message is the same as mentioned before. I believe it is no security configuration error as I've followed the examples from here: http://www.liferaysavvy.com/2014/02/working-with-liferay-portal-json-web.html.

Any help would be much appreciated.
thumbnail
Andrew Jardine,修改在6 年前。

RE: add-user No JSON web service action associated

Liferay Legend 帖子: 2416 加入日期: 10-12-22 最近的帖子
Hi Cesar,

JSON WS code you'll see that it uses a little Liferay magic to try to find a method signature that have the argument definition that matches the parameters passed in on the request. That error is normally in reference to not being able to find a method that matches the number of arguments that you passed. To eliminate the possibility that you are passing a parameter that is invalid, or missing something can you try the following?

1. Go to the /api/jsonws (when you are logged in as a user with the rights to add users)
2. Find the add-user invocation form and fill it in with your values
3. After you execute the request, there should be an option to see what it would look like as a curl
4. Grab that and then try it as you have been, though you will probably have to add you auth pieces to it

... if you do that, do you still get the same response?

One other thing. Is that the correct companyId? You don't often find them with such a low value.