2

I'm trying to invoke ProfileFormHandler's create handle using ATG rest client as shown below.

mSession = RestSession.createSession(mHost, mPort,"kim@example.com","password");
mSession.setUseHttpsForLogin(false);
mSession.login();

Map<String,Object> params = new HashMap<String,Object>();
params.put("value.login", "buddha@oracle.com");
params.put("value.email", "buddha@oracle.com");
params.put("value.password", "password");

RestResult result = RestComponentHelper.executeMethod("/atg/userprofiling/ProfileFormHandler","create",null,params,mSession);

I'm getting form exceptions that says, I'm not passing Login and Password Fields.

["Missing value for the required property Password",
 "Missing value for the required property Login name"]

I've tried all combinations of login and password fields like value.login, Login, login, value.Login etc., but nothing seemed to work. All combinations giving the same form exceptions.

How do I invoke an ATG form handler using ATG REST Client and pass parameters to it?

Buddha
  • 4,339
  • 2
  • 27
  • 51

2 Answers2

1

Definitely need more information but looking at your code I can see that you have a value.login which is not configured ootb and believe this is causing the NPE. Assuming you have not customized the ootb ATG RegistrationFormHandler and the required field in the repository the only values you need to pass to the form handler are:

  • value.email
  • value.password
  • value.confirmPassword
  • value.firstName
  • value.lastName

Also, the help is specific that the data-type of the value property needs to be java.util.Dictionary

bated
  • 960
  • 2
  • 15
  • 29
  • I have used CRS formhandler and I'm using 11.1 version of ATG. In further experimentation, I have used ProfileFormHandler and its handleCreate to avoid any customizations. Now I'm not getting any null pointer exception, but I'm getting form exceptions that say I'm not passing Password and Login fields. Even though I'm passing them. – Buddha Oct 14 '14 at 05:30
  • Have you followed [these](http://docs.oracle.com/cd/E24152_01/Platform.10-1/ATGWSFrameGuide/html/s1601invokingformhandlers01.html) instructions? – bated Oct 14 '14 at 20:32
  • These instructions involve directly passing JSON request. can we pass a JSON text using ATG REST Client? I couldn't find any instructions related to that. – Buddha Oct 15 '14 at 13:45
0

Add the following to /atg/rest/security/restSecurityConfiguration.xml

<resource component="/atg/userprofiling/ProfileFormHandler" secure="false">
        <method name="handleCreate" secure="false">
          <acl value="EVERYONE:read,write,execute" />
        </method>
        <property name="value.login" secure="false" />
        <property name="value.password" secure="false" />
    </resource>
Sammy
  • 4,538
  • 8
  • 33
  • 52