I’m trying to run a web service using PHP & SOAP, but all I’m getting so far is this:
(SoapFault)[2] message which states: ‘SOAP-ERROR: Parsing WSDL: Couldn’t load from ‘http://localhost/MyRegistration/login.xml’ : failed to load external entity «http://localhost/MyRegistration/login.xml»
I’ve tried changing localhost to 127.0.0.1, but that makes no difference. login is actually a wsdl file, but if I put login.wsdl in the SOAPClient constructor, it says «‘looks like we got no XML document'» instead.
Here is my code for the SOAP Client (register_client.php):
<?php
try
{
$sClient = new SoapClient('http://127.0.0.1/MyRegistration/login.wsdl');
$param1 = $_POST["regname"];
$param2 = $_POST["regpass1"];
$response = $sClient->loginVerify($param1, $param2);
var_dump($response);
}
catch(SoapFault $e)
{
var_dump($e);
}
?>
And here is the login.wsdl file:
<?xml version="1.0"?>
<definitions name="LoginVal"
targetNamespace="urn:LoginVal"
xmlns:tns="urn:LoginVal"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Login">
<xsd:element name="getName" type="xsd:string" />
<xsd:element name="getPass" type="xsd:string" />
<xsd:element name="LoginResponse" type="xsd:string" />
</xsd:schema>
</types>
<message name="loginVerify">
<part name="username" type="tns:getName" />
<part name="password" type="tns:getPass" />
</message>
<message name="doLoginResponse">
<part name="return" type="tns:LoginResponse" />
</message>
<portType name="LoginPort">
<operation name="loginVerify">
<input message="tns:loginVerify" />
<output message="tns:doLoginResponse" />
</operation>
</portType>
<binding name="LoginBinding" type="tns:LoginPort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="loginVerify">
<soap:operation soapAction="urn:LoginAction" />
<input>
<soap:body use="encoded" namespace="urn:Login" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="encoded" namespace="urn:Login" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding>
<service name="LoginService">
<port name="LoginPort" binding="tns:LoginBinding">
<soap:address location="http://localhost/MyRegistration/register.php" />
</port>
</service>
</definitions>
And I’m not sure if this is involved, so I’m providing the code for the SOAP Server register.php:
<?php
if(!extension_loaded("soap"))
{
dl("php_soap.dll");
}
ini_set("soap.wsdl_cache_enabled", "0");
$server = new SoapServer("login.wsdl", array('uri'=>'http://127.0.0.1/MyRegistration'))
public function loginVerify($username, $password)
{
if($_POST["regname"] && $_POST["regemail"] && $_POST["regpass1"] && $_POST["regpass2"] )
{
if($_POST["regpass1"] == $_POST["regpass2"])
{
$servername = "localhost";
$username = "root";
$password = "Hellfire";
$conn = mysql_connect($servername,$username,"Hellfire")or die(mysql_error());
mysql_select_db("soap",$conn);
$sql = "insert into users (name,email,password)values('$_POST[regname]','$_POST[regemail]','$_POST[regpass1]')";
$result = mysql_query($sql,$conn) or die(mysql_error());
return "You have registered sucessfully";
//print "<a href='index.php'>go to login page</a>";
}
else return "passwords dont match";
}
else return "invalid data";
}
$server->AddFunction("loginVerify");
$server->handle();
?>
I’m sorry if I’m giving unnecessary information, but I’m a complete novice at this — and I’d really appreciate it if someone could point out why exactly this SOAP Fault is being generated, and what I can do to rectify it.
I am using WAMP Server version 2.2, with mySQL 5.5.24 and PHP 5.3.13
I’m trying to get all products in $productArr
array from magento 2 API via SOAP client
. I tried the below function but it throws this error:
Error:
SOAP-ERROR: Parsing WSDL: Couldn’t load from
‘https://shop.mysite.com/soap/default?wsdl&services=catalogProductRepositoryV1’
: failed to load external entity
«https://shop.mysite.com/soap/default?wsdl&services=catalogProductRepositoryV1»
Code:
public function getMagentoProducts() {
$productArr = array('' => 'Select Product');
try {
$request = new SoapClient("https://shop.mysite.com/soap/?wsdl&services=integrationAdminTokenServiceV1", array("soap_version" => SOAP_1_2));
$token = $request->integrationAdminTokenServiceV1CreateAdminAccessToken(array("username"=>"user", "password"=>"pass"));
$opts = array(
'http'=>array(
'header' => 'Authorization: Bearer '.json_decode($token->result),
'user_agent' => 'PHPSoapClient'
),
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$wsdlUrl = 'https://shop.mysite.com/soap/default?wsdl&services=catalogProductRepositoryV1';
$context = stream_context_create($opts);
$soapClientOptions = array(
'stream_context' => $context,
'cache_wsdl' => WSDL_CACHE_NONE
);
libxml_disable_entity_loader(false);
$soapClient = new SoapClient($wsdlUrl, ['version' => SOAP_1_2, 'context' => $soapClientOptions]);
var_dump($soapClient);exit;
$soapResponse = $soapClient->__getFunctions();
} catch (Exception $e) {
$this->forward404($e->getMessage());
}
}
asked Jul 10, 2018 at 16:27
Iftikhar uddinIftikhar uddin
2031 gold badge2 silver badges12 bronze badges
If you are using a development site with an SSL that is not signed by a major CA, then when PHP goes to load external entities from your domain, your SSL certificate can cause this error.
I just had to add my root CA certificate that signed my SSL to the trusted roots of my server and the error went away.
For Ubuntu 16.04 I added the PEM version of my root CA to /usr/local/share/ca-certificates
then ran sudo update-ca-certificates
and it was added.
answered Jul 16, 2018 at 20:58
I made this error go away by enabling the php module openssl (Windows server)
answered Sep 29, 2021 at 11:48
0
Hello sir,
I have used this package but, I am getting above mentioned error when trying to launch it.It seems that there is some issue with my configurations.Could you please help me with this????
I think this issue could be, because Soap isnt sending the user_agent.
I tried to set the user agent in ->options but it still doesnt work.
Could you please tell us at least how you solved it?
solved !
I created this controller SoapController.php
<?php namespace AppHttpControllers; use ArtisaninwebSoapWrapperSoapWrapper; use AppSoapRequestGetConversionAmount; use AppSoapResponseGetConversionAmountResponse; class SoapController { /** * @var SoapWrapper */ protected $soapWrapper; /** * SoapController constructor. * * @param SoapWrapper $soapWrapper */ public function __construct(SoapWrapper $soapWrapper) { $this->soapWrapper = $soapWrapper; } /** * Use the SoapWrapper */ public function show() { $response = 'empty'; if(isset($this->soapWrapper)){ $this->soapWrapper->add('Currency', function ($service) { $service ->wsdl('http://currencyconverter.kowabunga.net/converter.asmx?WSDL') ->trace(true) ->options(['user-agent'=>'PHPSoapClient']) ->classmap([ GetConversionAmount::class, GetConversionAmountResponse::class, ]); }); $response = $this->soapWrapper->call('Currency.GetConversionAmount', [ new GetConversionAmount('USD', 'EUR', '2014-06-05', '1000') ]); } echo $response; } }
As the documentation mention I created the Request and Response PHP files
Request appSOAPRequest
<?php namespace AppSoapRequest; class GetConversionAmount { /** * @var string */ protected $CurrencyFrom; /** * @var string */ protected $CurrencyTo; /** * @var string */ protected $RateDate; /** * @var string */ protected $Amount; /** * GetConversionAmount constructor. * * @param string $CurrencyFrom * @param string $CurrencyTo * @param string $RateDate * @param string $Amount */ public function __construct($CurrencyFrom, $CurrencyTo, $RateDate, $Amount) { $this->CurrencyFrom = $CurrencyFrom; $this->CurrencyTo = $CurrencyTo; $this->RateDate = $RateDate; $this->Amount = $Amount; } /** * @return string */ public function getCurrencyFrom() { return $this->CurrencyFrom; } /** * @return string */ public function getCurrencyTo() { return $this->CurrencyTo; } /** * @return string */ public function getRateDate() { return $this->RateDate; } /** * @return string */ public function getAmount() { return $this->Amount; } }
Response appSOAPResponse
<?php namespace AppSoapResponse; class GetConversionAmountResponse { /** * @var string */ protected $GetConversionAmountResult; /** * GetConversionAmountResponse constructor. * * @param string */ public function __construct($GetConversionAmountResult) { $this->GetConversionAmountResult = $GetConversionAmountResult; } /** * @return string */ public function getGetConversionAmountResult() { return $this->GetConversionAmountResult; } }
Then i call it
Route::get('/soap',[SoapController::class, 'show']);
And I got this error too:
I really need to create a SOAP client, I need to create a SOAP client for a BizFlow POC
I founded a solution
Here is my controller
<?php namespace AppHttpControllers; use ArtisaninwebSoapWrapperSoapWrapper; use AppSoapRequestGetConversionAmount; use AppSoapResponseGetConversionAmountResponse; class SoapController { /** * @var SoapWrapper */ protected $soapWrapper; /** * SoapController constructor. * * @param SoapWrapper $soapWrapper */ public function __construct(SoapWrapper $soapWrapper) { $this->soapWrapper = $soapWrapper; } /** * Use the SoapWrapper */ public function show() { $response = 'empty'; $opts = array( 'http' => array( 'user_agent'=>'PHPSoapClient' ) ); $context=stream_context_create($opts); $wsdl='http://currencyconverter.kowabunga.net/converter.asmx?WSDL'; $o=array( 'stream_context'=>$context, 'cache_wsdl'=>WSDL_CACHE_NONE ); $a=$this->soapWrapper->add('servicio',function($service){ $service ->wsdl('http://currencyconverter.kowabunga.net/converter.asmx?WSDL') ->trace(true) ->options([ 'stream_context'=>stream_context_create([ 'http' => array( 'user_agent'=>'PHPSoapClient' ) ]), 'cache_wsdl'=>WSDL_CACHE_NONE ]); dump($service); }); $this->soapWrapper->client('servicio',function($client){ echo '<h3>Functions</h3>'; dump($client->getFunctions()); echo'<h3>call</h3>'; dump($client->call('GetCurrencies',[])); }); /* if(isset($this->soapWrapper)){ $this->soapWrapper->client(null,function($service){ $service ->wsdl('http://currencyconverter.kowabunga.net/converter.asmx?WSDL') ->options(['user-agent'=>'PHPSoapClient']); }); $this->soapWrapper->add('Currency', function ($service) { $service ->wsdl('http://currencyconverter.kowabunga.net/converter.asmx?WSDL') ->trace(true) ->options(['user-agent'=>'PHPSoapClient']) ->classmap([ GetConversionAmount::class, GetConversionAmountResponse::class, ]); }); //*$response = $this->soapWrapper->call('Currency.GetConversionAmount', [ new GetConversionAmount('USD', 'EUR', '2014-06-05', '1000') ]) }*/ echo $response; } }
And this is the invocation
You can close it!
The solution is in the options
$this->soapWrapper->add('servicio',function($service){ $service ->wsdl('http://currencyconverter.kowabunga.net/converter.asmx?WSDL') ->trace(true) ->options([ 'stream_context'=>stream_context_create([ 'http' => array( 'user_agent'=>'PHPSoapClient' ) ]), 'cache_wsdl'=>WSDL_CACHE_NONE ]); dump($service); });
За последние 24 часа нас посетили 11493 программиста и 1150 роботов. Сейчас ищут 180 программистов …
-
Sogno
Активный пользователь- С нами с:
- 20 июл 2012
- Сообщения:
- 7
- Симпатии:
- 0
Добрый день, уважаемые форумчане!
Уже третий день бьюсь над SOAP, весь нет перелопатила, не могу заставить его работать.
Давайте начну с описания системы: Windows XP, PHP 5.1.1 работает под IIS.
Стоит задача «дернуть» веб-сервис.
Код следующий и примитивен до безобразия:Данный код генерирует ошибку: На php.net нашла следующее:Вроде как симптомы мои
Что я сделала для подключения SOAP:
1. В php.ini подключила расширение:
extension=php_soap.dll
В папке с расширениями лежит соответствующая длл c:phpextensions php_soap.dll
2. Подключила php_curl.dll (в php.ini + файлы libeay32.dll и ssleay32.dll скопировала в системную папку c:WINDOWSsystem32 )
3. Подключила php_openssl.dll
4. Вроде как подключила libxml2.dll. Говорю «вроде» потому как там куча длл, и вменяемой инсрукции по установке под windows не нашла, только вот это, выполнила все шаги по инструкции:Кто-нибудь может подсказать, как проверить работоспособность libxml? Я до сих пор точно не уверена, нормально ли подключена библиотека.
Господа, буду всем благодарна за хоть какую-то помощь, потому как уже не знаю, что ещё попробовать и как заставить работать soap. -
Команда форума
Модератор- С нами с:
- 18 мар 2010
- Сообщения:
- 32.415
- Симпатии:
- 1.768
Привет, девушка! =)
а первую строчку ты разумно проигнорировала? искать проще там где светлее, а не там, где потеряла?
там тебе был дан ответ сервером: 401.
ошибки потом просто от того, что не удалось подключиться. -
Sogno
Активный пользователь- С нами с:
- 20 июл 2012
- Сообщения:
- 7
- Симпатии:
- 0
Ну не то, чтобы игнорировала…
Скорее не всё рассказала в своём письме.
Сперва я пыталась копать именно в сторону аутентификации.
Использовала для этого CURL:-
ini_set(«soap.wsdl_cache_enabled», «0»);
-
$wsdl_url=»http://dir/DataService.asmx?wsdl»;
-
$wsdl=file_get_contents_curl($wsdl_url);
-
$client = new SoapClient($wsdl);
-
function file_get_contents_curl($url) {
-
curl_setopt($ch, CURLOPT_HEADER, 0);
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser.
-
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
-
curl_setopt($ch, CURLOPT_USERPWD, ‘Login:Password’);
-
curl_setopt($ch, CURLOPT_URL, $url);
в итоге код даёт ошибку:
Причём переменная $wsdl содержит нужный мне wsdl-контент. Но soap его не съедает.
С этой ошибкой тоже не удалось сразиться. У меня лично вызывает сомнение, можно ли конструктору soap подсунуть контент wsdl, в то время как по мануалу нужен URI файла wsdl.
По-другому (кроме как с использованием curl) осуществить авторизованный вход не знаю как.
Может, кто-нибудь ещё что-то подскажет?Внимательнее прочитала мануал к SOAP и нашла способ использовать авторизацию без переподвыподвертов с curl:
-
$client = new SoapClient($wsdl_url, array(‘login’=>’Login’, ‘password’=>’Pass’));
в итоге имеем ошибку:
-
- С нами с:
- 2 июл 2011
- Сообщения:
- 4.074
- Симпатии:
- 7
Было тут у же про соап, не раз…
-
Команда форума
Модератор- С нами с:
- 18 мар 2010
- Сообщения:
- 32.415
- Симпатии:
- 1.768
курл тут при чем? тоже светлее было? (о_О)
курл при чем тут? =) по соапу подключаешься! -
Sogno
Активный пользователь- С нами с:
- 20 июл 2012
- Сообщения:
- 7
- Симпатии:
- 0
igordata, я ж объяснила, что курл использовала для авторизованного чтения контента по заданному урл, следом объяснила, что ошибалась и использовала тот же соап но с авторизацией.
К чему тут ваши издевательства? Если есть что сказать — то говорите прямо и без издевёк, а если нечего, то не тролльте и не тратьте ни своё ни моё время. -
Команда форума
Модератор- С нами с:
- 18 мар 2010
- Сообщения:
- 32.415
- Симпатии:
- 1.768
так у вас оно работает или не работает? вы можете привести корректный код и нормальные, вызванные не черезжопным программированием, ошибки?
-
Sogno
Активный пользователь- С нами с:
- 20 июл 2012
- Сообщения:
- 7
- Симпатии:
- 0
-
$wsdl_url=»http://dir/DataService.asmx?wsdl»;
-
ini_set(«soap.wsdl_cache_enabled», «0»);
-
$client = new SoapClient($wsdl_url, array(‘login’=>’Login’, ‘password’=>’Pass’));
Ошибка:
Код, по-моему, предельно нечерезжопный. Попытка элементарно создать объект soap вызывает ошибку. Я пытаюсь понять, что конкретно не нравится интерпретатору. Что такое «string(3316)» в тексте ошибки?
-
Команда форума
Модератор- С нами с:
- 18 мар 2010
- Сообщения:
- 32.415
- Симпатии:
- 1.768
этот — да. А ошибки приводились к тому, что был выше.
соап вроде как умеет кидать эксепшны. Можно посмотреть, выкинет ли.
попробуй:
-
$client = new SoapClient($wsdl_url, array(‘login’=>‘Login’, ‘password’=>‘Pass’));
-
Sogno
Активный пользователь- С нами с:
- 20 июл 2012
- Сообщения:
- 7
- Симпатии:
- 0
igordata, спасибо, в понедельник на работе попробую. Может, что и прояснится.
-
Sogno
Активный пользователь- С нами с:
- 20 июл 2012
- Сообщения:
- 7
- Симпатии:
- 0
Продолжаю мучиться с soap. В понедельник пришла на работу запустила код:
-
$client = new SoapClient($wsdl_url, array(‘login’=>’Login’, ‘password’=>’Pass’));
Он продолажет выдавать ошибку:
Поговорила с людьми, которые писали сервис, они сказали, что используется не базовый тип аутентификации, а с шифрованием.
В итоге пробовала добавлять в параметры ‘authentication’=>’SOAP_AUTHENTICATION_DIGEST’, всё равно та же ошибка лезет.
Нашла в нете, как у человека не удавалось авторизоваться из-за того, что летела кодировка логина и пароля. В результате попробовала добавить в параметры ‘encoding’=>’UTF-8’ (на сервере используется кодировка utf-8).
По-прежнему лезет ошибка 401 Unauthorized.
Долго я пробовала всякие комбинации с параметрами, да всё равно ничего не получалось.В итоге решила попробовать режим не-WSDL:
-
ini_set(«soap.wsdl_cache_enabled», «0»);
-
$wsdl_url=«http://dir/DataService.asmx?wsdl»;
-
$service_location=‘http://dir/DataService.asmx’;
-
$service_uri=‘http://uri.org/’;
-
$options = array(‘login’=>$login,
-
‘location’=>$service_location,
-
‘authentication’=>‘SOAP_AUTHENTICATION_DIGEST’,
-
‘cache_wsdl’ => ‘WSDL_CACHE_NONE’,
-
‘soap_version’ => ‘SOAP_1_1’);
-
try { $client = new SoapClient(null, $options); }
-
catch (Exception $e) { print«Ошибка создания объекта SOAP:<br>».$e->getMessage().«<br>».$e->getTraceAsString(); }
-
$params = array(‘orderId’=>52, ‘statusId’=>3);
-
try { $response = $client->UpdateOrderStatus($params); }
-
catch (Exception $e) { print«Ошибка вызова функции UpdateOrderStatus:<br>».$e->getMessage().«<br>».$e->getTraceAsString(); }
-
print «Ошибка работы с SOAP:<br>».$e->getMessage().«<br>».$e->getTraceAsString();
В итоге (о УРА!) объект soap создаётся без проблем. Даже не знаю, радоваться или ещё рано.
Но не работает вызов метода веб-сервиса: -
Команда форума
Модератор- С нами с:
- 18 мар 2010
- Сообщения:
- 32.415
- Симпатии:
- 1.768
А эксепшены, я смотрю, тебе понравились. Правильное дело! =)
Странно это всё. Это какой-то ваш внутренний корпоративный сайт? http://dir/
-
Sogno
Активный пользователь- С нами с:
- 20 июл 2012
- Сообщения:
- 7
- Симпатии:
- 0
Да, сервис писался нашими программистами и лежит на нашем сервере. Я просто заменила реальную директорию на dir. У нас такие политики безопасности, ууууу. И никак их не сломишь, этих защитников Родины.
-
Команда форума
Модератор- С нами с:
- 18 мар 2010
- Сообщения:
- 32.415
- Симпатии:
- 1.768
у вас нет доступа к тому проекту? к программистам? к документации? Есть у кого спросить, как надо логиниться-то?
Содержание
- PHP SoapClient — SOAP-ERROR: Parsing WSDL: Couldn’t load external entity #60
- Comments
- Footer
- Разбор ошибок SOAP PHP WSDL: не удалось загрузить внешний объект?
- SOAP-ERROR: Parsing WSDL #400
- Comments
PHP SoapClient — SOAP-ERROR: Parsing WSDL: Couldn’t load external entity #60
Hi!
First, thanks for this great stuff!
I’m a symfony 2 dev and I found this package very nice and clean. I made it work following the documentation and implemented an internal client to verify that it’s ok. But I got an issue and I hope you have some light according your experience.
My partners wanted to try the service with the native PHP SoapClient but it throws this exception:
The wsdl is downloadable through browser but when the SoapClient is used:
It doesn’t even reach the dev.log of symfony.
Could you help us to figure out the issue please?
Thanks 🙂
The text was updated successfully, but these errors were encountered:
@matheo did you find an answer ? i m facing same issue
@matheo still nothing? I’m stuck on the exact same thing.
I’m not sure but I think it was a conflict with FOSRestBundle.
Checking my git log it seems that I solved it with this line in the format_listener rules:
I am facing the same problem :
With this simple code :
Just like Matheo, the WSDL is also downloadable through browser.
And requests work perfectly with SoapUI !
Any help would be so much appreciated!
is it decided? i m facing same issue. please, answer me someone.
Can you please give the php version ?
I had the very same problem and it was related to libxml on specific php version.
my php version is 5.6.30
I am getting the same issue and my php version is: PHP Version 7.0.6-1+donate.sury.org
trusty+1
Is there any fix?
I am also getting same issue please give me the solution anyone
the same issue, PHP 7.1.12-3+ubuntu14.04.1+deb.sury.org+1
can you use options like
are your wsdl accessible via browser ?
are you behind a proxy ?
no i ran via php on the the browser
Are you using Nginx or Apache Web Server?
I also get same issue. I’m using Nginx server.
In my case: PHP-FMP and Nginx in same server and Apache tomcat (with te web services/soap) working throw Nginx load balancer in another server (both servers with Centos 7)
Watching logs for nginx/php/tomcat I saw calls to the name of my upstream (ex. **http://myLoadBalancer.com/**xxxx) in the tomcat server. So, I added to /etc/hosts myLoadBalancer.com
I dont remember the next error related with that, but I remember excecute the next line
setsebool -P httpd_can_network_connect on
After that, I had more problems related with external resources. In my case, Just added the directories to SELinux
Hope it works bro
Make sure there are no spaces before and after the URL and
apt-get install apt-get install node-crypto-cacerts libxmlsec1-openssl on Ubuntu
I also faced this same issue and i think that the url or link is blocked.Another reason may be some network issue.
i am also getting the same error guys what is the solution for this error
i think we should report to the soup community
I also faced this same issue
what is the solution for this error
© 2023 GitHub, Inc.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Источник
Разбор ошибок SOAP PHP WSDL: не удалось загрузить внешний объект?
Я пытаюсь запустить веб-службу с помощью PHP и SOAP, но пока все, что я получил, это:
Я пробовал изменить localhost на 127.0.0.1, но это не имеет значения. На самом деле логин — это файл wsdl, но если я помещаю login.wsdl в конструктор SOAPClient, вместо этого он говорит: «Похоже, у нас нет XML-документа».
Вот мой код для клиента SOAP (register_client.php):
А вот и файл login.wsdl:
И я не уверен, что это связано с этим, поэтому я предоставляю код для SOAP-сервера register.php:
Прошу прощения, если я даю ненужную информацию, но я новичок в этом — и я был бы очень признателен, если бы кто-нибудь мог указать, почему именно генерируется эта ошибка SOAP, и что я могу сделать, чтобы исправить Это.
Я использую WAMP Server версии 2.2 с mySQL 5.5.24 и PHP 5.3.13.
После перехода на PHP 5.6.5 мыло 1.2 перестало работать. Итак, я решил проблему, добавив необязательные параметры SSL.
failed to load external entity
Поместите этот код над любым вызовом Soap:
попробуй это. работает для меня
Получил аналогичный ответ с URL-адресом https WSDL с использованием php soapClient
SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn’t load from .
После обновления сервера с PHP 5.5.9-1ubuntu4.21 >> PHP 5.5.9-1ubuntu4.23 что-то пошло не так для моей клиентской машины osx 10.12.6 / PHP 5.6.30, но подключения клиентов MS Web Services могут быть выполнены без проблем.
В файле server_access.log Apache2 не было записей, когда я пытался загрузить WSDL, поэтому я добавил, ‘cache_wsdl’ => WSDL_CACHE_NONE чтобы предотвратить кеширование wsdl на стороне клиента, но все равно не получил записей. Наконец, я попытался загрузить wsdl на CURL -i проверенные ЗАГОЛОВКИ, но, похоже, все в порядке ..
Только libxml_get_last_error() предоставил некоторую информацию> SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Поэтому я добавил к своему вызову несколько параметров ssl:
В моем случае все ‘allow_self_signed’ => true получилось!
Источник
SOAP-ERROR: Parsing WSDL #400
i have followed the thread #353 but invain
please suggest the solution
The text was updated successfully, but these errors were encountered:
Do you face with this issue for all services and reporting? Or does it happen intermittently?
The new version (v32.0.0) now ships local WSDL files, so it doesn’t rely on the live WSDLs anymore.
Could you please try this version too?
i have the same issue with new version(v32.0.0)
this issue happend a few days (maybe 11/16)
Hello @fiboknacky
I am having this issue most of the time on local machine it always shown but on server it happened some time i have upgrade with new version as well tell me how i can resolve it
OK. Please let me know if this persists after you upgrade.
I changed from alder version. Used v32 and adapted to the new auth method using adsapi_php.ini
I tried several exemples from several versions (from 201702 to the last)
have same problem. From time to time it works but usually sends:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn’t load from ‘https://adwords.google.com/api/adwords/cm/v201702/AdGroupCriterionService?wsdl’ : failed to load external entity «https://adwords.google.com/api/adwords/cm/v201702/AdGroupCriterionService?wsdl» in C:xampphtdocsvendorgoogleadsgoogleads-php-libsrcGoogleAdsApiCommonAdsSoapClient.php:75
Stack trace:
#0 C:xampphtdocsvendorgoogleadsgoogleads-php-libsrcGoogleAdsApiCommonAdsSoapClient.php(75): SoapClient->SoapClient(‘https://adwords. ‘, Array)
#1 C:xampphtdocsvendorgoogleadsgoogleads-php-libsrcGoogleAdsApiAdWordsv201702cmAdGroupCriterionService.php(170): GoogleAdsApiCommonAdsSoapClient->__construct(‘https://adwords. ‘, Array)
#2 [internal function]: GoogleAdsApiAdWordsv201702cmAdGroupCriterionService->__construct(Array)
#3 C:xampphtdocsvendorgoogleadsgoogleads-php-libsrcGoogleAdsApiCommonUtilReflection.php(39): ReflectionClass->newInstanceArgs(Array)
#4 C:xampphtdocsvendorgoogle in C:xampphtdocsvendorgoogleadsgoogleads-php-libsrcGoogleAdsApiCommonAdsSoapClient.php on line 75
it now a week trying, sience ichange from 201609, please help me to search a way to move on
@QuimQuimQuim First you have to make sure your network access is unrestricted and then debug at breakpoints.That’s how I came
I have been getting a similar error, and so far no guides I’ve come across have been able to help with this SOAP-ERROR. Everything seems to be set up correctly on my end, and I am using v32.0.0 from a fresh install just a few hours ago.
Источник
Содержание статей: 1С:Предприятие 8. Веб-сервисы
Предыдущая статья: 1С:Предприятие 8. Веб-сервисы. Возвращаем массив
Хочу рассказать об ошибках, с которыми столкнулся при разработке веб-сервисов на 1С. Статью буду дополнять по мере получения опыта.
1
Это сообщение об ошибке при подключении к веб сервису из PHP.
[31-Mar-2013 05:32:02 UTC] PHP Fatal error: SOAP-ERROR: Parsing WSDL: Couldn’t load from ‘http://test.ru/test/ws/WebServices?wsdl’ : failed to load external entity
Данное сообщение говорит лишь о недоступности веб-сервера, на котором опубликована база. В этом случае попробуйте вручную вызвать http://test.ru/test/ws/WebServices?wsdl и убедиться, что WSDL формируется. Если не формируется, значит либо веб-сервер выключен, либо база опубликована по другому адресу или порту, либо блокирует фаервол. Могут быть и другие причины.
2
02-Apr-2013 13:46:10 UTC] PHP Fatal error: Uncaught SoapFault exception: [HTTP] Error Fetching http headers in /home/users/b/test/domains/test.ru/testDIR/test.php:169
Эта ошибка возникает если WSDL возвращается с ошибкой. Есть несколько причин для этой ошибки:
- Несогласованность пространств имен в конфигурации. Например в ws-операции тип возвращаемого значения не соответствует типу из XDTO. Это может возникнуть при сменен URI пространства имен пакета XDTO.
- Возникает если в PHP включить кеш WSDL. Кеш запоминает WSDL и при каждом вызове веб-операции не запрашивает его, но если вы поменяли веб-сервис, то произойдет ошибка. Вообще, при разработке кеш стоит отключить, а если уже все работает то для скорости лучше включить. Ускорение при отключенном кеше заметное. Для примера скажу, что создание объекта SoapClient с выключенным кешем занимает примерно 2 сек, а с включенным — за сотые доли секунды. Отключить можно так:
ini_set
(
"soap.wsdl_cache_enabled"
, 0);
или
$client
=
new
SoapClient(
'http://somewhere.com/?wsdl'
,
array
(
'cache_wsdl'
=> 0));
3
Ошибка SOAP сервера: Неизвестная ошибка. bad allocation.
Скорее всего недостаток оперативной памяти — проверьте запрос и результат вывода веб сервиса. Запрос может быть сложным, потому может быстро исчерпать оперативную память.
22.08.13 — 10:36
Из платформы 8.3.2.163 опубликовал веб-сервис на IIS 5.1.
Установил PHP 5.3.271
Сделал файл index.php:
ini_set(«soap.wsdl_cache_enabled», «0»);
$client = new SoapClient(«http://localhost/InfoBase4/ws/wsnomen.1cws?wsdl»;);
При открытии http://localhost/index.php получаю ошибку:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn’t load from ‘http://localhost/InfoBase4/ws/wsnomen.1cws?wsdl’ : failed to load external entity «http://localhost/InfoBase4/ws/wsnomen.1cws?wsdl»; in C:Inetpubwwwrootindex.php:5 Stack trace: #0 C:Inetpubwwwrootindex.php(5): SoapClient->SoapClient(‘http://localhos…’) #1 {main} thrown in C:Inetpubwwwrootindex.php on line 5
При этом если открыть http://localhost/InfoBase4/ws/wsnomen.1cws?wsdl то нормально открывается описание веб сервиса:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<definitions xmlns=»http://schemas.xmlsoap.org/wsdl/»; xmlns:soap12bind=»http://schemas.xmlsoap.org/wsdl/soap12/»; xmlns:soapbind=»http://sch
… и т.д.
В чем может быть ошибка ?
1 — 22.08.13 — 10:38
Пардон, код PHP Таков:
ini_set(«soap.wsdl_cache_enabled», «0»);
$client = new SoapClient(«http://localhost/InfoBase4/ws/wsnomen.1cws?wsdl»;);
2 — 22.08.13 — 10:39
т.е. там нет точки-запятой перед скобкой, подставляется почему то автоматически при публикации в форуме
3 — 22.08.13 — 10:47
Раздел [soap] из php.ini дай
4 — 22.08.13 — 10:51
И попробуй туда же раскомментировать
extension=php_openssl.dll
там где экстеншены
5 — 22.08.13 — 10:58
в разделе пхп все норм
[PHP_OPENSSL]
extension=php_openssl.dll
6 — 22.08.13 — 10:59
сори опять тороплюсь вот:
[PHP_SOAP]
extension=php_soap.dll
7 — 22.08.13 — 11:26
Обнаружил, что если в пхп написать
$client = new SoapClient(«bugaga»);
то ошибку выдает точно такую же.
А если например:
$client = new SoapClient_(«bugaga»);
то ошибка меняется
Fatal error: Class ‘SoapClient_’ not found in C:Inetpubwwwrootindex.php on line 5
8 — 22.08.13 — 11:40
9 — 22.08.13 — 15:39
(8) интересно. Установил, запустил ПХП. Просит пароль. Переустановил IIS, настроил у него ПХП, раздал права на папки. Пароль требовать перестал, но и ссылку
http://127.0.0.1/otladka/ws/lyay.1cws?wsdl
теперь не видит. Разбираюсь.
10 — 22.08.13 — 15:59
Заработало.
Подставил прилагаемый к примеру default.vrd и возможно (точно не помню)затронул настройки безопасности IIS/Свойства: otladka/Безопасность каталога/Анонимный доступ и проверка подл./Изменить. Установлены флаги:
Анонимный доступ
Разрешить управление паролем из ИИС
+Указано имя пользователя
На вкладке «Виртуальный каталог» кроме прочих доступны поля:
Локальный путь
Имя приложения
+кнопка Настройка
Еще вероятнее всего повлияло:
В конфигураторе при публикации Имя: otladka
где то на мисте читал что оно должно соответствовать названию своего каталога (C:Inetpubwwwroototladka)
11 — 22.08.13 — 16:01
а у меня по-умолчанию имя стояло: db
(8) хороший пример, спасибо !
12 — 23.08.13 — 10:15
И еще одна любопытная деталь:
Если сейчас обращусь по адресу http://127.0.0.1/index.php
без вопросов откроется пример
А если ввести адрес
http://127.0.0.1/otladka/ws/lyay.1cws?wsdl
То спросит логин и пароль. В этом примере, в PHP файле указаны логин и пароль: ‘site’
Так вот они подходят, что странно, учитывая что я их нигде не вводил ранее.
13 — 23.08.13 — 10:21
(0) кстати объявление «new SoapClient» , в соответствии с примером у меня теперь выглядит немного сложнее:
function ПодключитьсяК1С(){
if (!function_exists(‘is_soap_fault’)){
print ‘Не настроен web сервер. Не найден модуль php-soap.’;
return false;
}
try {
$Клиент1С = new SoapClient(‘http://127.0.0.1/otladka/ws/lyay.1cws?wsdl’,
array(‘login’ => ‘site’,
‘password’ => ‘site’,
‘soap_version’ => SOAP_1_2,
‘cache_wsdl’ => WSDL_CACHE_NONE, //WSDL_CACHE_MEMORY, //, WSDL_CACHE_NONE, WSDL_CACHE_DISK or WSDL_CACHE_BOTH
‘exceptions’ => true,
‘trace’ => 1));
}catch(SoapFault $e) {
trigger_error(‘Ошибка подключения или внутренняя ошибка сервера. Не удалось связаться с базой 1С.’, E_ERROR);
var_dump($e);
}
//echo ‘Раз<br>’;
if (is_soap_fault(Клиент1С)){
trigger_error(‘Ошибка подключения или внутренняя ошибка сервера. Не удалось связаться с базой 1С.’, E_ERROR);
return false;
}
return $Клиент1С;
}
790th
14 — 23.08.13 — 10:48
(12) это всего лишь пользователь бд