Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- set_include_path( '../zf1/library/' . get_include_path());
- require_once "Zend/Loader/Autoloader.php";
- Zend_Loader_Autoloader::getInstance();
- if ( isset( $_GET['wsdl']))
- {
- $auto = new Zend_Soap_AutoDiscover();
- $auto->setClass('Foo');
- $auto->handle();
- }
- else if ( empty( $HTTP_RAW_POST_DATA ))
- {
- $client = new Zend_Soap_Client('http://localhost/zstest.php?wsdl' );
- try
- {
- echo 'Elements: ', $client->ping( array( 'blah' => null )), '<br />';
- }
- catch ( Exception $e )
- {
- echo 'Exception caught: ', $e->faultcode , ' - ', $e->faultstring, '<br />';
- }
- echo '<h2>Request</h2><br /><pre>', htmlentities( $client->getLastRequest()), '</pre>';
- echo '<h2>Response</h2><br /><pre>', htmlentities( $client->getLastResponse()), '</pre>';
- }
- else
- {
- $server = new Zend_Soap_Server( 'http://localhost/zstest.php?wsdl' );
- $server->setClass( 'Foo' );
- $server->handle();
- }
- class Foo
- {
- /** @return int */
- public function ping( $testData = null )
- {
- return count( $testData );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement