in reply to SOAP::Lite and getting error "not well-formed (invalid token)"

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 )

Replies are listed 'Best First'.
Re^2: SOAP::Lite and getting error "not well-formed (invalid token)"
by NetWallah (Canon) on Dec 10, 2015 at 00:08 UTC
    The OP's output shows that this, in fact, is a problem (May not be the only one), since it contains the strings $username and $password:
    ...<username xsi:type="xsd:string">$username</username> <password xsi:type="xsd:string">$password

            Our business is run on trust. We trust you will pay in advance.