I have a simple SOAP question:

A SOAPcall is made in a commerce payment method (custom module) to an external url. Let's use a simple webservice for the example:

$client = new SoapClient('http://www.webservicex.net/ConvertTemperature.asmx?WSDL', array('exceptions'=>TRUE, 'cache_wsdl'=>WSDL_CACHE_NONE));
$result=$client->ConvertTemp(floatval(30), 'degreeCelsius', 'degreeFahrenheit');

Following error appears:

Warning: SoapClient::SoapClient() [soapclient.soapclient]: I/O warning : failed to load external entity "http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL" in ...
SoapFault: SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL' : failed to load external entity "http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL" in SoapClient->SoapClient() (......).

When adding the exact same code to the Drupal root directory in a php file, it simply works.

in the module: SOAP call is not working
in the web root: SOAP call is working

Additional info: when putting the wsdl file locally, everything works fine. But that's not the idea. It has to be an external wsdl.

Thanks in advance for a solution to this mysterious phenomenon.


Jaypan’s picture

Are you writing this code, or asking about code that has been written in the existing module?

I will soon be leaving the Drupal forums permanently. To understand why, please see this thread.

lennartvv’s picture

I am writing this code. Of course this is a simplified example which I'm literally using for testing purposes.
I'm thinking more and more it has something to do with server settings, but that's not yet confirmed. And still it's strange it works starting from the web root using a simple php file. Once calling from a module (it's not linked to Commerce) it jams.

Vaerenbergh.com - A Drupal developer's web page

lennartvv’s picture

It appeared to be a bug in Drupal.
The patch in #3 fixed it: https://drupal.org/node/1986026#comment-7849033

Vaerenbergh.com - A Drupal developer's web page