我尝试创建一个nusoap客户端和一个nusoap服务器。我宣布了2个操作,但只有一个工作。
有我的server_soap代码;
$servidor = new nusoap_server();
$ns = "urn:AvertisWebService";
$servidor->configureWSDL("AvertisWebService",$ns);
$servidor->wsdl->schemaTargetNamespace = $ns;
$servidor->register(
"responseCorrecto",
array("numeroIN" => "xsd:Integer"),
array("return" => "xsd:Integer"), $ns);
$servidor->register(
"responseIncidencia",
array("incNomb" => "xsd:String",
"incTelf" => "xsd:String",
"incNif" => "xsd:String",
"incMun" => "xsd:String",
"incLoc" => "xsd:String",
"incCalle" => "xsd:String",
"incCp" => "xsd:String",
"incCordX" => "xsd:String",
"incCordY" => "xsd:String",
"incText" => "xsd:String"),
array("return" => "xsd:Integer"), $ns);
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : "";
$servidor->service($HTTP_RAW_POST_DATA);
function responseIncidencia(
$incNomb, $incTelf, $incNif, $incMun, $incLoc,
$incCalle, $incCp, $incCordX, $incCordY, $incText
){ [...]
我可以在哪里打电话给我的服务器:
include_once "lib/nusoap/nusoap.php";
include_once "lib/cargadorConf.php";
$conf = new cargadorCONF();
$cliente = new nusoap_client($conf->CONF["webServiceUrl"],true);
$param = array("numeroIN" => 5);
$resultado = ($cliente->call("responseCorrecto", $param));
echo $resultado; //Must be 50
$param = array(
"incNomb" => "javier", "incTelf" => "645876321" , "incNif" => "1254789" ,
"incMun" => "municipio" , "incLoc" => "localidad" , "incCalle" => "calle" ,
"incCp" => "36544" , "incCordX" => "1.2334" , "incCordY" => "-3.56634" , "incText" => "Hola Mundo");
$resultado = ($cliente->call("responseIncidencia", $param));
echo "resultado= ".$resultado;
echo $resultado; //Must be 1
此代码返回:
50
和
不是text / xml类型的响应:text / html;字符集= UTF-8
第一个操作正常,但第二个操作总是出现此错误。
答案 0 :(得分:0)
我解决了这个问题。
我在函数“responseIncidencia”中遇到内部问题,SOAP尝试返回PDOException。然后客户端在解析时重新发出错误。