SOAP PHP Examples

From Suntel Communications knowledgebase

Jump to: navigation, search
Class CreateAPN{
      var $ApnName;
      function __construct( $ApnName = NULL ){
          if( $ApnName === NULL ){
              return NULL;
          }
          $this->ApnName = $ApnName;
      }
}
$SoapClient = SoapClient( "http://yourhostname/file.wsdl" );
$result = $SoapClient->CreateAPN( new CreateAPN( "$YourApnName" ) );
if( $result->StatusCode == 0 ){
     // Success
}else{
      //Error
}

$SoapClient = SoapClient( "http://yourhostname/file.wsdl" );
$result = $SoapClient->ListApn();
if( $result->StatusCode == 0 ){
      $array = explode ( ';', $result->ApnLists );
      foreach($array as $Apns){
         echo $Apns;
      }
}else{
      //Error
}

Class DeleteApn{
   var $ApnName;
   function __construct($name){
      $this->ApnName = $name
   }
}
$SoapClient = SoapClient( "http://yourhostname/file.wsdl" );
$result = $SoapClient->DeleteApn( new DeleteApn( "$YourApnName" ) );
if( $result->StatusCode == 0 ){
      //Success
}else{
      //Error
}

Class ChangePassword{
   var $ApnName;
   var $MSISDN;
   var Password;
   function __construct($name,$number,$passwd){
      $this->ApnName = $name;
      $this->MSISDN = $number;
      $this->Password = $passwd;
   }
}
$SoapClient = SoapClient( "http://yourhostname/file.wsdl" );
$result = $SoapClient->ChangePassword( new ChangePassword( "$YourApnName", "$YourMSISDNNumber", "$YourPassword" ) );
if( $result->StatusCode == 0 ){
      //Success
}else{
      //Error
}

Class DeleteMSISDN{
   var $ApnName;
   var $MSISDN;
   function __construct($name,$number){
      $this->ApnName = $name;
      $this->MSISDN = $number;
   }
}
$SoapClient = SoapClient( "http://yourhostname/file.wsdl" );
$result = $SoapClient->DeleteMSISDN( new DeleteMSISDN( "$YourApnName", "$YourMSISDNNumber" ) );
if( $result->StatusCode == 0 ){
      //Success
}else{
      //Error
}

Class CreateIpPool{
    var $ApnName;
    var $PoolName;
    var $PoolBeginAddr; 
    var $PoolEndAddr;
     function __construct($name,$poolname, $beginaddr, $endaddr){
      $this->ApnName = $name;
      $this->PoolName = $poolname;
      $this->PoolBeginAddr = $beginaddr;
      $this->PoolEndAddr = $endaddr;
   }
 }
$SoapClient = SoapClient( "http://yourhostname/file.wsdl" );
$result = $SoapClient->CreateIpPool( new CreateIpPool( "$YourApnName", "$YourName", "$YourPoolBeginAddress", "$YourPoolEndAddress") );
if( $result->StatusCode == 0 ){
      //Success
}else{
      //Error
}
Personal tools