- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
尝试使用 soap 服务将数据发送到 sql 数据库。但我的网站只加载 30 秒后出现此错误:
Warning: Uncaught SoapFault exception: [HTTP] Error Fetching http headers in soapclient.php Stack trace: #0
[internal function]: SoapClient->__doRequest('__call('addUser', Array) #2 {main} thrown in soapclient.php
Fatal error: Maximum execution time of 30 seconds exceeded in soapclient.php on line 30
SOAP 客户端
<?php
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$username = $_POST['username'];
$password = md5($_POST['password']);
$options = array('location' => "http://localhost/fellotest/soap/soap_client.php",
'uri' => 'http://localhost',
'trace'=>1);
ini_set('default_socket_timeout', 120)
try{
$client = new SoapClient(null, $options);
$client->addUser($first_name, $last_name, $username, $password);
}
catch(SoapFault $ex){
echo "FAULT </br>";
var_dump($client->__getLastRequest());
var_dump($client->__getLastResponse());
var_dump($ex);
}
?>
SOAP 服务器
<?php
include('helpers\security.php');
include('includes\shared\ez_sql_core.php');
include('includes\mysqli\ez_sql_mysqli.php');
// Setting up Soap Service
$options = array('uri' => 'http://localhost');
$server = new SoapServer(null, $options)
//connecting and adding a user to database
function addUser($first_name, $last_name, $username, $password){
// For security reasons
$info = new security();
// Connect to database
$db = new ezSQL_mysqli($info::$user, $info::$password, $info::$dbName, $info::$host);
if(!$db){
die('Could not connect to database');
}
// add user to database
$insert = $db->query("INSERT INTO `user`(`first_name`, `last_name`, `username`, `password`) VALUES ('$first_name', '$last_name', '$username', '$password')");
if(!$insert){
echo "Error while registering";
}
else{
echo "Register Successful";
}
}
// To handle client
$server->handle();
?>
似乎有一些进程陷入了无限循环之类的。但我不知道是什么或在哪里!
最佳答案
既然我们知道问题出在 addUser 函数中,那么让我们从了解问题出在哪里开始。
@SoapServer.php替换:
// To handle client
$server->handle();
与:
$server->addFunction("addUser");
try {
$server->handle();
}
catch (Exception $e) {
$server->fault('Sender', $e->getMessage());
}
此外,在这两个文件中,向本地主机 uri 添加一个斜杠。
更新 1:
注释掉函数中的所有 block 代码。所以只有:
function addUser($first_name, $last_name, $username, $password){
return 1;
}
更新 2:
由于您仍然收到错误,请注释掉这些行:
include('helpers\security.php');
include('includes\shared\ez_sql_core.php');
include('includes\mysqli\ez_sql_mysqli.php');
更新 3:
仍然出现错误,SOAPSERVER 的路径错误或已关闭。在 soapclient.php
中考虑以下内容:
// Add another option to the array.
$options = array( .... .....,
'connection_timeout' => 300);
//Cache
ini_set('soap.wsdl_cache_enabled',0);
ini_set('soap.wsdl_cache_ttl',0);
//And also increase the default_socket_timeout.
ini_set('default_socket_timeout', 300)
关于php - 网站需要永远加载然后我得到 "Uncaught SoapFault exception",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41924810/
我试图从 PHP SoapServer 返回一个 SoapFault,但我坚持创建正确的响应格式。 处理异常时,我返回: $detail = "message"; return new SoapFau
我是 android 的初学者,这里我有使用网络服务的 Activity : SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
我得到了这个我不明白的 SoapFault。调用下面的函数 codewordStemExists(),应该会创建一个连接到已启动并正在运行的 SoapServer 的 SoapClient(没有从服务
我是 PHP 异常处理和 SOAP 的新手。出于某种原因,我无法捕捉到 SoapFault。我不知道为什么。 soap 服务器不是我的。 try { $contact_id = $objSoa
我正在尝试获取此 soap 错误的“详细信息”中的值,但我还没有找到任何方法。 服务器响应: SOAP-ENV:Client Many Erro
我正在将我的 Android 代码与 Webservice 连接以检索数据。我总是得到: SoapFault - faultcode: 'a:InternalServiceFault' faults
运行两个服务器,服务器 1:是一个 Soap 客户端,服务器 2:是一个 Soap 服务器 我从服务器 1 向服务器 2 发送一个信封,其中包含以下参数: client_hash(字符串),唯一代码(
我目前正在尝试使用 php-ews,但是我不知道 soap 有一些问题,下面是错误。 Fatal error: Uncaught SoapFault exception: [VersionMismat
我正在连接到网络服务以获取一些数据。我有大约 20 万个作业的请求队列,一个工作人员正在处理它。处理时间为每秒 2-3 次调用。在大约 500-1000 次调用后,它开始收到 SoapFault 异常
我正在创建一个 WCF web 服务,它的请求/响应应该只签名。 为此,我在 ServiceContract 属性上设置了 ProtectionLevel = ProtectionLevel.Sign
假设我的文件中有以下 xml 负载 ns2:Server some Error 04 SimiError 如何将其解码到 Soap
尝试使用 soap 服务将数据发送到 sql 数据库。但我的网站只加载 30 秒后出现此错误: Warning: Uncaught SoapFault exception: [HTTP] Error
我可以在 Savon 日志中看到我的 SOAP 错误包含如下 XML: 666some evil error 有谁知道如何从响应中解析错误代码和描述?很抱歉,如果这是一个愚蠢的问题,但我已经尝试了所有
为什么我可以设置一个faulString,但不能在SOAPFault 中设置一个自定义错误代码?当我抛出异常时,文本“Code X”没有出现在 SoapFaultException 中。有人能告诉我为
我的 SOAP 解决方案出现问题。有时我会收到以下错误消息: Function (functionA) is not a valid method for this service 8 个月后编辑虽然
有时无法调用网络服务。 这个问题一直都在发生。 可能是什么问题? Error: SoapFault exception: [HTTP] Could not connect to host in
我要集成 eway token 支付集成,但我正面临这个问题。 SoapFault exception: [HTTP] Bad Request wsdl文件在这里 https://www.eway.c
我在 java 中使用 axis2 创建了用于将两个数字相乘的 web 服务.. wsdl文件是 - Please Type your service description here -
我们的java应用程序使用glassfish 2.1作为服务器,我将ear文件部署到glassfish上并使用soapUI发送请求,并期望在响应中返回soapFault。但我得到了“HTTP Stat
我正在尝试提取 Web 服务的soapFault 响应的错误代码和错误消息,但收到 ClasscasrException : 下面是网络服务响应: 2015-
我是一名优秀的程序员,十分优秀!