ASU Web Community

FAR Web Service

Wednesday, October 17th, 2007 - 3:19 pm
  • bbailey1
  • bbailey1's picture

Does anyone have some sample PHP code for making a call to the FAR Web Service?

Thursday, October 18th, 2007 - 11:35 am
  • bbailey1
  • bbailey1's picture

I figured out the code to pull data from FAR. if anyone needs it, let me know and I will post it.

Thursday, October 18th, 2007 - 1:35 pm
  • ngudmuns
  • ngudmuns's picture

That's great! Can you post the code for others to view?

Thursday, October 18th, 2007 - 2:30 pm
  • bbailey1
  • bbailey1's picture

First download the nuSOAP package from: http://sourceforge.net/project/showfiles.php?group_id=57663

here is the php code

/**

* Calling to the FAR for personal info

*/

require_once('nusoap.php');

$wsdl = "https://far.asu.edu/FAR-WS/GetPersonalContactInfo.asmx?WSDL";

$client = new soapclient($wsdl, true);

$err = $client->getError();

if ($err) {

// Display the error

echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';

// At this point, you know the call that follows will fail

}

$proxy = $client->getProxy();

// set the asuriteid you want to search - this is set to search for Joan Brett

asuriteid = "jbrett";

$params = array("asuriteID" => $asuriteid);|

$result = $proxy->v1($params);

if ($client->fault) {

echo '<h2>Fault</h2><pre>';

print_r($result);

echo '</pre>';

} else {

// Check for errors

$err = $client->getError();

if ($err) {

// Display the error

echo '<h2>Error</h2><pre>' . $err . '</pre>';

} else {

// Display the result

echo '<h2>Result</h2><pre>';

print_r($result);

echo '</pre>';

}

}

/***** end of code **/

This will give you the following output:

Result

Array

(

[v1Result] => Array

(

[Name] => Array

(

[Prefix] =>

[FirstName] => Joan

[PreferredFirstName] =>

[MiddleName] => F

[LastName] => Brett

[Suffix] =>

[FullName] => Joan F Brett

[ReverseFullName] => Brett, Joan F

)

[AlternativeNames] =>

[EmailAddress] => Joan.Brett@asu.edu

[OfficeInfo] => Array

(

[Campus] => West

[Building] => FAB

[RoomNumber] => S301

[Phone] => (602) 543-4507

)

[OfficeHours] =>

[ResearchLabInfo] => Array

(

[Campus] =>

[Building] =>

[RoomNumber] =>

[Phone] =>

)

)

)

That's all there is to it