Last active
December 29, 2021 05:59
-
-
Save angelochillemix/b67e973d76fa4834775426270e327860 to your computer and use it in GitHub Desktop.
Loads PMI members list of a PMI Chapter using DEPService web service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Loads PMI members list of a PMI Chapter using DEPService web service | |
* | |
* @link https://components.pmi.org/UI/HelpDocs/HowToUseCS.pdf Component System User Guide | |
* @return stdClass the SOAP object returned by the web service | |
* | |
* SOAP output | |
* | |
* stdClass Object | |
* ( | |
* [Message] => | |
* [ServiceErrorMessageId] => | |
* [Success] => true | |
* [ExtractFile] => { CSV-like list of members } | |
* CSV Header | |
* "ID","FullName","Prefix","FirstName","LastName","Suffix","Designation","NickName","NameType","WTitle","WCompany","WAddress1","WAddress2","WAddress3","WCity","WState","WZip","WCountry","WPhone","WPhoneExt","WFax","WEmail","HTitle","HCompany","HAddress1","HAddress2","HAddress3","HCity","HState","HZip","HCountry","HPhone","HPhoneExt","HFax","HEmail","Title","Company","Address1","Address2","Address3","City","State","Zip","Country","Phone","PhoneExt","Fax","Email","PrefMailAddr","PMPNumber","PMPDate","PMIJoinDate","PMIExpirationDate","Chapters","ChapterCount","SIGs","SIGsCount","IndustryCodes","IndustryCodeCount","OccupationCodes","OccupationCount","JoinDate","ExpirationDate","MemberClass","MemberGroup","MbrGroup","Directory","MailingList","RecordEdited","SortKey","PrefPhone","DataDate","PMIAutoRenewStatus","ChapterAutoRenewStatus","MobileTelephone" | |
* | |
* [LastRun] => 2021-12-28T05:23:26.707+00:00 | |
* [MemberCount] => 100 | |
* ) | |
* | |
*/ | |
private function load_pmi_members_list_with_web_service() | |
{ | |
$endpoint_url = 'https://svc.pmi.org/DEPServices/services/DEP.svc'; | |
$method_name = 'GetMemberExtractReport'; | |
$service_name = 'DEPService'; | |
$username = self::DEP_API_USERNAME; | |
$password = self::DEP_API_PASSWORD; | |
$method_namespace = 'http://svc.pmi.org/2011/01/15'; | |
$auth_namespace = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'; | |
$token = new stdClass; | |
$token->Username = new SoapVar($username, XSD_STRING, null, null, null, $auth_namespace); | |
$token->Password = new SoapVar($password, XSD_STRING, null, null, null, $auth_namespace); | |
$wsec = new stdClass; | |
$wsec->UsernameToken = new SoapVar($token, SOAP_ENC_OBJECT, null, null, null, $auth_namespace); | |
$auth_header = new SoapHeader($auth_namespace, 'Security', $wsec, true); | |
$array_options = array( | |
'soap_version' => SOAP_1_1, | |
'trace' => 1, // DEBUG | |
'exceptions' => true, // DEBUG | |
'cache_wsdl' => WSDL_CACHE_NONE, | |
'features' => SOAP_SINGLE_ELEMENT_ARRAYS, | |
'location' => $endpoint_url, | |
'uri' => $method_namespace | |
); | |
$soap_client = new SoapClient(NULL, $array_options); | |
$soap_client->__setSoapHeaders(array($auth_header)); | |
try { | |
//Build method call | |
$arguments = array(); | |
$action = array( | |
'soapaction' => "$method_namespace/$service_name/$method_name", | |
'uri' => $method_namespace | |
); | |
$result = $soap_client->__soapCall($method_name, $arguments, $action); | |
return $result; | |
} catch (SoapFault $fault) { | |
throw $fault; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment