如何用oauth调用函数SOAP?

时间:2015-04-27 07:10:24

标签: php codeigniter soap oauth

我想用oauth使用soap客户端调用一个函数。我有一个消费者密钥然后我生成时间戳,随机数和签名..

当我跑步时,我收到错误

  

“Undefined property:SoapFault :: $ CreateWebUserResult”

这是我的代码:

function index(){
    $this->url = 'location?wsdl';
    $param = $this->expURL();
    $context = array('http' =>
        array(
            'header'  => 'Authorization: OAuth 
                oauth_nonce="'.$param['nonce'].'",
                oauth_timestamp="'.$param['timeStamp'].'",
                oauth_version="'.$param['version'].'",
                oauth_signature_method="'.$param['signatureMethod'].'",
                oauth_consumer_key="'.$param['consumerKey'].'",
                oauth_signature="'.$param['signature'].'"',
            'method' => 'GET'
        )
    );

    try{
        $client = new SoapClient($this->url,array(
        'stream_context'=>stream_context_create($context), "trace" => 1, "exceptions" => 0, "cache_wsdl" => 0));

        $input = array(
            "pUsername" => strval(''),
            "pPassword" => strval(''),
            "pEmail" => strval(''),
            "pIsApproved" => true
        );
        $result = json_decode($client->CreateWebUser($input)->CreateWebUserResult, true);
        print_r($client);

    }catch (SoapFault $e){
        var_dump($e);
    }
}

服务器中的Web服务使用.net ...所以,我使用流上下文在标题中传递oauth ..但它没有解决......请帮助我....

0 个答案:

没有答案