简体   繁体   English

带有wsdl人群的PHP肥皂

[英]PHP Soap with Crowd wsdl

I am trying to write a code for sso login with crowd in my custom php application. 我正在尝试在我的自定义php应用程序中编写与人群进行sso登录的代码。 I trying to to do that with SOAP. 我试图用SOAP做到这一点。 I am in a early stage now and was going through the documentation of how to connect php soap with wsdl. 我现在还处于早期阶段,正在阅读有关如何将php soap与wsdl连接的文档。 But i seem to be stuck very deep as i dont know what should be done next. 但是我似乎深陷其中,因为我不知道下一步该怎么做。

<?php
 class test {
        function authenticateApplication()
        {
            $client = new SoapClient("http://localhost:8095/crowd/services/SecurityServer?wsdl");
            $param = array('in0' => array('credential' => 'password','name' => 'app'));
            $resp=$client->authenticateApplication($param);
            $token = $resp->out->token;
            print_r($resp);
        }
    }
     $t= new test;
     $t->authenticateApplication();

I Dont know whats wrong with this code. 我不知道这段代码有什么问题。 I have referred it online and it seems to be correct but when i am tring to run this program i am getting this error 我已经在网上提到了它,这似乎是正确的,但是当我尝试运行此程序时,却出现了此错误

Fatal error: Uncaught SoapFault exception: [soap:Client] The validated object is null in /var/www/html/badebade/soaptest.php:7 Stack trace: #0 /var/www/html/badebade/soaptest.php(7): SoapClient->__call('authenticateApp...', Array) #1 /var/www/html/badebade/soaptest.php(7): SoapClient->authenticateApplication(Array) #2 /var/www/html/badebade/soaptest.php(13): test->authenticateApplication() #3 {main} thrown in /var/www/html/badebade/soaptest.php on line 7

A little help will be much appreciated as this program authenticates the application in crowd wsdl and returns the token. 由于此程序在人群wsdl中对应用程序进行身份验证并返回令牌,因此将为您提供一点帮助。 Can someone help me to achieve it. 有人可以帮我实现它。

function Find($request) {
try {
    $soapClient = new SoapClient('wsdl.wsdl', array('trace' => 1));
    $results = $soapClient->authenticateApplication($request);
    return $results;
}
catch(SoapFault $ex) {
    print $ex->getMessage();
    echo '<HR>';
    print $ex->getTraceAsString();
    echo '<HR>';
    echo $ex->getLine();

}

} }

$results = Find($params); $ results = Find($ params);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM