powered by Jive Software

Help on registration attributes

i got stuck whn i try to edit my registration attributes

and to view them…

here is how i edit my registration…


map = new HashMap();

map.put(“first”,jTextField2.getText() );

map.put(“last”, jTextField3.getText() );

map.put(“email”,jTextField4.getText() );

map.put(“city”, jTextField6.getText() );

map.put(“state”, jTextField5.getText() );

// map.put(“zip”, zip);

map.put(“phone”, jTextField7.getText() );

// map.put(“url”, url);

// map.put(“date”, date);

map.put(“text”, jTextArea1.getText() );

// am.createAccount(connection. )



re=new Registration ();


//re.setTo(connection.getHost() );

// System.out.println(connection.getHost());

re.setFrom(connection.getUser() );


}catch(Exception ex){

System.out.println(ex.toString() );


the problem is that i dont see nothing when i read my registration attributes…


Every time you send an IQ packet (e.g. Registration) you need to specify the packet’‘s type. If you don’‘t specify a type Smack will assume that it’'s of type GET.

Looking at your code I see that you need to: 1) set the registration’'s type to SET and 2) set the TO of the registration.

Code sample below:

Registration reg = new Registration();


– Gato

first of all thanks…

the get type helped…

but there is a nother problem…

when i set the attributes… i set in the keys:

first name,last,country,city,e mail and further more.

but when i read my attributes from the server in the xml i see that only the e mail key that i set was stored…

the server doesn’'t send me all the keys that i set…

it only returns the keys:… password,username,and e mail

(which i set)…

can any 1 help me???


AFAIK, different hosts may require different fields for registration. You can send an IQ packet like this to check the registration fields from the host.

<iq type=''get'' id=''reg1''>
  <query xmlns=''jabber:iq:register''/>

I suspect that in your case your host will only require username, password and email. May be this is the reason why your other attributes got lost.

FYI, these are the fields defined in the ‘‘jabber:iq:register’’ namespace: registered, instructions, username, nick, password, name, first, last, email, address, city, state, zip, phone, url, date, misc, text, key. One problem I saw in your post is that you are using not supported fields (e.g. country).

We are now implementing forms in Smack so if when you request the registration fields from your host you are receiving a form (’‘jabber:x:data’’ namespace), you may then try to register filling out the form. Unfortunately, this feature is not available yet.


– Gato

when i first load my details window… i use this…


re=new Registration ();

re.setType(IQ.Type.GET );

re.setFrom(connection.getUser() );


and when i recive the packet from the server


Registration re=(Registration)p;

map= re.getAttributes();

System.out.println(map.get(“first”).toString() );

System.out.println(map.get(“last”).toString() );

but the problem is that when i load this details window

and send the ‘‘get’’ packet

i dont see nothing in the output of the packet proccess.

but when i press on a ‘‘set’’ button i send a ‘‘set’’ packet with my attributes… and then in the paketlistener i get the attributes… on the output…

meaning:… if i dont send a ‘‘set’’ packet the server doesnt keep my attributes…

but after i send a ‘‘set’’ packet… then i get the atributes in the listener…

may b some 1 can send me an example how he manganged the attributes…?? please???

i need it very urgent…


You can try to open a debugger window in order to find out the exact packets that you are sending and receiving. You should see something like this:

  1. You Request Registration Fields from Host (sending)
<iq type=''get'' id=''reg1''>
  <query xmlns=''jabber:iq:register''/>

2.1 If you have never registered before (receiving)

<iq type=''result'' id=''reg1''>
  <query xmlns=''jabber:iq:register''>
      Choose a username and password for use with this service.       Please also provide your email address.

2.2 If you were registered before (receiving)

<iq type=''result'' id=''reg1''>
  <query xmlns=''jabber:iq:register''>

If you were registered before and you are receiving a packet of form 2.1 (and not 2.2) then your XMPP server is not following the specification. You can learn about the spec in this link http://www.jabber.org/jeps/jep-0077.html.


– Gato


I am trying to build my own higher level class library using smack so that i can easily IM a user at an MSN IM account.

I have gotten a basic IM to a jabber user working fine, but when i try to send it to an MSN user, it doesn’‘t work, but doesn’'t give me any errors either…

Do I have to register a gateway for this? And if so, do i then have to register the gateway every time I run an application that wants to do this?




Yes, you’'ll have to register with the Gateway before sending messages or presence through the gateway. Follow this link http://www.jabber.org/jeps/jep-0100.html to learn how to communicate with an MSN IM account.

Currently Smack does not support “Gateway Interactions” but we may support it in the future. However, let us know if you need further help.


– Gato