Software engineer, data guy, Open Source enthusiast, New Hampshire resident, husband, father. Fan of guitars, hiking, photography, homebrewing, sarcasm.
Drupal 6: Executing a SOAP call from Drupal using nusoap
In this tutorial I’ll show how you can make a SOAP call from a Drupal page callback using the nusoap library.
For this example I decided to create a sample soap server instance for testing purposes. I created the following directory structure for my new module: sites/all/modules/custom/nusoap/. I then download the nusoap library (nusoap-0.7.3.zip), extracted the archive, and put the “lib” folder in my module directory (sites/all/modules/custom/nusoap/lib).
In this directory I created a file called “soap-server.php” to contain my soap server instance and added the following code:
Now if I browse directly to my soap-server.php file (for example: http://drupal.erl.dev/sites/all/modules/custom/nusoap/soap-server.php), I see the following screen:
Clicking on the WSDL link will show my automatically generated WSDL/XML; clicking on the method name “personTransfer” will show more details about the soap server method. Thanks nusoap!
Next I created the custom Drupal module file:
Browsing to the new page callback (ex: http://drupal.erl.dev/soap-client) shows the following debug output. sweet.