开发者

PHP SOAP Function name must be a string?

Sorry about posting the whole error. Basically I have two functions that are running on the soap server and work great. I've added a third function 'getk' that does nothing more complicated that the others. Accepts two parameters and returns an array. However when calling this function client side I get the following error.

Fatal error: Uncaught SoapFault exception: 
[SOAP-ENV:Server] Function name must be a string in /home/od2u/public_html/wp-content/plugins/link-monitor/link-monitor.php:33 
Stack trace: #0 [internal function]: SoapClient->__call('getk', Array) 
#1 /home/od2u/public_html/wp-content/plugins/link-monitor/link-monitor.php(33): SoapClient->getk('3', 'wpmu1') 
#2 /home/od2u/public_html/wp-content/themes/twentyten/header.php(18): wsfKeywords('3', 'wpmu1') 
#3 /home/od2u/public_html/wp-includes/theme.php(1086): require_once('/home/od2u/publ...') 
#4 /home/od2u/public_html/wp-includes/theme.php(1062): load_template('/home/od2u/publ...', true) 
#5 /home/od2u/public_html/wp-includes/general-template.php(34): locate_template(Array, true) 
#6 /home/od2u/public_html/wp-content/themes/twentyten/index.php(16): get_header() 
#7 /home/od2u/public_html/wp-includes/template-loader.php(43): include('/home/od2u/publ...') 
#8 /home/od2u/public_html/wp-blog-header.php(16): require_once('/home/od2u/publ...') 
#9 /home/od2u/public_html/index.php(17): require( in /home/od2u/public_html/wp-content/plugins/link-monitor/link-monitor.php on line 33

I have looked everywhere for advice on how to sort this. The functions does exist, it isn't anything silly like a dollar sign or using the wrong type of parenthesis.

I have also cleared and disabled caching of the WSDL server and client side.

Client side call:

$c->getk($site, $server);

$c is the soap 开发者_开发问答client and getk is the function name.

Function server side:

function getk($website, $server)
{
    $ret_array('blah', 'blah2', 'blah3');
    return $ret_array;
}

And this is added to the soap server using:

$server->addFunction(array("getk", "getLinks", "getDirectLinks"));

Hope you guys can help :)


I think, the problem is in

$ret_array('blah', 'blah2', 'blah3');

Interpreter try to resolve this as function call, but can't find variable $ret_array


I had the same error and after some deeper examination, the problem appeared to be on the side of the Soap-server. The called routine (in this example the getk() function) produced a fatal error which resulted in the Soap-server not giving a proper response that could be interpreted by the Soap-client. If someone has the same error, please check the errorlogs of the Soap-server if possible. You will propably find that the called function produces a fatal error and is "thus" not returning any xml.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜