I'm new to Services. I followed README.txt . At:
3) Allow anonymous user to access services module from access control
I'm assuming this means access needs to be granted to the specific methods that one wants to call, e.g. node_service's "load node data" permission. Is that correct?

I also followed the directions here: http://drupal.org/node/113699#comment-2306856 . At step 3 below "At this point":
3. Navigate to administer->Site building-> Services and select SOAP - /services/soap to see a beautified represention of the Web Service interfaces
I get a white screen with just the text:
"You must specify a name when you register an operation".

I then tried soap_server_test.php from README.txt, including the correct path to nusoap.php and got the following error:
PHP Fatal error: Call to undefined method soapclient::__soapCall() in .../soap_server_test.php on line 35

Is this a NuSOAP version issue? At admin/build/services/settings/soap I get:
NuSOAP Path: sites/all/modules/soap_server/nusoap/lib/nusoap.php
The location where NuSOAP is installed. This should be a relative path to nusoap.php. Version 0.7.3 found.

soap_server 6.x-1.2-beta1
services 6.x-2.x-dev
NuSOAP 0.7.3
Drupal 6.14
PHP 5.2.11

Thanks in advance for any guidance,

Dave

CommentFileSizeAuthor
#9 soap_server.patch3.53 KBjherencia

Comments

davej’s picture

Some progress: it seems that soap_server-6.x-1.2-beta1 is not compatible with services-6.x-2.x-dev 2009-11-11. In this version of services, the array elements of each service from services_get_all(), called in soap_server(), have keys like 'method', 'args' whereas soap_server-6.x-1.2-beta1 soap_server() expects '#method', '#args'. See the call to services_strip_hashes() in services-6.x-2.x-dev services_get_all().

I uninstalled services-6.x-2.x-dev, installed services-6.x-0.15 and this cured the error "You must specify a name when you register an operation" at services/soap .

soap_server-6.x-1.2-beta1 is the only 6.x version listed at http://drupal.org/project/soap_server so I assume there's currently no version of soap_server compatible with services-6.x-2.x-dev.

I haven't got soap_server_test.php working yet; I replaced $client->__soapCall with $client->__call and this got rid of the error message but I get no results back. Have set permission for anon to "access services" and "load any|own node data".

Dave

ilo’s picture

Assigned: Unassigned » ilo

Davej, sorry, I just missed the issues from this module (it is the 2nd time it happens to me brbr). I'll work on it, probably would need some assistance during testing.I hope to get this solved ASAP!

davej’s picture

Thanks for the reply, ilo, that's good news. I hope to be using soap_server on a project that is just getting started so I'll be able to do some testing.

Progress with soap_server_test.php: by putting debug statements in the code, e.g.

  $result = $client->call('node.load', $param1); 
  if ($result) {
    echo '<pre>';print_r($result);echo '</pre>';
  }
  else {
    echo 'Error: <pre>' . $client->getDebug() . '</pre>';
  }

I found the empty result was due to HTTP Basic Auth being on (d'oh!) but after fixing that I got an error:

PHP Notice: Undefined index: in ...soap_server/nusoap/lib/nusoap.php on line 6497

The last debug output was:

2009-11-30 15:14:08.511163 nusoap_parser: in buildVal, return:
array(2) {
  ["port"]=>
  &array(3) {
    ["address"]=>
    &array(1) {
      ["!location"]=>
      string(57) "http://myhost.blah/services/soap/"
    }
    ["!name"]=>
    string(14) "DrupalSoapPort"
    ["!binding"]=>
    string(21) "tns:DrupalSoapBinding"
  }
  ["!name"]=>
  string(10) "DrupalSoap"
}
2009-11-30 15:14:08.511265 nusoap_parser: parsed successfully, found root struct:  of name 
2009-11-30 15:14:08.512441 soapclient: sent message successfully and got a(n) NULL
return=NULL

That's as far as I've got so far. The same happens with every method call that I've tried: node.load, echo.echo, system.connect, user.login . Here's SOAP-ENV:Body from $client->request:

<ns2123:node.load xmlns:ns2123="http://tempuri.org">
  <nid xsi:type="xsd:int">1</nid>
</ns2123:node.load>

$client->response consists of (drastically trimmed):

<definitions xmlns:SOAP-ENV=...>
<types>
  ...
</types>
<message name="echo.echoRequest">
  <part name="message" type="xsd:string" /></message>
...(messages for other methods)
<portType name="DrupalSoapPortType">
  ...(operations)
</portType>
<binding name="DrupalSoapBinding" type="tns:DrupalSoapPortType">
  <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
  ...(operations)
  </operation>
</binding>
<service name="DrupalSoap">
  <port name="DrupalSoapPort" binding="tns:DrupalSoapBinding">
    <soap:address location="http://myhost.blah/services/soap/"/>
  </port>
</service>
</definitions>

- I.e. the response just has the definitions, with no return value from the specific method that was called.

This is with services-6.x-0.15 and soap_server-6.x-1.2-beta1.

Dave

davej’s picture

Progress: I found that the problems in getting a response back were due to incorrect/incompatible code in soap_server_test.php . These are the things I changed in that script to get it working:

  1. Changed $client->soapCall() to $client->call() .
  2. Added checks for $client->fault and $client->getError(); also usful to display $client->request and $client->response for dubugging.
  3. Changed:
      $client = new soapClient($wsdl);
    

    to:

      $client = new soapClient($wsdl, TRUE);
    

    - 2nd parameter is "bool $wsdl optional, set to true if using WSDL".

  4. Changed noad.load to noad.get: there is no noad.load method in services-6.x-0.15 .

Dave

IncrediblyKenzi’s picture

Status: Active » Needs review

Dave,

Which version of PHP are you using?

If I recall, php 5.2 changed the call to $client->soapCall() to avoid the overloaded use of stdClass's $client->call().

While $client->call() may still be available, it's listed on php's site as deprecated.

-=Aaron

IncrediblyKenzi’s picture

Oop.. nevermind, I just read your post above with version info.

Do you need to use nuSoap in this case? PHP 5.2 should have working soap support out the gate (though I guess it depends on how it was compiled).

PHP's builtin soap client classes are much more performant than nusoap, so use that if you can.

-+Aaron

davej’s picture

Status: Needs review » Active

Hi Aaron,

Thanks for your post. I'm using nusoap for client testing because I need it anyway as it's required for soap_server. There's a feature request about supporting PHP soap extension: http://drupal.org/node/217958 but this has been postponed.

Changing status back to active - the main issue here is that current soap_server doesn't work with services-6.x-2.x-dev .

Regards,

Dave

ilo’s picture

Actually, I'm making a race to get the PHP soap support merged on current code. I've done other native SOAP projects in the past and have mature code I'm currently putting into.

Sorry for the delay it is taken, if I see difficulties I'd commit things separately.

jherencia’s picture

StatusFileSize
new3.53 KB

This patch makes SoapServer work with dev release of services module.

ilo’s picture

Status: Active » Needs review

jhenjuto, thanks. If someone else could verify this we could make a quick fix committing this path NOW.

davej’s picture

Tested patch #9 with soap_server-6.x-1.2-beta1 and services-6.x-2.x-dev 2009-12-25. This works in my simple test case, however the patch makes soap_server incompatible with services-6.x-0.15, which is the only non-dev release at drupal.org/project/services .

Presumably the removal of hashes in service array elements (e.g. '#method' -> 'method') between services-6.x-0.x and services-6.x-2.x poses a similar compatibility problem for all server modules. How have other server modules dealt with this? Does it make sense to have different versions of soap_server for the different versions of services? Or perhaps better to implement in soap_server the equivalent of function services_strip_hashes and call this if soap_server is talking to services-6.x-0.x ?

Dave

dapperry’s picture

I come from a .NET background more, but couldnt you use some sort of "reflection" to figure out whether to use # signs or not.

:) David

PS - Current version (with # signs) is incompatible with current stable release of Services (6.X-2.0). You have to remove # signs.

uccio’s picture

Priority: Normal » Critical
Status: Needs review » Patch (to be ported)

At this moment Services 6.x-2.4 is stable and this fix work!

Please commit the patch!