Error with PHP SOAP and Magento WebService - php

I have a cloud server with CentOS 6, Apache 2.2, PHP 5.4 and i have one site with Magento.
And i try to use a Magento WebService and return this error:
SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://******.com/dev/index.php/api/soap/index/?wsdl=1' : failed to load external entity "http://******.com/dev/index.php/api/soap/index/?wsdl=1"
I search here and in google, and i try many changes in php.ini, but in all cases i don't have success.
I read in some cases this is a problem in server side, for bad configuration.
NoteĀ¹: SOAP is installed in server, in phpinfo() SOAP is enabled.
NoteĀ²: On another server was working normally.
Anyone have any ideia how to solve this?
Edit: The server use WHM/CPanel and i use EasyApache for install Apache, PHP. And use default configuration.
Edit2: This is just a simple sample code that uses the SOAP and error it returns:
Code: (first line of this code is a line 9, and line 13 is "$cli = new SoapClient($api_url_v1);")
<?php
$api_url_v1 = "http://site.com/dev/api/soap/?wsdl=1";
$username = '*********';
$password = '*********';
$cli = new SoapClient($api_url_v1);
//retreive session id from login
$session_id = $cli->login($username, $password);
//call customer.list method
$result = $cli->call($session_id, 'customer.list', array(array()));
?>
Error:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://site.com/dev/api/soap/?wsdl=1' : failed to load external entity "http://site.com/dev/api/soap/?wsdl=1" in /home/******/public_html/test_soap.php:13 Stack trace: #0 /home/******/public_html/test_soap.php(13): SoapClient->SoapClient('http://site...') #1 {main} thrown in /home/******/public_html/test_soap.php on line 13

try to fetch the wsdl via webbrowser. if this does not work then you have an error in url. try www version of the urls, check for bad rewrites, check htaccess. you dont need https!

Related

Possible compatibility issues between Exchange 2010 recent SOAP/PHP releases?

Basically the project I was assigned requires me connecting to an Exchange 2010 SP2 server via PHP. I have researched several possibilities and found that SOAP is the most accessible approach (I could be wrong, however) and have been basing the majority of my code on this link: https://www.howtoforge.com/talking-soap-with-exchange
I got up to the following part:
print_r($client->__getFunctions());
When I tried to test it out I got an error as followed:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'SERVER ADDRESS.WSDL' : failed to load external entity "SERVER ADDRESS.WSDL" in C:\xampp\DIRECTORY:4 Stack trace: #0 C:\xampp\DIRECTORY(4): SoapClient->SoapClient('SERVER ADDRESS') #1 {main} thrown in C:\xampp\DIRECTORY on line 4
Line 4 being :
$client = new SoapClient($wsdl);
I have researched the possible issues regarding this, enabled all the required things for PHP and researched other alternatives but I think the issue lies in the connection itself between Exchange and the code (connecting directly through the browser works fine).
To summarize my issues with a question: Is there a possible compatibility issue between the latest PHP and cURL (currently 7.2.1. and 7.56.0 respectively) and Exchange 2010?
Would it also be possible to maybe receive other suggestions on how I can tackle this issue?

cannot connect to a soap api with php

I'm trying to access this URI: http://143.166.84.118/services/assetservice.asmx?WSDL (Dell warranty info)
In Windows Powershell I can do this no problem:
$service = New-WebServiceProxy -Uri http://143.166.84.118/services/assetservice.asmx?WSDL
But in PHP:
$DELL_URL = "http://143.166.84.118/services/assetservice.asmx?WSDL"; //Access webproxy by IP
$soap = new SoapClient($DELL_URL);
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://143.166.84.118/services/assetservice.asmx?WSDL' in C:\path\to\my\script.php:25 Stack trace: #0 C:\path\to\my\script.php(25): SoapClient->SoapClient('http://143.166....') #1 {main} thrown in C:\path\to\my\script.php on line 25
What am I doing wrong in php? I know the URL works cause it works with powershell.
As per Pete's suggestion I went to http://143.166.84.118/services/assetservice.asmx?WSDL and downloaded a local copy of the file then did this which worked:
$soap = new SoapClient($wsdlfilepath);
Do I always have to download a local copy of the file when using php?
edit: Didn't make any changes but now I'm getting "Uncaught SoapFault exception: [Client] looks like we got no XML document in..." error. Should I be worried about this? You can view the wsdl file by going to the link. Are there problems with it or extra white space? I didn't see any.

SoapFault exception on localhost only

Having searched through the many questions related to this error already posted, I've been unable to find an answer.
When I try and connect to a URL via soap, it works fine on a Godaddy VPS but fails on my localserver (EasyPHP AMP Stack). Open SSL is enabled as is Soap in php's ini settings but does anyone know what I'm missing as I guess it's a config issue?
The code I'm running is
$gdAuctionsWSURL = 'http://auctions.godaddy.com/gdAuctionsWS/GdAuctionsBiddingWS.asmx?WSDL';
$gdAuctionsWS = new SoapClient($gdAuctionsWSURL);
and the error that only occurs on my local server is
Fatal error: Uncaught SoapFault exception:
[WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://auctions.godaddy.com/gdAuctionsWS/GdAuctionsBiddingWS.asmx?WSDL' :
failed to load external entity "http://auctions.godaddy.com/gdAuctionsWS/GdAuctionsBiddingWS.asmx?WSDL"

Help to connect in Reporting Web Services 2008 R2 with PHP

I am trying using PHP with MSSQL Reporting Services, but without success... First, i tried using helloworld.php from SRSS SKD PHP, and returns this error:
Failed to connect to Reporting Service:
Make sure that the url (http://10.120.100.12/ReportServer/) and credentials are correct!
And trying using pure SoapClient:
Warning: SoapClient::SoapClient(http://10.120.100.12/ReportServer/ReportExecution2005.asmx) [function.SoapClient-SoapClient]: failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized in C:\xampp\htdocs\estudos\index.php on line 5
Warning: SoapClient::SoapClient() [function.SoapClient-SoapClient]: I/O warning : failed to load external entity "http://10.120.100.12/ReportServer/ReportExecution2005.asmx" in C:\xampp\htdocs\estudos\index.php on line 5
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://10.120.100.12/ReportServer/ReportExecution2005.asmx' in C:\xampp\htdocs\estudos\index.php:5 Stack trace: #0 C:\xampp\htdocs\estudos\index.php(5): SoapClient->SoapClient('http://10.120.1...', Array) #1 {main} thrown in C:\xampp\htdocs\estudos\index.php on line 5
Have a extra IIS configuration to make?
i am sure that use the same login and password used in web browser version. Need something more?
Thanks,
Celso
I'm assuming you're passing username/password - in that case NTLM authentication might be the issue. I'd recommend trying to enable basic authenticaiton to see if the problem goes away: http://msdn.microsoft.com/en-us/library/cc281309.aspx

Fatal error: Uncaught SoapFault exception: [WSDL]

I'm having trouble calling a web service I've set up from PHP. The obfuscated adress http://XXX.XXX.XXX.XXX/test.asmx?wsdl in the error message below returns a valid WSDL. I've successfully tried to call it as a web service using a VB.net client, but when I call it from PHP on Debian I get the following message:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL:
Couldn't load from 'http://XXX.XXX.XXX.XXX/test.asmx?wsdl'
in /var/www/domain/mywebsite.com/public_html/catalog/fomeus/orders.php:101
Stack trace:
#0 /var/www/domain/mywebsite.com/public_html/catalog/fomeus/orders.php(101):
SoapClient->SoapClient('http://XXX.XXX.XXX.XXX/', Array) #1 {main} thrown
in /var/www/domain/mywebsite.com/public_html/catalog/fomeus/orders.php
on line 101
What could the problem be? I've included my code for the web service and the PHP client below.
Web Service:
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
...
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class WebService1
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function HelloWorld() As String
Return "Hello World"
End Function
End Class
PHP client:
require_once($_SERVER['DOCUMENT_ROOT']."/catalog/fomeus/includes/soap/nusoap.php");
$objClient = new soapclient("http://XXX.XXX.XXX.XXX/test.asmx?wsdl",
array('trace' => 1, 'exception' => 0, 'cache_wsdl' => 0));
print_r($objClient -> HelloWorld());
I'm using PHP version 5.2.6 if that's of any help. I've been going through plenty of posts in different forums trying to figure out what the problem is. Many people have had the same issue, but none of the solutions I've found so far work for me. Any help would be greatly appreciated.
Another option to look at is cURL. You can create your payload as an XML string and send it to the same URL using cURL. You would then need to capture the response code and process as appropriate. When I had issues with SOAPClient, I moved to cURL - works like a charm.
If you're using nusoap (php 5.2 has a native soapclient, which I prefer), the first thing I see is your arguments. Argument #2 for nusoap's soapclient constructor should be boolean TRUE here, if you're using the WSDL, and not an array. Try:
$objClient = new soapclient("http://XXX.XXX.XXX.XXX/test.asmx?wsdl",true);
print_r($objClient->HellowWorld());
That's how i've been able to work with wsdl in the past.
If you're using the native client, and having problems with the wsdl, you can always bypass it and make straight calls, like so:
$objClient = new soapclient(null,array('uri'=>'http://xxx/test.asmx','location'=>'http://xxx/test.asm'));
$objClient->__call('HelloWorld',array());
That should work, but isn't as easy to navigate as wsdl.
try to turn on php_soap.dll and php_openssl.dll in your php.ini.
Located in the apache folder \apache\apache2.4.2\bin
remove the ";"
Adding index.php worked for me working on php application
$client = new SoapClient('http://www.domain.com/api/v2_soap/?wsdl'=1)
$client = new SoapClient('http://www.domain.com/index.php/api/v2_soap/?wsdl'=1)

Categories