Pusat Yabancı wrote: > Merhaba, > Aşağıda wsdl2php (http://www.urdalen.no/wsdl2php/) ile yaratmış > olduğum bir SOAP kütüphanesi mevcut. Bu kütüphaneyi nasıl kullancağım > hakkında en ufak bir fikrim yok. Bu konuda bana yardımcı olabilecek > bir arkadaşımız mevcut mu? > Saygılar. > <?php > class startMobilePax { > public $merchantid; // int > public $username; // string > public $password; // string > public $gsmno; // string > public $paymenttype; // int > public $chargingunit; // string > public $chargingvalue; // double > public $productDescription; // string > } > > class startMobilePaxResponse { > public $startMobilePaxResult; // MobilePaxReturn > } > > class MobilePaxReturn { > public $status; // string > public $errcode; // string > public $transactionid; // string > } > > class mobilepax extends SoapClient { > > private static $classmap = array( > 'startMobilePax' => 'startMobilePax', > 'startMobilePaxResponse' => > 'startMobilePaxResponse', > 'MobilePaxReturn' => 'MobilePaxReturn', > ); > > public function mobilepax($wsdl = > "http://api.mobilepax.com/mobilepax.asmx?wsdl", $options = array()) { > foreach(self::$classmap as $key => $value) { > if(!isset($options['classmap'][$key])) { > $options['classmap'][$key] = $value; > } > } > parent::__construct($wsdl, $options); > } > > public function startMobilePax(startMobilePax $parameters) { > return $this->__soapCall('startMobilePax', array($parameters), > array( > 'uri' => 'http://mobilepax.com/', > 'soapaction' => '' > ) > ); > } > > } > > ?> > > Ben, bunu kullanamadığım için webde bulduğum bir kaç örnek ile hareket > ederek aşağıdaki şekilde bir şey yaptım ancak onda da maalesef > başarılı olamadım. Şifreler test amacıyla şirket tarafıından > verilmiştir. Bununla beraber gelen bir asp kullanım örneği mevcut > ondan da maalesef hiç bir şey anlamadım. Yardımlarınızı bekliyorum. > <?php > $client = new SoapClient("http://api.mobilepax.com/mobilepax.asmx?wsdl"); > > $sample_add = array( > "merchantid" => 1, > "username" => mobiltim, > "password" => mobiltim1000, > "gsmno" => 5321234567, > "paymenttype" => TL, > "chargingunit" => TL, > "chargingvalue" => 0.1, > "productDescription" => Urun25, > ); > > $odemedurum = $client->startMobilePax->$sample_add; > > if ($odemedurum =='11'){ > echo 'Web servisine boş alan gönderilemez'; > } > else if ($odemedurum =='12'){ > echo 'Hatalı merchantid, username veya password'; > } > else if ($odemedurum =='13'){ > echo 'Charging value bir seferde izin verilen değerden > fazla'; > } > else if ($odemedurum =='14'){ > echo 'HproductDescription 50 karakterden büyük'; > } > else if ($odemedurum =='15'){ > echo 'chargingunit SMS veya TL girilebilir'; > } > else if ($odemedurum =='99'){ > echo 'sistem hatası. Tanımlanamayan hata'; > } > else { > > } > ?> > _______________________________________________ > Linux-programlama mailing list > Linux-programlama@liste.linux.org.tr > https://liste.linux.org.tr/mailman/listinfo/linux-programlama > Liste kurallari: http://liste.linux.org.tr/kurallar.php > Aslında sorununuzu (sanırım) aşağıdaki şekilde çözebilirsiniz. Arkadaşlar farklı bir örnek de verebilirler. Aslında bu konuda ben de oldukça yeniyim bir arkadaş çıkıp da Soap ve PHP olayını biraz anlatsa fena olmaz :) php.net üzerinde örnekler mevcut ancak pek de bilgilendirici düzeyde değil. Örneğin bu örnekte alınan ya da basılan XML verisi nasıl daha iyi basılabilir v.s..
<?php $inputdata = '<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <startMobilePax xmlns="http://mobilepax.com/"> <merchantid>1</merchantid> <username>mobiltim</username> <password>mobiltim1000</password> <gsmno>5548322122</gsmno> <paymenttype>2</paymenttype> <chargingunit>TL</chargingunit> <chargingvalue>0.01</chargingvalue> <productDescription>Urun</productDescription> </startMobilePax> </soap:Body> </soap:Envelope>'; print_r(xmlPost($inputdata)); function xmlPost($xml){ $ch = curl_init("http://api.mobilepax.com/mobilepax.asmx?wsdl"); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml')); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); curl_close($ch); switch ($data){ case '01': return 'GIRIS YAPILAMADI'; break; case '02': return 'YETERSIZ KREDI'; break; case '03': return 'GSM NO GIRINIZ'; break; case '08': return 'GECERSIZ XML DATASI'; break; } $xml = @simplexml_load_string($inputdata); if($xml){ return $xml; } else { return $data; } } ?> _______________________________________________ Linux-programlama mailing list Linux-programlama@liste.linux.org.tr https://liste.linux.org.tr/mailman/listinfo/linux-programlama Liste kurallari: http://liste.linux.org.tr/kurallar.php