Good afternoon,

I'm trying to get the advance example up and running and keep running into the same issue.

I've followed the steps in the Readme.txt and enabled via drush en -y migrate_example_advanced --uri=http://d8.local:8083/

I then get the following when using tools from drush and doing drush ms

Fatal error: Class 'SoapClient' not found in /code/modules/migrate_plus/src/Plugin/migrate_plus/data_parser/Soap.php on line 67
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Class 'SoapClient' not found in
/code/modules/migrate_plus/src/Plugin/migrate_plus/data_parser/Soap.php,
line 67

Should I be able to see the JSON/XML at http://d8.local:8083/? because it's not resolving.

I thought I read somewhere that this example might be broken as of 8.2+, but I can't seem to find the article or anything eluding to that.

Please note because this is likely important. I'm running all of this via the newest version of Drupal 8.2.1 on Kalabox so that could potentially have something to do with it if this is service related, and not code related.

Best,
Shawn

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

shawnmatthews created an issue. See original summary.

joshi.rohit100’s picture

The line causing problem is $client = new \SoapClient($url); and it looks like that soap client/library is not installed for your php.

shawnmatthews’s picture

I'm showing

Soap Client - Enabled
Soap Server - Enabled

soap.wsdl_cache local - 1 master - 1
soap.wsdl_cache_dir local - /tmp master - /tmp
soap.wsdl_cache_enabled local - 1 master -1
soap.wsdl_cache_limit local -5 master - 5
soap.wsdl_cache_ttl local - 86400 master - 86400

Under the php.ini generated from reports/status/php

Still receiving the Class error I mentioned above.

Do I need to enable anything else? Is there a way to bypass just the Soap part of the example. I'm interested in just getting the JSON portion going.

Best,
Shawn

joshi.rohit100’s picture

Well if your data is json/xml, then instead of using soap plugin try Json or XML plugin (for specific needs). I haven't used soap but as you mentioned soap is enabled, looks like different php.ini/settings for cli and browser.

darkdim’s picture

Hi.
I had the same problem.
I looked at my config and did not find there soap((

I use ubuntu
sudo apt-get update
sudo apt-get install php-soap

and Voila

mikeryan’s picture

The Soap source plugin should throw RequirementsException when SoapClient is not found (i.e., the PHP SOAP extension is not installed).

LOBsTerr’s picture

Status: Active » Needs review
FileSize
1.44 KB
joshi.rohit100’s picture

Status: Needs review » Needs work
+++ b/src/Plugin/migrate_plus/data_parser/Soap.php
@@ -61,10 +62,19 @@ class Soap extends DataParserPluginBase implements ContainerFactoryPluginInterfa
+    // Will throw SoapFault if there's an error in a SOAP call.
+    $soap_client_class = '\SoapClient';
+    if (class_exists($soap_client_class)) {
+      $client = new $soap_client_class($url);
+    }
+    else {
+      throw new RequirementsException('The PHP SOAP extension is not installed');

I think we should check in the constructor instead. As object is already created at this point.

LOBsTerr’s picture

Status: Needs work » Needs review
FileSize
1.57 KB

@joshi.rohit100 Moved the code to the constructor

heddn’s picture

Status: Needs review » Needs work

We should add "ext-soap": "*" to the list of requirements composer.json.

heddn’s picture

Then this check in the constructor is not-necessary.

LOBsTerr’s picture

Assigned: Unassigned » LOBsTerr
LOBsTerr’s picture

@heddn The only issue here, theoretically after installation of Drupal the soap extension can be disabled (uninstalled). As a result user will face the same issue ?

Dinesh18’s picture

Status: Needs work » Needs review
FileSize
1.85 KB

Here is the updated patch which implements #9

LOBsTerr’s picture

@Dinesh18, Did you see that I have assigned already to myself and started to work on it??? You should reassign the task. So, people will know that you started to work on it.

heddn’s picture

Status: Needs review » Needs work

It would be nice to see an interdiff. And the require in the composer.json is in the incorrect location.

composer validate
./composer.json is valid for simple usage with composer but has
strict errors that make it unable to be published as a package:
See https://getcomposer.org/doc/04-schema.md for details on the schema
The property ext-soap is not defined and the definition does not allow additional properties
LOBsTerr’s picture

LOBsTerr’s picture

Status: Needs work » Needs review
LOBsTerr’s picture

Assigned: LOBsTerr » Unassigned
heddn’s picture

Status: Needs review » Reviewed & tested by the community

This looks much better.

  • heddn committed 59839b0 on 8.x-4.x authored by LOBsTerr
    Issue #2823380 by LOBsTerr, heddn: SoapClient not found
    
Dinesh18’s picture

@LOBsTerr , sorry for not assigning the issue to myself. I will assign it to myself before working on any issue in future. Thanks.

heddn’s picture

Status: Reviewed & tested by the community » Fixed

  • heddn committed 88df038 on 8.x-4.x authored by LOBsTerr
    Issue #2823380 by LOBsTerr, heddn: SoapClient not found
    
heddn’s picture

Actually, this should be more like the oauth integration and only list as a suggestion.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.