Re: [SOAP] PHP Web Service:Uncaught SoapFault exception

[email protected] (DimG)
Newsgroups php.soap
Message-ID <[email protected]>
I solved the problem by doing this:

i added this function at the server script:

function soaputils_autoFindSoapRequest()    {
    global $HTTP_RAW_POST_DATA;
   
   if($HTTP_RAW_POST_DATA)
        return $HTTP_RAW_POST_DATA;
   
   $f = file("php://input");
  return implode(" ", $f);
}

and called handle():

$server->handle(soaputils_autoFindSoapRequest());

In addition i changed the first line at WSDL file 
from <?xml version="1.0" encoding="UTF-8"?>
to <?xml version="1.0"?>

and everything goes well!

Thanks for your help Richard!



Richard Quadling wrote:
> 
> 2010/1/4 DimG <[email protected]>:
>>
>> i see..
>> i take this:
>> SOAP-ENV:ServerBad Request. Can't find HTTP_RAW_POST_DATA
>>
>> In my php.ini file this is set to on
>> always_populate_raw_post_data = On
>>
>>
>>
>>
>> Richard Quadling wrote:
>>>
>>> 2010/1/4 DimG <[email protected]>:
>>>>
>>>> If i make the call without a SOAP client, i take the message
>>>> Call to undefined function getQuote().
>>>>
>>>>
>>>>
>>>>
>>>> Richard Quadling wrote:
>>>>>
>>>>> 2010/1/3 DimG <[email protected]>:
>>>>>>
>>>>>> hi everyone!
>>>>>>
>>>>>> When i run web services applications i take always this message:
>>>>>>
>>>>>> Fatal error: Uncaught SoapFault exception: [Client] looks like we got
>>>>>> no
>>>>>> XML
>>>>>> document in C:\Program Files\Apache
>>>>>> Group\Apache2\htdocs\WebServices\SOAP_EXTENSION\StockQuote\client3.php:3
>>>>>> Stack trace: #0 [internal function]: SoapClient->__call('getQuote',
>>>>>> Array)
>>>>>> #1 C:\Program Files\Apache
>>>>>> Group\Apache2\htdocs\WebServices\SOAP_EXTENSION\StockQuote\client3.php(3):
>>>>>> SoapClient->getQuote('ibm') #2 {main} thrown in C:\Program
>>>>>> Files\Apache
>>>>>> Group\Apache2\htdocs\WebServices\SOAP_EXTENSION\StockQuote\client3.php
>>>>>> on
>>>>>> line 3
>>>>>>
>>>>>> Does anyone know anything about the problem?
>>>>>> i have soap extension enabled, and have tried in PHP 5.0.5, 5.1.4.
>>>>>>
>>>>>> i attach the code if that helps
>>>>>> http://old.nabble.com/file/p27002759/PHP%2Bweb%2Bservice.txt
>>>>>> PHP+web+service.txt
>>>>>> Thanks
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://old.nabble.com/PHP-Web-Service%3AUncaught-SoapFault-exception-tp27002759p27002759.html
>>>>>> Sent from the Php - Soap mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>> --
>>>>>> PHP Soap Mailing List (http://www.php.net/)
>>>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>>>
>>>>>>
>>>>>
>>>>> If you make the call without a SOAP client, what output do you get?
>>>>>
>>>>> Most likely, the output isn't XML.
>>>>>
>>>>> This may show you an error on the SOAP server.
>>>>>
>>>>> --
>>>>> -----
>>>>> Richard Quadling
>>>>> "Standing on the shoulders of some very clever giants!"
>>>>> EE : http://www.experts-exchange.com/M_248814.html
>>>>> Zend Certified Engineer :
>>>>> http://zend.com/zce.php?c=ZEND002498&r=213474731
>>>>> ZOPA : http://uk.zopa.com/member/RQuadling
>>>>>
>>>>> --
>>>>> PHP Soap Mailing List (http://www.php.net/)
>>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/PHP-Web-Service%3AUncaught-SoapFault-exception-tp27002759p27015983.html
>>>> Sent from the Php - Soap mailing list archive at Nabble.com.
>>>>
>>>>
>>>> --
>>>> PHP Soap Mailing List (http://www.php.net/)
>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>
>>>>
>>>
>>> No. I mean, your SOAP client makes a call to a URL. What is the URL?
>>> Put that URL in your browser. What output do you get?
>>>
>>>
>>> --
>>> -----
>>> Richard Quadling
>>> "Standing on the shoulders of some very clever giants!"
>>> EE : http://www.experts-exchange.com/M_248814.html
>>> Zend Certified Engineer :
>>> http://zend.com/zce.php?c=ZEND002498&r=213474731
>>> ZOPA : http://uk.zopa.com/member/RQuadling
>>>
>>> --
>>> PHP Soap Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/PHP-Web-Service%3AUncaught-SoapFault-exception-tp27002759p27016917.html
>> Sent from the Php - Soap mailing list archive at Nabble.com.
>>
>>
>> --
>> PHP Soap Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> 
> So, now create a new SOAP server.
> 
> Actually it isn't going to produce anything useful _for_ the client,
> just log everything it gets _from_ the client ...
> 
> <?php
> // Datestamp.
> $s_Report = 'Date : ' . date('r') . PHP_EOL;
> 
> 
> // Report GET/POST/COOKIE from client.
> foreach(array('GET', 'POST', 'COOKIE') as $s_VarNamePart)
> 	{
> 	$s_VarName = "_$s_VarNamePart";
> 	$s_Report .= $s_VarName . PHP_EOL . var_export($$s_VarName, True) .
> PHP_EOL . PHP_EOL;
> 	}
> 
> // Report always_populate_raw_post_data
> $s_Report .= 'always_populate_raw_post_data is set to ' .
> var_export(ini_get('always_populate_raw_post_data'), True) . PHP_EOL .
> PHP_EOL;
> 
> // Report contents of $HTTP_RAW_POST_DATA
> if (isset($HTTP_RAW_POST_DATA))
> 	{
> 	$s_Report .= '$HTTP_RAW_POST_DATA = ' .
> var_export($HTTP_RAW_POST_DATA, True) . PHP_EOL . PHP_EOL;
> 	}
> else
> 	{
> 	$s_Report .= '$HTTP_RAW_POST_DATA does not exist.' . PHP_EOL . PHP_EOL;
> 	}
> 
> // Report contents of php://input
> $s_Report .= 'php://input = ' . file_get_contents('php://input') .
> PHP_EOL . PHP_EOL;
> 
> file_put_contents('./request.log', $s_Report);
> 
> echo nl2br($s_Report);
> ?>
> 
> 
> Use this script temporarily as your soap server.
> 
> Run the client - it will give you an error - ignore it.
> 
> Look at the log file produced to see EXACTLY what was sent to the script.
> 
> If you run the script directly, then you get output like ...
> 
> Date : Tue, 05 Jan 2010 09:38:29 +0000
> _GET
> array (
> )
> 
> _POST
> array (
> )
> 
> _COOKIE
> array (
> 'PHPSESSID' => '0EZVYvx4L0kXHpvNygfkSofbIq0',
> )
> 
> always_populate_raw_post_data is set to ''
> 
> $HTTP_RAW_POST_DATA does not exist.
> 
> php://input =
> 
> 
> sort of thing.
> 
> 
> -- 
> -----
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
> 
> -- 
> PHP Soap Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/PHP-Web-Service%3AUncaught-SoapFault-exception-tp27002759p27026703.html
Sent from the Php - Soap mailing list archive at Nabble.com.
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.