Drupal Module with SOAP Client Has Problem with remote_stream_wrapper (couldn't load external entity WSDL)

  • Posted on: 20 November 2014
  • By: oon

So you run SOAP Client on your Drupal's code? if you are using external WSDL and got condition like below.

PHP error log:

SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://domain?wsdl' : failed to load external entity "http://domain?wsdl"

Try this Patch [1]:

diff --git a/remote_stream_wrapper.inc b/remote_stream_wrapper.inc
index 492272b..9618cfd 100644
--- a/remote_stream_wrapper.inc
+++ b/remote_stream_wrapper.inc
@@ -271,6 +271,14 @@ class DrupalRemoteStreamWrapper implements DrupalStreamWrapperInterface {
   public function stream_stat() {
     $stat = array();
     $request = drupal_http_request($this->uri, array('method' => 'HEAD'));
+
+    // Not all servers support HEAD if error, try with GET
+    // This is the case most notably with SOAP
+    // https://drupal.org/node/1986026
+    if(!empty($request->error)) {
+      $request = drupal_http_request($this->uri, array('method' => 'GET'));
+    }
+
     if (empty($request->error)) {
       if (isset($request->headers['content-length'])) {
         $stat['size'] = $request->headers['content-length'];

so basically, it is not required to save WSDL offline.

[1]https://www.drupal.org/node/1986026
[2]https://www.drupal.org/project/remote_stream_wrapper

Tags: 

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.