Authenticate using webservice

I am trying to include a XMPP service to mi API using Openfire, but wanted to know if I can use an existing webservice to authenticate existent and new users. Is it possible? Anyone have any examples?

Thanks

ps: Sorry about my English