I have to call a web service inside a while loop to submit several records from a database. The problem is that only the first record is postet. Seems that the webservice call makes terminate the while loop and the other records are not fetched anymore. The webservice call itself is correct. Someone can help me please ?
Here is the code :
error_reporting(E_ALL ^ E_NOTICE);
include("include/dbConn.php");
$client = new SoapClient("myservice.asmx?wsdl",array(
'exceptions'=>true,
'cache_wsdl'=>WSDL_CACHE_NONE,
'features' =>SOAP_WAIT_ONE_WAY_CALLS,
'encoding'=>'utf-8'));
$Context =array(
"B1DBName" => "TestDB",
"B1DefaultPriceListNumber" => "1",
"B1UKStandardVatCode" => "O1",
);
$strSql="select * from custom_clients_insert_view";
$result = mysqli_query($conn,$strSql) or die("MySQL error: " . mysqli_error($conn) . "<hr>
Query: $strSql");
while($row = mysqli_fetch_array($result))
{
$Cust =array(
"CardCode" => "",
"WebPassword" => "",
"EmailAddress" => $row['email'],
"Title" => "",
"FirstName" => $row['b_firstname'],
"Surname" => $row['b_lastname'],
"Telephone" => $row['b_phone'],
"WebID" => $row['user_id'],
"VATNumber" => "",
"FaxNumber" => $row['fax'],
"Telephone2" => "",
"Organisation" => "",
"MobilePhone" => ""
);
$params = array(
'Context' => $Context,
'WebsiteName' => "test2",
'Cust' => $Cust,
'ActiveCust' => true
);
try
{
$result = $client->SubmitNewCustomerToB1($params);
var_dump($result);
echo "<br><br> VALUE:" . $result->SubmitNewCustomerToB1Result;
/* do something on my log */
}
catch (Exception $e)
{
echo "Error!<br />";
echo $e -> getMessage ();
var_dump($result);
echo "<br><br> VALUE:" . $result->SubmitNewCustomerToB1Result;
/* do something on my log*/
}
}