How to add a friend with xiff?

Hello,I’m a new developper in openfire.i want to add a friend with xiff . Can u give me some help?

This example is abour Roster that takes care of “friends” in XMPP:

The example only handles incoming requests but it hopefully gives you an idea of how to send them as well.