How to register a new user with XIFF?

Would someone please provide some sample code for registering a user with XIFF 3? I must be doing something wrong. If in the sample code you can go into the connection part as well as the getting registration fields and setting them. Thanks.

Nevermind, I was able to get it working.

Can you share how you solved this?