آگاه‌سازی‌ها
پاک‌کردن همه

خطای Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL

4 ارسال ها
2 کاربران
0 Likes
146 نمایش‌
(@maryameasypack)
ارسال‌: 2
New Member
شروع کننده موضوع
 

سلام وقت بخیر

من این ارور رو میگیرم.

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://192.168.1.100/services/api/iUser.svc?wsdl' : failed to load external entity "http://192.168.1.100/services/api/iUser.svc?wsdl" in /home/easypackblog/public_html/syncUsers.php:18 Stack trace: #0 /home/easypackblog/public_html/syncUsers.php(18): SoapClient->SoapClient('http://192.168....') #1 /home/easypackblog/public_html/syncUsers.php(74): syncUsers->__construct('admin', 'admin', 'http://192.168....') #2 {main} thrown in /home/easypackblog/public_html/syncUsers.php on line 18

 

 

کدمم هم اینه:

require_once(/*dirname(__FILE__, 2) .*/ 'wp-load.php');
class syncUsers{
public $soapClient;
public $params;
public function __construct($username,$password,$crmAddr)
{
$url = $crmAddr.'/services/api/iUser.svc?wsdl';

$this->soapClient = new SoapClient( $url );
$this->params = array(
'username' => $username,
'password' => $password
);
}

public function getAllUsersOfCrm(){
try
{
$Result = $this->soapClient->GetUserList($this->params);
// Checked that the operation was successful or not.
if ($Result->UserInfoResult->Success)
{
//echo json_encode($Result, JSON_UNESCAPED_UNICODE);
return $Result->UserInfoResult->Users;
}
else {
echo 'error in getAllUsersOfCrm: '.$Result->UserInfoResult->Message;
exit();
}
}
catch ( Exception $e )
{
// Print exception message
echo 'exception in getAllUsersOfCrm: '.$e->getMessage();
}
}

public function userExistsInWebsite($phonenumber){
$user = get_user_by( 'login', $phonenumber );
if($user)
return true;
else
return false;
}
public function createUserInWebsite($UserInfoItem){
$IdentityId=$UserInfoItem->IdentityId;
$Email=$UserInfoItem->Email;
$Username=$UserInfoItem->Username;

$random_password = wp_generate_password( 12 );
$user_id = wp_create_user( $Username, $random_password, $Email );

if ( is_wp_error( $user_id ) ) {
update_user_meta( $user_id, 'userIdentityId', $IdentityId );
echo $user_id->get_error_message();
}
else {
echo 'User with username: '.$Username.' has been created.'.'</br>';
}
}
}

$sync_user=new syncUsers('admin','admin','http://192.168.1.100');

$crmUsers=$sync_user->getAllUsersOfCrm();

foreach ($crmUsers as $UserInfoItem){
$userPhoneNumberInCrm=$UserInfoItem->Username;
if(!$sync_user->userExistsInWebsite($userPhoneNumberInCrm)){
$sync_user->createUserInWebsite($UserInfoItem);
}
}

 
ارسال‌شده : 13 دی 1402 10:45 ق.ظ
PG-Admin
(@a-heidariyan)
ارسال‌: 1165
Illustrious Member Admin
 

با سلام وقت شما هم بخیر باشه

این مشکل مربوط به عدم وجود تنظیمات مربوط به ssl هست

https://stackoverflow.com/a/28611495

 
ارسال‌شده : 23 دی 1402 2:52 ب.ظ
(@maryameasypack)
ارسال‌: 2
New Member
شروع کننده موضوع
 

ارسال‌شده توسط: @maryameasypack

سلام وقت بخیر

من این ارور رو میگیرم.

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://192.168.1.100/services/api/iUser.svc?wsdl' : failed to load external entity "http://192.168.1.100/services/api/iUser.svc?wsdl" in /home/easypackblog/public_html/syncUsers.php:18 Stack trace: #0 /home/easypackblog/public_html/syncUsers.php(18): SoapClient->SoapClient('http://192.168....') #1 /home/easypackblog/public_html/syncUsers.php(74): syncUsers->__construct('admin', 'admin', 'http://192.168....') #2 {main} thrown in /home/easypackblog/public_html/syncUsers.php on line 18

 

 

کدمم هم اینه:

require_once(/*dirname(__FILE__, 2) .*/ 'wp-load.php');
class syncUsers{
public $soapClient;
public $params;
public function __construct($username,$password,$crmAddr)
{
$url = $crmAddr.'/services/api/iUser.svc?wsdl';

$this->soapClient = new SoapClient( $url );
$this->params = array(
'username' => $username,
'password' => $password
);
}

public function getAllUsersOfCrm(){
try
{
$Result = $this->soapClient->GetUserList($this->params);
// Checked that the operation was successful or not.
if ($Result->UserInfoResult->Success)
{
//echo json_encode($Result, JSON_UNESCAPED_UNICODE);
return $Result->UserInfoResult->Users;
}
else {
echo 'error in getAllUsersOfCrm: '.$Result->UserInfoResult->Message;
exit();
}
}
catch ( Exception $e )
{
// Print exception message
echo 'exception in getAllUsersOfCrm: '.$e->getMessage();
}
}

public function userExistsInWebsite($phonenumber){
$user = get_user_by( 'login', $phonenumber );
if($user)
return true;
else
return false;
}
public function createUserInWebsite($UserInfoItem){
$IdentityId=$UserInfoItem->IdentityId;
$Email=$UserInfoItem->Email;
$Username=$UserInfoItem->Username;

$random_password = wp_generate_password( 12 );
$user_id = wp_create_user( $Username, $random_password, $Email );

if ( is_wp_error( $user_id ) ) {
update_user_meta( $user_id, 'userIdentityId', $IdentityId );
echo $user_id->get_error_message();
}
else {
echo 'User with username: '.$Username.' has been created.'.'</br>';
}
}
}

$sync_user=new syncUsers('?','?','?');

$crmUsers=$sync_user->getAllUsersOfCrm();

foreach ($crmUsers as $UserInfoItem){
$userPhoneNumberInCrm=$UserInfoItem->Username;
if(!$sync_user->userExistsInWebsite($userPhoneNumberInCrm)){
$sync_user->createUserInWebsite($UserInfoItem);
}
}

 

 
ارسال‌شده : 24 دی 1402 3:36 ب.ظ
PG-Admin
(@a-heidariyan)
ارسال‌: 1165
Illustrious Member Admin
 

با سلام وقت شما هم بخیر باشه

این مشکل مربوط به عدم وجود تنظیمات مربوط به ssl هست

https://stackoverflow.com/a/28611495

 
ارسال‌شده : 26 دی 1402 12:33 ق.ظ
اشتراک:
پیمایش به بالا