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();
reg.setType(IQ.Type.SET);
reg.setTo(connection.getHost());
reg.setAttributes(...);
...
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.
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.
2.1 If you have never registered before (receiving)
<iq type=''result'' id=''reg1''>
<query xmlns=''jabber:iq:register''>
<instructions>
Choose a username and password for use with this service. Please also provide your email address.
</instructions>
<username/>
<password/>
<email/>
</query>
</iq>
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.
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.