[PEAR-BUG] Bug #15825 [NEW]: PEAR:SOAP Error

[email protected] ("gbvasu at gmail dot com")
Newsgroups php.pear.doc
Message-ID <[email protected]>
From:             #e36f90150a1094864d2
Operating system: centos3
Package version:  
PHP version:      4.3.2
Package:          Documentation
Bug Type:         Bug
Bug description:  PEAR:SOAP Error

Description:
------------
Error: HTTP Response 406 Not Found, Server message: Not 

Test script:
---------------
Client Script 


/* Create a new SOAP client using PEAR::SOAP's SOAP_Client-class: */
    $client = new
SOAP_Client('http://ipaddress/nusoap/classes/test.php');
	/* Define the parameters we want to send to the server's
helloWorld-function.
       Note that these arguments should be sent as an array: */
		$params = array('inmessage'=>'World');
		/* Send a request to the server, and store its response in $response:
*/
$response = $client->call('helloWorld',$params,array('namespace'=>
'urn:helloworld'));
/* Print the server-response: */
echo "Error: ".$response->getMessage()."\n";


Server Script


/* Include PEAR::SOAP's SOAP_Server class: */
   include_once('SOAP/Server.php');
    
/* To define a new SOAP service with PEAR::SOAP, we need to
       construct a class that defines the characteristics for our
       service. An instance of this class is then used by SOAP_Server
       to create a new SOAP service: */
    class SOAP_Hello_Server
    {
	/* $dispatch_map helps SOAP_Server figure out which parameters
			are used with the methods: */
			var $dispatch_map = array(); 
			
			/* dispatch mapping is optional.  It is used in non-wsdl servers to
allow       for being more explicit with what arguments and types are
passed in and out.*/

			/* Here's the constructor for out class. It is used to define
			   $dispath_map: */
			function SOAP_Hello_Server()
			{
				$this->dispatch_map['helloWorld'] = array(
															'in'    => array('inmessage'=>'string'),
															'out'   => array('outmessage'=>'string')
														 );
			}
			/* Of course, we also need to define all the functions that should
           be requestable through our server: */
        function helloWorld($inmessage)
        {
            /* Generate a SOAP error if the argument was not valid: */
            if($inmessage == '')
            {
                /* The SOAP error is generated by the SOAP_Fault class:
*/
                //$fault = new SOAP_Fault('You must supply a valid
string!','12345');
                return "test";
            }
            else
            {
                /* If the argument is okay, we submit out return message:
*/
                return "Hello $inmessage!";
            }
        }
    }

	/* Create a new SOAP server using PEAR::SOAP's SOAP_Server class: */
    $server = new SOAP_Server();


/* Create an instance of our class: */
    $soaphelloserver = new SOAP_Hello_Server();

	/* Register this instance to the server class: */
    $server->addObjectMap($soaphelloserver,array('namespace'=>
'urn:helloworld')););

/* The following line starts the actual service: */
    $server->service($HTTP_RAW_POST_DATA);




Actual result:
--------------
Error: HTTP Response 406 Not Found, Server message: Not 

-- 
Edit bug report at http://pear.php.net/bugs/bug.php?id=15825&edit=1
--
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.