PHP SOAP打印xml
如何在调用soap调用之前打印它的xml 从我看到的情况来看,您需要修改dorequest函数,但这样做后,您会得到“SoapClient::\uu dorequest()返回的非字符串值” 这是密码PHP SOAP打印xml,php,Php,如何在调用soap调用之前打印它的xml 从我看到的情况来看,您需要修改dorequest函数,但这样做后,您会得到“SoapClient::\uu dorequest()返回的非字符串值” 这是密码 public function __doRequest($request, $location, $action, $version, $one_way=0) { var_dump( $request); } 我已经使用了nuSoap调用Web服务。它可以像soap调用一样工作,我希望这对您有所
public function __doRequest($request, $location, $action, $version, $one_way=0) {
var_dump( $request);
}
我已经使用了nuSoap调用Web服务。它可以像soap调用一样工作,我希望这对您有所帮助。这是我使用的代码
$param = array('strUsuario' => $credentials['username'],
'strPassword' => $credentials['password'],
);
$client = new nusoap_client('http://www.byte-factory.com/fidelizacion/webservice/v1/cfidelizacion.asmx?WSDL','WSDL');
$client->setCredentials($credentials['username'], $credentials['password'], 'digest');
$result = $client->call('IniciarSesion', array('parameters' => $param), '', '', false, true);
if ($client->fault) {
echo '<h2>Fault</h2><pre>';
print_r($result);
echo '</pre>';
} else {
$err = $client->getError(); // Check for errors
if ($err) {
echo '<h2>Error</h2><pre>' . $err . '</pre>'; // Display the error
} else {
echo '<h2>Result</h2><pre>'; // Display the result
print_r($result['IniciarSesionResult']);
echo '</pre>';
}
}
// Display the request and response
echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
// Display the debug messages
echo '<h2>Debug</h2>';
echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
$param=array('strUsuario'=>$credentials['username'],
'strPassword'=>$credentials['password'],
);
$client=新nusoap_客户机($client)http://www.byte-factory.com/fidelizacion/webservice/v1/cfidelizacion.asmx?WSDL","WSDL",;
$client->setCredentials($credentials['username'],$credentials['password'],'digest');
$result=$client->call('INIARSESION',array('parameters'=>$param),'',false,true);
如果($client->fault){
回声“故障”;
打印(结果);
回声';
}否则{
$err=$client->getError();//检查错误
如果($err){
回显“Error”。$err.';//显示错误
}否则{
echo'Result';//显示结果
打印($result['iniassessionresult']);
回声';
}
}
//显示请求和响应
回应“请求”;
回显“”。htmlspecialchars($client->request,ENT_QUOTES)。”;
回应"回应",;
回显“”。htmlspecialchars($client->response,ENT_QUOTES)。”;
//显示调试消息
回声“调试”;
回显“”。htmlspecialchars($client->debug_str,ENT_QUOTES)。”;
Awsum的东西,但它没有显示所有的XML,只是显示了一点,然后说-。。。(length=822)如何让它显示所有xml?我假设您使用的是xdebug
,它正在修改var\u dump()
函数。请看这里:刚刚检查了my.ini,它没有激活,你认为它是.ini文件中的一个设置吗?你是如何检查的?您确定您检查了正确的php.ini
?是的,它必须在活动的php.ini
中的某个地方引用。PHP的常规var_dump()
根本不限制显示的数据。您正在浏览器中查看它,浏览器将SOAP消息解释为HTML。如果右键单击->查看源代码,您应该会看到完整的消息。
$param = array('strUsuario' => $credentials['username'],
'strPassword' => $credentials['password'],
);
$client = new nusoap_client('http://www.byte-factory.com/fidelizacion/webservice/v1/cfidelizacion.asmx?WSDL','WSDL');
$client->setCredentials($credentials['username'], $credentials['password'], 'digest');
$result = $client->call('IniciarSesion', array('parameters' => $param), '', '', false, true);
if ($client->fault) {
echo '<h2>Fault</h2><pre>';
print_r($result);
echo '</pre>';
} else {
$err = $client->getError(); // Check for errors
if ($err) {
echo '<h2>Error</h2><pre>' . $err . '</pre>'; // Display the error
} else {
echo '<h2>Result</h2><pre>'; // Display the result
print_r($result['IniciarSesionResult']);
echo '</pre>';
}
}
// Display the request and response
echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
// Display the debug messages
echo '<h2>Debug</h2>';
echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';