views:

240

answers:

0

I'm doing an XML RPC call in ASP.net with c# and the call returns an Array called userinfo with strings and integers in it and I can't seem to figure out how to parse the data and put it into string and int objects... The only thing that compiles is if I make it an Object in the struct. The int returns fines and is referenced easily.

Any help would be appreciated - this is what I got.

public Page_Load(object sender, EventArgs e){
    IValidateSSO proxy = XmlRpcProxyGen.Create<IValidateSSO>();
    UserInfoSSOValue ret2 = proxy.UserInfoSSO(ssoAuth, ssoValue);
    int i = ret2.isonid;

}

public struct UserInfoSSOValue
{
    public Object userinfo;
    public int isonid;
}


[XmlRpcUrl("host")]
public interface IValidateSSO : IXmlRpcProxy
{

    [XmlRpcMethod("sso.session_userinfo")]
    UserInfoSSOValue UserInfoSSO(string ssoauth, string sid);
}

Here is what the xml rpc calls returns (I know it's in php... I'm trying to implement in c#):

sso.session_userinfo(string $ssoauth, string $sid)

string $ssoauth - authentication string (assigned by ONID support)
string $sid - sid to get info on
Returns:

Array
    (
        [userinfo] => Array  
            (
                [lastname] => College  
                [expire_time] => 1118688011
                [osuuid] => 12345678901  
                [sid_length] => 3600  
                [ip] => 10.0.0.1  
                [sid] => WiT7ppAEUKS3rJ2lNz3Ue64sGPxnnLL0  
                [username] => collegej  
                [firstname] => Joe  
                [fullname] => College, Joe Student  
                [email] => [email protected]  
                [create_time] => 1118684410  
             )  

        [isonid] => 1  
    )  
array userinfo - array containing basic user information

Here is how is was intially implemented in php:

$conf = sso_config();
if ($conf['sso_cookie'] && !empty($_COOKIE[$conf['sso_cookie']])) {
    $sid = $_COOKIE[$conf['sso_cookie']];
    $ssoauth = $conf['sso_service'] . ":" . $conf['sso_password'];

    $message = new XML_RPC_Message('sso.session_userinfo',
                array(new XML_RPC_Value($ssoauth, 'string'),
                    new XML_RPC_Value($sid, 'string')));

    $server = new XML_RPC_Client($conf['sso_path'], "https://$conf[sso_host]");
    $result = $server->send($message, 0);

    if (is_object($result) && ($result->faultCode() === 0)) {
        $info = XML_RPC_decode($result->value());
        return $info;
    }
}

$info = array();
return $info;