Fatal error: throw exception SoapFault: [soap: Client]

Hi I have a problem with my payment gateway when work ends on the gateway and it returns to this file, encoding below

Blockquote

include("app/config.php"); $db_connect = mysql_connect($AppConfig['db']['host'],$AppConfig['db']['user'],$AppConfig['db']['password']); mysql_select_db($AppConfig['db']['database'], $db_connect); $rest=mysql_query("SELECT * FROM p_players WHERE player_type=2" ); $rowa = mysql_fetch_assoc($rest); $nameadmin=$rowa['name']; $idadmin=$rowa['id']; // Form Content echo '<html dir="rtl"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <style> .title { height:30px; } input { font-family:tahoma; } </style> </head> <body style="font-family:tahoma;line-height:30px">'; //echo $this->package['cost'].'--'.$AppConfig['plus']['packages'][0]['cost']; // echo $st[1]; // echo $AppConfig['plus']['payments']['paypal']['merchant_id']; if(isset($_POST['status']) && $_POST['status'] == 100){ $Resnumber = $_POST['resnumber']; $Refnumber = $_POST['refnumber']; $info = split("_",$Resnumber,2); $UID = $info[0]; $PgID = $info[1]; $MerchantID = $AppConfig['plus']['payments']['paypal']['merchant_id']; $Password = $AppConfig['plus']['payments']['paypal']['key']; $Price = $AppConfig['plus']['packages'][$PgID]['cost']; $client = new SoapClient('http://merchant.parspal.com/WebService.asmx?wsdl'); $res = $client->VerifyPayment(array("MerchantID" => $MerchantID , "Password" =>$Password , "Price" =>$Price,"RefNum" =>$Refnumber )); $Status = $res->verifyPaymentResult->ResultStatus; $PayPrice = $res->verifyPaymentResult->PayementedPrice; if($Status == 'success')// Your Peyment Code Only This Event { $result = mysql_query("SELECT * FROM p_players WHERE id='$UID'"); while($row = mysql_fetch_array($result)){ $idplayer=$row['id']; $nameplayer=$row['name']; $goldb=$AppConfig['plus']['packages'][$PgID]['gold']; $subject="خريد با موفقيت"; $sendsms="خريد شما با موفقيت انجام شد و تعداد $goldb طلا به حسابتان واريز گرديد . با تشکر از خريدتان - شماره رسيد پرداخت $Refnumber"; $Codemaker=rand(10000,200000000); $goldenb=0; mysql_query("UPDATE p_players SET gold_num = gold_num + '$goldb',new_mail_count=new_mail_count+1,codemaker='$Codemaker',goldb='$goldenb' where id='$idplayer' ") or die(mysql_error()); mysql_query("INSERT INTO `p_msgs` (`from_player_id`, `to_player_id`, `from_player_name`, `to_player_name`, `msg_title`, `msg_body`, `creation_date`, `is_readed`, `delete_status`) VALUES( '$idadmin', '$idplayer', '$nameadmin', '$nameplayer', '$subject', '$sendsms', now(), 0, 0)"); } echo '<div style="color:green"> بازگشت از عمليات پرداخت، با موفقيت انجام شد. <br /> شماره رسيد : '.$_POST['refnumber'].' <br/> <a href="http://'.$_SERVER['SERVER_NAME'].'">مشاهده سايت</a></div>'; exit(); } else { echo '<div style="color:red"> شماره رسيد صحيح نمي باشد . '.$Status.' <br /> شماره رسيد : '.$_POST['refnumber'].' <br/> <a href="http://'.$_SERVER['SERVER_NAME'].'">مشاهده سايت</a></div>'; exit(); } } if(isset($_POST['status'])){ echo '<div style="color:red"> بازگشت از عمليات پرداخت، خطا در انجام عمليات پرداخت ( پرداخت ناموق ) ! <br /> <a href="http://'.$_SERVER['SERVER_NAME'].'">مشاهده سايت </a></div>'; exit(); } echo '</body> </html>'; ?> enter code here 

I ran into this next error

Fatal error: throw exception SoapFault: [soap: Client] Server could not read the request. ---> There is an error in the XML document (2, 235). ---> The input string was not in the correct format. at / home / travianx / public _html / ts1 / parspal.php: 53 Stack trace: # 0 / home / travianx / public_html / ts1 / parspal.php (53): SoapClient → __ call ('VerifyPayment', Array) # 1 /home/travianx/public_html/ts1/parspal.php(53): SoapClient-> VerifyPayment (Array) # 2 {main} is thrown in / home / travianx / public _html / ts1 / parspal.php on line 53

I turn to my payment support, and they said that I should provide access to this: http://merchant.parspal.com/WebService.asmx?wsdl

And I did not find out how and what they say! please, help! I have vps and cpanel installed on it

+4
source share
2 answers

You need to catch Soap client errors, they usually return much more formatted ones:

 try{ $client = new SoapClient('http://merchant.parspal.com/WebService.asmx?wsdl'); $res = $client->VerifyPayment(array("MerchantID" => $MerchantID , "Password" =>$Password , "Price" =>$Price,"RefNum" =>$Refnumber )); }catch (SoapFault $e){ print_r($client); // or other error handling } 
+7
source

I solve this problem, only need to avoid spaces at the end of your webservice php code

 <?php .. (my php webservice) .. (some code) .. $server->service($POST_DATA); exit(); ?>**(here have an space or enter who cause this problem)** 
-1
source

All Articles