Calling the GetCustomerProfile Webservice:
[PHP]
<?php
//GetCustomerProfile
$wsdlURL = "http://www.worldcard.com.my/MerchantV4/wcservices.asmx?WSDL";
require_once('nusoap.php');
// set the URL or path to the WSDL document
$wsdl = "http://www.worldcard.com.my/MerchantV4/wcservices.asmx?WSDL";
// instantiate the SOAP client object
$soap = new soapclient($wsdl,"wsdl");
$soap->useHTTPPersistentConnection();
$parameters['parameters']['AppID'] = "GWCBIZPORTAL";
$parameters['parameters']['UserID'] = "NZN_WEB";
$parameters['parameters']['Password'] = "ABC123";
$parameters['parameters']['CustomerID'] = "0154677957";
$result = $soap->call("GetCustomerProfile", $parameters);
if($error = $soap->getError()){ die($error);}
// Not sure about how to read the array results
$collrecord = $result["GetCustomerProfileResult"];
// this part also not working
foreach ($collrecord["OutputParams"] as $record){
echo "<br>Name: ".$record["CustomerName"];
echo "<br>Email: ".$record["EmailAddress"];
}
echo "<pre>" . print_r($result) . "</pre>";
?>[/PHP]
Now the Result returned as:
Expand|Select|Wrap|Line Numbers
- <br>Name: 1<br>Email: 1<br>Name: <br>Email: <br>Name: <br>Email: <br>Name: <br>Email: <br>Name: [<br>Email: [<br>Name: M<br>Email: M<br>Name: T<br>Email: T<br>Name: M<br>Email: M<br>Name: 0<br>Email: 0<br>Name: D<br>Email: D<br>Name: I<br>Email: I<br>Name: M<br>Email: M<br>Name: 0<br>Email: 0<br>Name: 0<br>Email: 0<br>Name: 0<br>Email: 0<br>Name: R<br>Email: R<br>Name: 0<br>Email: 0<br>Name: 0<br>Email: 0<br>Name: 0<br>Email: 0<br>Name: 0<br>Email: 0<br>Name: E<br>Email: E<br>Name: w<br>Email: w<br>Name: R<br>Email: R<br>Name: 0<br>Email: 0<br>Name: 2<br>Email: 2<br>Name: 0<br>Email: 0<br>Name: 0<br>Email: 0<br>Name: <br>Email: Array
- (
- [GetCustomerProfileResult] => Array
- (
- [OutputParams] => Array
- (
- [CustomerID] => 154677957
- [PreferenceFlags] => Array
- (
- [PreferenceFlag] => Array
- (
- [0] => Array
- (
- [Name] => CB
- [Value] => DCX
- )
- [1] => Array
- (
- [Name] => EMA
- [Value] => Y
- )
- [2] => Array
- (
- [Name] => HP
- [Value] =>
- )
- [3] => Array
- (
- [Name] => LP
- [Value] => E
- )
- [4] => Array
- (
- [Name] => PIN
- [Value] => Y
- )
- [5] => Array
- (
- [Name] => SMS
- [Value] => Y
- )
- )
- )
- [Telephones] => Array
- (
- [Telephone] => Array
- (
- [TelDescription] => HOME
- [TelNumber] => 12345
- [BestNumberFlag] => 1
- )
- )
- [Addresses] => Array
- (
- [Address] => Array
- (
- [AddressDescription] => HOME
- [Address1] => aaa
- [Address2] => bbb
- [Address3] => ccc
- [City] =>
- [State] =>
- [Country] => MALAYSIA
- [PostCode] =>
- [CorrespondenceFlag] => 1
- )
- )
- [CustomerName] => [TESTING] WEIS IA2
- [CustomerTitle] => MR
- [CustomerTypeCode] => TEST
- [Gender] => M
- [BusinessEmployer] => 0
- [ICPassportNo] => DCX-1001
- [ICPassportType] => I
- [ICPassportCountry] => MALAYSIA
- [CompOverDraftLimit] => 0
- [CustEntryDeposit] => 0
- [RecordActualFlag] => 0
- [NotesComments] => RWB PREPAID DINING CARD ONSITE ISSUANCE
- [NotesCommentsBufferSize] => 0
- [TelephoneStatus] => 0
- [AddressStatus] => 0
- [EmailStatus] => 0
- [PreferredLanguage] => EN
- [EmailAddress] => wsooi@genting.com.my
- [CustomerCurrency] => RM
- [PrincipalCustomerID] => 0
- [DateOfBirth] => 28/12/1975
- [ReturnCode] => 0
- [ErrorCode] => 0
- [ErrorDescription] =>
- )
- )
- )
- <pre>1</pre>
- I noticed the $result inside pre printed as 1.
- Another Issue is it takes a load of time to call the webservice.
Any help will be highly appreciated. Thanks in Advance