TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 01-12-2010, 01:06 PM   #1 (permalink)
The Acquainted
 
JaoudeStudios's Avatar
 
Join Date: Jul 2009
Location: Surrey
Posts: 105
Thanks: 1
JaoudeStudios is on a distinguished road
Default ZF: Zend_Soap_Client

I am trying to use Zend_Soap_Client, but I can not find a simple example.

I would like to use it without wsdl, can anyone help me with a simple example.

Thanks.
__________________
JaoudeStudios.com | JaoudeStudios.com Forum | JaoudeStudios.com Blog
OpenSource is the road ahead...!
JaoudeStudios is offline  
Reply With Quote
Old 01-13-2010, 02:50 PM   #2 (permalink)
The Wanderer
 
Join Date: Jan 2010
Posts: 7
Thanks: 0
Cypher is on a distinguished road
Default

It's quite easy to add wdsl support. Here's a quick example:

PHP Code:
class Api_SoapController extends Zend_Controller_Action
{

    
/**
     * Process all incoming SOAP requests
     *
     * @return void
     */
    
public function indexAction()
    {
        
// extract wsdl parameter
        
$wsdl $this->_getParam('wsdl'null);
        
$wsdl = ($wsdl !== null);

        
// handle request
        
if ($wsdl === true) {
            
$server = new Zend_Soap_AutoDiscover();
        } else {
            
$protocol strtolower(array_shift(explode('/'$_SERVER['SERVER_PROTOCOL'])));
            
$wsdl_url sprintf('%s://%s/api/soap?wsdl'$protocol$_SERVER['HTTP_HOST']);
            
$server = new Zend_Soap_Server($wsdl_url);

            
// ...
            // add all your classes
            // $server->setClass('class', 'namespace');
            // ...

            
print $server->handle();
        }
    }


Something like that. I haven't tested the code, just compiled it from different locations I have (I have it in a more complex way).

So in this case your post url is
http://yourdomain.com/api/soap
and your wsdl url is
http://yourdomain.com/api/soap?wsdl

Hope that helps
Cypher is offline  
Reply With Quote
Old 01-29-2010, 10:50 AM   #3 (permalink)
The Acquainted
 
JaoudeStudios's Avatar
 
Join Date: Jul 2009
Location: Surrey
Posts: 105
Thanks: 1
JaoudeStudios is on a distinguished road
Default

Thanks, but ideally I would like to use it without wsdl. I managed to figure it out, it was quite easy but the ZF docs are not the best :(
__________________
JaoudeStudios.com | JaoudeStudios.com Forum | JaoudeStudios.com Blog
OpenSource is the road ahead...!
JaoudeStudios is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 11:20 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design