May not solve your problem but where you have:
SOAP::Data->name("username" =>'$username'),
SOAP::Data->name("password" => '$password')
is not doing what you want - the single quotes mean that the text '$username' is passed in literally when you want the actual values passed - just remove the quotes:
SOAP::Data->name("username" => $username ),
SOAP::Data->name("password" => $password )
In fact you don't need the quotes on the left side either so this works too:
SOAP::Data->name( username => $username ),
SOAP::Data->name( password => $password )