-
-
Save tomflanagan/9c08567da6b78fb230aa to your computer and use it in GitHub Desktop.
Example of extending wsclient.
This file contains hidden or 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 | |
function sap_soap_menu() { | |
$items['sap/getusers'] = array( | |
'page callback' => 'sap_soap_users', | |
'access arguments' => array('access content'), | |
'type' => MENU_NORMAL_ITEM, | |
); | |
return $items; | |
} | |
function sap_soap_users() { | |
$parameters = array( | |
'Iname' => 'chenx', | |
'TAppuser' => array( | |
'Mandt' => '700', | |
'UserId' => '5094', | |
'UserName' => 'chenxh5094', | |
'Age' => '' | |
), | |
); | |
$return = ''; | |
$service = wsclient_service_load('sap_user_get'); | |
$result = $service->ZRemotingAppuser($parameters); | |
print_r($result); | |
foreach($result as $r) { | |
foreach ($r->item as $item) { | |
$return .= $item->UserName .'<br />'; | |
} | |
} | |
//$res = print_r($result); | |
return $return; | |
} | |
/** | |
* Implements hook_wsclient_endpoint_types. | |
*/ | |
function sap_soap_wsclient_endpoint_types() { | |
//die('test'); | |
return array( | |
'tomsoap' => array( | |
'label' => t('Tom SOAP'), | |
'class' => 'SAPSOAPEndpoint', | |
), | |
); | |
} | |
/** | |
* A remote endpoint type for invoking SOAP services. | |
*/ | |
class SAPSOAPEndpoint extends WSClientSOAPEndpoint { | |
public function client() { | |
$this->client = parent::client(); | |
$this->client->__setLocation('the_correct_address'); | |
return $this->client; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment