Can't change attributes on existing account

Hello,

I’m using Smack to connect to an Openfire server. I want to be able to change the attributes of an account when logged into it. I’ve seen some code snippets using the Registration packet, but haven’t gotten any to work (for example, the code below). Nothing changes on the server.

AccountManager am = Conn.getAccountManager();
Collection<String> c = am.getAccountAttributes(); Map<String,String> map = new HashMap<String,String>();
for (String key : c) {
     map.put(key, am.getAccountAttribute(key));
} map.put("name","TestName"); Registraion reg = new Registration();
reg.setType(IQ.Type.SET);
reg.setFrom(connection.getUser());
reg.setTo(connection.getHost());
reg.setAttributes(map);
connection.sendPacket(reg);

I have been able to create accounts with attributes though, with

connection.getAccountManager().createAccount(username, password, map);