I have a drupal7 Site, in which I activated the services module to expose a SOAP service. The problem is that I set up everything, the endpoints, the handling of the request, load the WSDL and set the class to get th efunctions, but I always get an error
function tigoapi_server() {
require_once 'ServicePort.php';
global $HTTP_RAW_POST_DATA;
$server = new SoapServer(drupal_get_path('module', 'tigoapi') . '/wsdl/TigoAPIService_1.wsdl');
ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL after the server is initiated
$server->setClass('ServicePort');
error_log(print_r($server->getFunctions(),true),3,"/var/www/sites/tigo/sites/all/modules/services/tigoapi/tigoapi.log");
$server->handle($HTTP_RAW_POST_DATA);
I always get:
curl http://server/tigoapi?wsdl
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Client</faultcode><faultstring>Bad Request</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope
Now, if I try it , same server, same WSDL, same ServicePort class, just not going throug the Drupal router it works:
require_once 'ServicePort.php';
global $HTTP_RAW_POST_DATA;
//$server = new SoapServer(drupal_get_path('module', 'tigoapi') . '\wsdl\TigoAPIService_1.wsdl',array('encoding'=>'UTF-8'));
$server = new SoapServer('wsdl/TigoAPIService_1.wsdl');
ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL after the server is initiated
$server->setClass('ServicePort');
error_log(print_r($server->getFunctions(),true),3,"/var/www/sites/tigo/sites/all/modules/services/tigoapi/tigoapi.log");
//$server->handle();
$server->handle($HTTP_RAW_POST_DATA);
This works perfectly.
I'm using nginx and php-fpm, it would seem that the difference is in the way the requests gets here as with drupal I have a $_GET variable called 'q'
any ideas on this?