I am working with WSDL for my web services. So, I created a WSDL page and add a function. This function is, connect my table and return JSON value. When I call this function other PHP page, I take successful my values.
[{"ID":"1","Number":"1"}]
But, when I call this function in my WSDL page, I get it:
[{"ID":"1","Number":"1","}]
And this my function in WSDL:
public function A($a1,$a2,$a3,$o1)
{
include "../conf/database.php";
$SQL = "SELECT * FROM table_users";
$SQLResult=mysqli_query($conn,$SQL);
while($row=mysqli_fetch_assoc($SQLResult))
{
$JSON[] = $row;
}
return json_encode($JSON,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_HEX_QUOT | JSON_HEX_APOS);
}
I found a lot of solutions, but it didn't work. I try preg_replace, replace but I can't. How I solve this problem?
My WSDL PHP Page:
<?php
require_once "lib/nusoap.php";
$JSON= array();
public function A($a1,$a2,$a3,$o1)
{
include "../conf/database.php";
$SQL = "SELECT * FROM table_users";
$SQLResult=mysqli_query($conn,$SQL);
while($row=mysqli_fetch_assoc($SQLResult))
{
$JSON[] = $row;
}
return json_encode($JSON,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_HEX_QUOT | JSON_HEX_APOS);
}
$server = new soap_server();
$server->configureWSDL("TryFunc", "MyURL");
$server->wsdl->addComplexType('A',
'complexType',
'struct',
'all',
'',
array(
'a1' => array('name' => 'a1', 'type' => 'xsd:string'),
'a2' => array('name' => 'a2', 'type' => 'xsd:string'),
'a3' => array('name' => 'a3', 'type' => 'xsd:int'),
'o1' => array('name' => 'o1', 'type' => 'xsd:string'),
)
);
$server->register('A',
array('a1' => 'xsd:string', 'a2' => "xsd:string",'a3' => "xsd:int",'o1' => "xsd:string"),
array("return" => "xsd:string"),
"",
"",
"rcp",
"encoded",
"document");
@$server->service(file_get_contents("php://input"));