SOAPCLIENT

Hi Guys,

Please someone help me provide the revised code for this issue :

http://forums.alfresco.com/en/viewtopic.php?f=45&t=26137

Thanks
softblessAsked:
Who is Participating?
 
gazzzzzzerCommented:
Hi,

I have not had time to test this, but you want to do something like this:
<?php

    try
    {

	$securityHeaderParam = array('Username'=>'admin', 'Password'=>'admin');
	$headers = new SoapHeader('http://docs.oasis-open.org/ns/cmis/ws/200908/', 'UserCredentials', $securityHeaderParam);

       	$client = new SoapClient('http://cmis.alfresco.com/cmis/RepositoryService?wsdl');
	$client->__setSoapHeaders(array($headers)); 

       	$client->getRepositoryInfo('84ccfe80-b325-4d79-ab4d-080a4bdd045b');

       	echo 'Request :<pre>'.htmlspecialchars($client->__getLastRequest());
       	echo '</pre>Response:<pre>'.htmlspecialchars($client->__getLastResponse()) . '</pre>';
    }
    catch (SoapFault $e)
    {
       echo '<p>Fault String: ' . $e->faultstring . '<p>';
       echo '<p>Fault Code: ' . $e->faultcode . '<p>';
    }

?>

Open in new window


The main points to remember, are to add the user credentials to the soap header .

line 6 defines the user credentials.
line 7 adds the credentials to a new soap header object.
line 10 adds the header to the soap client, which will then be included in the future function calls
0
 
softblessAuthor Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.