PHP SOAP with Crowd WSDL

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Taqui
Forum Newbie
Posts: 4
Joined: Mon Sep 29, 2014 5:15 am

PHP SOAP with Crowd WSDL

Post by Taqui »

I am trying to get in SSO Functionality of Crowd in my custom php Application. For which i intend to use SOAP to authenticate application and user and many more things which can be done in crowd.
The problem is i am new to php and i think ust knowing the basics leads me to nowhere.

At first i am tring to run the below program and the following error i am getting, i dont know what is going wrong with it but i am unable to acheive what i intend to.

Code: Select all

		 		$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);
and the error i am getting is :banghead:

atal error: Uncaught SoapFault exception: [soap:Server] app in /var/www/html/soaptest.php:7 Stack trace: #0 /var/www/html/soaptest.php(7): SoapClient->__call('authenticateApp...', Array) #1 /var/www/html/soaptest.php(7): SoapClient->authenticateApplication(Array) #2 /var/www/html/soaptest.php(12): authenticateApplication() #3 {main} thrown in /var/www/html/soaptest.php on line 7
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: PHP SOAP with Crowd WSDL

Post by Celauran »

They have a REST API; why are you using SOAP?
Taqui
Forum Newbie
Posts: 4
Joined: Mon Sep 29, 2014 5:15 am

Re: PHP SOAP with Crowd WSDL

Post by Taqui »

As i am new to this webservices, I have browsed online and though that talking to wsdl will be more convienient than other option.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: PHP SOAP with Crowd WSDL

Post by Celauran »

REST API will be infinitely less frustrating to use. It's cleaner, for one, and nobody has used SOAP in years, so getting help will also be easier.
Taqui
Forum Newbie
Posts: 4
Joined: Mon Sep 29, 2014 5:15 am

Re: PHP SOAP with Crowd WSDL

Post by Taqui »

That was comforting. Can you help me out with the rest. I have surfed and found out that the curl should be used to communicate with application. Can you give me some documentation for how to use php with curl and rest api
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: PHP SOAP with Crowd WSDL

Post by Celauran »

I'd recommend using Guzzle over writing the cURL calls yourself. It's cURL under the hood, but nicely abstracted.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: PHP SOAP with Crowd WSDL

Post by Celauran »

If you want to use raw cURL, though, it's quite well documented.
Taqui
Forum Newbie
Posts: 4
Joined: Mon Sep 29, 2014 5:15 am

Re: PHP SOAP with Crowd WSDL

Post by Taqui »

Thank you very much. Will surely bother you if have some problems in the pursuit.
Post Reply