Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The call to CurrentBalance will return an XML packet with an integer value in it. This integer is your current balance which is decremented by 1 every time you use an address validation.

Program Examples

C#

WebReference.Postman1 pm = new WebReference.Postman1();
string MyID = pm.SetLogin("username", "password");
// set login and get the id
WebReference.POSTmanAddressRecord adr;
adr = pm.ScanAddress(MyID, "1 fake st", "", "", "", "",
"Brisbane", "qld", "6000", "Australia");
// scan address
if(!adr.IsValidAddress)
{
// if the address is not valid
WebReference.POSTmanAddressRecord[] adr2;
adr2 = pm.NearMatches(MyID, 10);
// nearest matches
}
int i = pm.CurrentBalance(MyID);
// check the balance

PHP

The following small example is developed by using PHP 5.2.6
(http://www.php.net/downloads.php) and NuSoap 0.7.3
(http://sourceforge.net/projects/nusoap/);

<html>
<head>
</head>
<body>
<title>Webservice PHP Invocation Testing</title>
<?php
//include NuSoap
require_once('lib/nusoap.php');
echo '<p>Hello DMS WS PHP Invocation Testing</p>';
//Soap call
$client = new
soapclient('http://webservice.dmsw.com.au/postman/postman1.asmx?wsdl', 'wsdl');
//Error handling
$err = $client->getError();
if ($err) {
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}
echo '<p>Retrieve current balance:</p>';
//Stored input parameters in an array
$aryPara = array('myUsername'=>'UserName', 'myPassword'=>'PassWord');
// Call webmethod -- SetLogin of DMS webservice and retrieve a loginGUID
$loginGUID = $client->call('SetLogin',$aryPara);
//Call webmethod - CurrentBalance of DMS webservice
$CurrentBalancearry = array('sessionID'=>($loginGUID['SetLoginResult']));
$aryResult = $client->call('CurrentBalance', $CurrentBalancearry);
//print result
print_r($aryResult);
echo '<p>Address validation testing:</p>';
//stored input parameters in an array NOTICE: sessionID is not 'null' now, the value of
loginGUID should be set to sessionID
$aryAddr = array('sessionID'=> ($loginGUID['SetLoginResult']),'address1'=>' Park
Road ','address2'=> null,'address3'=>
null,'suburb'=>'milton','state'=>'qld','postcode'=>'4030','mixedCase'=>
true,'ExpandAbbreviations'=> true);

//Call webmethod -- ScanAddress2 of DMS webservice
$record = $client->call('ScanAddress2',$aryAddr);


//Error handling
if ($client->fault) {
echo '<h2>Fault</h2><pre>';
print_r($record);
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 'Result:<br>';
//Print results
while (list($key,$value) = each($record['ScanAddress2Result'])) {
echo "$key : $value<br>";}
echo '</pre>';
}
echo '<p>-----------------</p>';
}
?>
</body>
</html>


If the login details are correct, the result will be similar to this:

Hello WS PHP Invocation Testing

Retrieve current balance:

Array ( [CurrentBalanceResult] => XXXXX ) //XXXXX denotes user's credit

Address validation testing:


Result:
Address1 : Park Road
Address2 :
Address3 :
Address4 :
Address5 :
Address6 :
Suburb : MILTON
State : QLD
PostalCode : 4030
StatusCode : -30
StatusDescription : No matching street address locality
IsStreetAddress : true
IsValidAddress : false
IsCorrectedAddress : false
DPID : 0
BSP :
Barcode :
BSPName :
BSPState :
PrimaryPointFlag : 0
Property1 :
Property2 :
PropertyName :

SortDestination :
LevelNo :
LevelType :
LotNo :
ThoroughfareName : Park
ThoroughfareType :
ThoroughfareTypeSuffix :
UnitNo :
UnitType :
StreetNumber : Lot
ThoroughfareNo1 : 0
ThoroughfareNo1Suffix :
ThoroughfareNo2 : 0
ThoroughfareNo2Suffix :
POBoxNo : 0
POBoxNoPrefix :
POBoxNoSuffix :
POBoxType :
NonAddressData :
CareOfData :
OriginalAddressData : Array
LastError : 0
LastErrorDescription :