I am using MODx to create an application that will process data, store it, and serve it up via a basic SOAP interface. If necessary, I can put the SOAP server outside of MODx, but I would much prefer to put it inside a snippet so that it will be able to access the data through xPDO objects.
So far, I am in the early stages of learning about SOAP. Following online tutorials, I have gotten a basic SOAP server/client setup going on the development box, with server and client living in their own PHP files outside of MODx. I now am trying to take this same code and place it in a snippet, which is called on the page /server (using friendly URL's). Here is the snippet code:
(This, by the way, is a valid snippet - part of my 'spiadmin' component. It will work with a minimal "return 'hello world'" example.)
<?php
$spi = $modx->getService('spiadmin','Spiadmin',$modx->getOption('core_path').'components/spiadmin/model/spiadmin/',$scriptProperties);
if (!($spi instanceof Spiadmin)) return '';
$quotes = array(
"ibm" => 98.42
);
function getQuote($symbol) {
global $quotes;
return $quotes[$symbol];
}
ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache
$server = new SoapServer("stockquote.wsdl");
$server->addFunction("getQuote");
$server->handle();
Most of this is directly copy/pasted from the SOAP server tutorial I'm using.
The SOAP client fails silently when directed to /server through the WSDL file. Here's what /server outputs when accessed directly:
Notice: ob_end_clean(): failed to delete buffer default output handler. in ... {usual filenames, call stacks etc.}
Can someone tell me:
- What does that error mean?
- Is what I want to do - run a SOAP server from inside MODx - even possible?
[ed. note: polrbear last edited this post 13 years, 9 months ago.]