I've also been trying to follow this tutorial and integrate with cake, but
without success. All I see is a blank page. Any ideas? Here is my code:
<?
class TestController extends AppController
{
var $components=array("RequestHandler");
var $uses=array();
function c()
{
Configure::write('debug',0);
$this->autoRender = FALSE;
App::import('Vendor','test',array('file'=>'nusoap/lib/nusoap.php'));
// This is location of the remote service
$client = new soapclient('http://localhost/test/server');
// Check for any errors from the remote service
$err = $client->getError();
if ($err) {
echo '<p><b>Error: ' . $err . '</b></p>';
}
// Call the SOAP method on the remote service
$person = array('firstname' => 'Fred', 'age' => 22);
$result = $client->call(
'hello', array('message' => new
soapval('id','Person',$person,false,'urn:AnyURN'))
);
// Check for any faults reported by the remote service
if ($client->fault) {
echo '<p><b>Fault: ';
print_r($result);
echo '</b></p>';
} else {
// Check for any errors from the remote service
$err = $client->getError();
if ($err) {
echo '<p><b>Error: ' . $err . '</b></p>';
} else {
// If everything is OK display the result
print $result['output_string'] . ' ';
if ( $result['allow'] == 1 ) {
print "You may continue...";
} else {
print "You are too young!";
}
}
}
}
function s()
{
Configure::write('debug',0);
$this->autoRender = FALSE;
App::import('Vendor','test',array('file'=>'nusoap/lib/nusoap.php'));
$server = new soap_server;
// This states the method which can be accessed.
$server->register('hello');
// This returns the result
$server->service($HTTP_RAW_POST_DATA);
}
// This is the method
function hello($input)
{
$output_string = 'Hello ' . $input['firstname'] .
'. You are ' . $input['age'] . ' years old.';
if ($input['age'] >= 18)
{
$allow = 1;
}
$output = array(
'output_string' => $output_string,
'allow' => $allow
);
return new soapval('return', 'HelloInfo', $output, false, 'urn:AnyURN');
}
}
?>
On Mon, Sep 8, 2008 at 1:28 AM, David C. Zentgraf <[EMAIL PROTECTED]> wrote:
>
> What's the problem with SOAP in Cake?
> I'm asking because I'll soon have to pull through a project with a
> tight schedule and I'll be needing SOAP in it.
> And as people like to say a lot here, there's still PHP in CakePHP, so
> I was counting on using the PHP SOAP functions without thinking too
> much. Any problems with them one needs to be aware of?
>
> Chrs,
> Dav
>
> On 8 Sep 2008, at 16:22, . wrote:
>
> > has anyone gotten soap or nusoap to work with cake 1.2?
> >
> > I've been trying to follow this tutorial, but haven't gotten it to
> > work yet.
> >
> >
> >
> http://bakery.cakephp.org/articles/view/a-component-to-help-creating-soap-services
> >
> > >
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---