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?
// 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.';
> 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.
On Mon, Sep 8, 2008 at 1:40 AM, . <lun...@gmail.com> wrote: > 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();
> // 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.';
> On Mon, Sep 8, 2008 at 1:28 AM, David C. Zentgraf <dec...@gmail.com>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.
david, theoretically there is no problem with soap on cakephp. it's just that i am having trouble integrating it into cake. any help would be appreciated.
> On Mon, Sep 8, 2008 at 1:40 AM, . <lun...@gmail.com> wrote:
>> 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();
>> // 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.';
>> On Mon, Sep 8, 2008 at 1:28 AM, David C. Zentgraf <dec...@gmail.com>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.
Don't know the exact problems you have but here's a piece of my soap
implementation. Please note that this is done with php5's sope
extension, not nusoap.
In my site:
domain.com/soapcontroller/wsdl
renderes a wsdl file like so:
public function wsdl(){
$this->ext = ".wsdl";
$this->layout = false;
Configure::write('debug', 0); //else renders debug info
$this->RequestHandler->respondAs('xml');
}
//and the main method that handles any soap request
domain.com/soapcontroller/service
public function service(){
//turn of rendering
$this->layout = false;
$this->autoRender = false;
Configure::write('debug', 0);
$server = $this->getSoapServer(); //return new SoapServer();
$server->setObject($this); //every soap method is defined in this
controller
$server->handle();
}
maybe you could check the xml input/output if cake hasn't put any
(debug) html in it.
Also: I used soapUI for debugging, pretty handy :-)
> david, theoretically there is no problem with soap on cakephp. it's just
> that i am having trouble integrating it into cake. any help would be
> appreciated.
> > On Mon, Sep 8, 2008 at 1:40 AM, . <lun...@gmail.com> wrote:
> >> 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();
> >> // 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.';
> >> On Mon, Sep 8, 2008 at 1:28 AM, David C. Zentgraf <dec...@gmail.com>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.
Marcelius, how do you generate the wsdl files? do you use jool.nl's wsdl component, or does php's soap extension generate the wsdl files for you? thanks
On Mon, Sep 8, 2008 at 2:56 AM, Marcelius <mraaijmak...@gmail.com> wrote:
> Hi
> Don't know the exact problems you have but here's a piece of my soap > implementation. Please note that this is done with php5's sope > extension, not nusoap.
> In my site: > domain.com/soapcontroller/wsdl > renderes a wsdl file like so:
> public function wsdl(){ > $this->ext = ".wsdl"; > $this->layout = false; > Configure::write('debug', 0); //else renders debug > info > $this->RequestHandler->respondAs('xml'); > }
> //and the main method that handles any soap request > domain.com/soapcontroller/service > public function service(){ > //turn of rendering > $this->layout = false; > $this->autoRender = false; > Configure::write('debug', 0);
> $server = $this->getSoapServer(); //return new > SoapServer(); > $server->setObject($this); //every soap method is > defined in this > controller
> $server->handle(); > }
> maybe you could check the xml input/output if cake hasn't put any > (debug) html in it.
> Also: I used soapUI for debugging, pretty handy :-)
> On 8 sep, 10:52, . <lun...@gmail.com> wrote: > > david, theoretically there is no problem with soap on cakephp. it's just > > that i am having trouble integrating it into cake. any help would be > > appreciated.
> > > On Mon, Sep 8, 2008 at 1:40 AM, . <lun...@gmail.com> wrote:
> > >> 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();
> > >> On Mon, Sep 8, 2008 at 1:28 AM, David C. Zentgraf <dec...@gmail.com > >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.
On Mon, Sep 8, 2008 at 10:40 AM, . <lun...@gmail.com> wrote: > 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();
> // 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.';
> return new soapval('return', 'HelloInfo', $output, false, 'urn:AnyURN'); > }
> }
> ?>
> On Mon, Sep 8, 2008 at 1:28 AM, David C. Zentgraf <dec...@gmail.com> 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.