2016-11-24 97 views
0

我嘗試創建一個nusoap客戶端和一個nusoap服務器。我有2個操作宣佈,但只有一個作品。Nusoap php響應沒有類型

有我的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 

此代碼返回:

而且

響應不是text/xml:text/html; charset = UTF-8

第一個操作很好,但第二個我總是得到這個錯誤。

回答

0

我解決了這個問題。

我在函數「responseIncidencia」中遇到了一個內部問題,而SOAP嘗試返回一個PDOException。然後客戶端重新解析一個錯誤。