Web services and openssl

Hello!

I am using web service and I have a function like this inside web service:

encrypt($stringtoencrypt){

openssl_private_encrypt($stringtoencrypt, $crypted, $key);

return $crypted;

}

Above function is soap declaration - parameter string and return string.

When I call that function, it returns null. Encryption works, I checked that. Problem is in returning crypted value and I dont know how to solve that.

Please help!