SOAP API Uncaught SoapFault exception - php

I'm trying to upload a torrent into torcache.net, using their SOAP API.
<?php
$client = new SoapClient('http://torcache.net/torcache.wsdl');
$info_hash = $client->cacheTorrent(base64_encode(file_get_contents('test.torrent')));
print_r($info_hash);
?>
Here's what I receive:
Fatal error: Uncaught SoapFault exception: [HTTP] Not Found in D:\Web\data\localweb\test.php:4
Stack trace:
#0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://torcache...', 'urn:xmethods-de...', 1, 0)
#1 D:\Web\data\localweb\test.php(4): SoapClient->__call('cacheTorrent', Array)
#2 D:\Web\data\localweb\test.php(4): SoapClient->cacheTorrent('ZDg6YW5ub3VuY2U...')
#3 {main}
thrown in D:\Web\data\localweb\test.php on line 4

Refer this, see if you can get any help.
or
Try this:
<?php
try {
$x = #new SoapClient("http://torcache.net/torcache.wsdl");
} catch (Exception $e) {
echo $e->getMessage();
}
?>

Related

Uncaught exception 'No_Result_Exception' with message 'No results'

I'm working with this codeigniter script called Crysandrea, anyways everything was going smoothly until I tried out the trading system.
Here is the error.
Fatal error: Uncaught exception 'No_Result_Exception' with message 'No results' in C:\xampp\htdocs\application\core\CRYS_Model.php:97
Stack trace: #0 C:\xampp\htdocs\application\core\CRYS_Model.php(190):
CRYS_Model->_process_result(Object(CI_DB_mysql_result), 1) #1
C:\xampp\htdocs\application\controllers\trades.php(535):
CRYS_Composite_Model->findRelation('3', '1', '*', Array) #2 [internal
function]: Trades->accept_trade('2') #3
C:\xampp\htdocs\system\core\CodeIgniter.php(359):
call_user_func_array(Array, Array) #4 C:\xampp\htdocs\index.php(203):
require_once('C:\xampp\htdocs...') #5 {main} thrown in
C:\xampp\htdocs\application\core\CRYS_Model.php on line 97
Here's the code for CRYS_Model.php
protected function _process_result(&$result, $limit=1) {
if (!$result->result_array())
throw new No_Result_Exception();
if ($limit === 1)
return $result->row(0, static::$INNER_MODEL);
else
return $result->result(static::$INNER_MODEL);
}
If you need anything, please say so!

How to set up SOAP client and server using php

i have some problems with the soap client and soap server.
server.php on server side
class Server {
public function hello($someone) {
return "Hello ". $someone;
}
}
$options= array('uri'=>'http://localhost/');
$server=new SoapServer(NULL, $options);
$server->setClass('Server');
$server->handle();
index.php on client side
<?php
$options = array('location' => 'http://localhost/server.php',
'uri' =>'http://localhost/');
$client = new SoapClient(NULL, $options);
echo $client->hello('Greg');
I'm testing this local on xampp and get the Error:
What do i make wrong ? Can i test it localy or do i have to set up a server for this. If yes, is it possible to run this on IIS ?
Fatal error: Uncaught SoapFault exception: [HTTP] Not Found in
C:\xampp\htdocs\SOAP\index.php:8 Stack trace: #0 [internal function]:
SoapClient->__doRequest('http://localhos...',
'http://localhos...', 1, 0) #1 C:\xampp\htdocs\SOAP\index.php(8):
SoapClient->__call('hello', Array) #2
C:\xampp\htdocs\SOAP\index.php(8): SoapClient->hello('Greg') #3 {main}
thrown in C:\xampp\htdocs\SOAP\index.php on line 8

Invalid JSON in influxdb-php

When a query is made, it retuns 404, invalid json error.
I use 8083 as port. Is there any another port for api.
Below is the code I use. Any help is welcome.
<?php
require '/vendor/autoload.php';
$client = new InfluxDB\Client('153.148.25.44', '8083');
$database = $client->selectDB('Meters');
$result = $database->getQueryBuilder()
->select('*')
->from('GDATA')
->limit(2)
->getResultSet()
->getPoints();
//$result = $database->query('select * from GDATAlimit LIMIT 5;');
//$points = $result->getPoints();
//$lastQuery = $client->getLastQuery();
echo '<pre>';
var_dump($result);
?>
Tested database connection, it is working.
Version is 0.13
Fatal error:
Uncaught exception 'InvalidArgumentException' with message 'Invalid JSON' in C:\xampp\htdocs\projectone\vendor\influxdb\influxdb-php\src\InfluxDB\ResultSet.php:30
Stack trace: #0 C:\xampp\htdocs\projectone\vendor\influxdb\influxdb-php\src\InfluxDB\Driver\Guzzle.php(100): InfluxDB\ResultSet->__construct('404 page not fo...')
#1 C:\xampp\htdocs\projectone\vendor\influxdb\influxdb-php\src\InfluxDB\Client.php(198): InfluxDB\Driver\Guzzle->query()
#2 C:\xampp\htdocs\projectone\vendor\influxdb\influxdb-php\src\InfluxDB\Database.php(78): InfluxDB\Client->query('Meters', 'SELECT * FROM "...', Array)
#3 C:\xampp\htdocs\projectone\vendor\influxdb\influxdb-php\src\InfluxDB\Query\Builder.php(261): InfluxDB\Database->query('SELECT * FROM "...')
#4 C:\xampp\htdocs\projectone\home.php(10): InfluxDB\Query\Builder->getResultSet()
#5 {main} thrown in C:\xampp\htdocs\projectone\vendor\influxdb\influxdb-php\src\InfluxDB\ResultSet.php on line 30
API port for InfuxDB v0.13 is 8086. I was using 8083, which is used for web.

Fatal error: Uncaught SoapFault exception: [env:Client] Internal Error

I'm trying to send test message with my PHP SOAP client. I'm using BeSimpleSoap library because I had problems with standard PHP SOAP calss and NuSOAP class.
Part of the scriptis is:
$client = new BeSimple\SoapClient\SoapClient("GSBService.wsdl", array(
"trace"=>1,
"exceptions"=>1,
'location'=>$SERVICE_TEST,
"local_cert" =>$SOAP_cert,
'uri'=>$NAMESPACE_URI,
"passphrase"=>$cert_password,
"connection_timeout" => 60));
var_dump($client->echo('abc1234'));
print_r( $client->sendMessage($par_envelope));
echo "<p>Request :".htmlspecialchars($client->__getLastRequest()) ."</p>";
echo "<p>Response:".htmlspecialchars($client->__getLastResponse())."</p>";
echo "<p>Debug:".soapDebug($client)."</p>";
Error is:
string(57) "Request: 'abc1234'. Response: '2014-02-12T09:39:56.474Z'."
Fatal error: Uncaught SoapFault exception: [env:Client] Internal Error in C:\xampp\htdocs\NIAS\HZZO-OKP-SOAP.php:146 Stack trace: #0 C:\xampp\htdocs\NIAS\HZZO-OKP-SOAP.php(146): SoapClient->__call('sendMessage', Array) #1 C:\xampp\htdocs\NIAS\HZZO-OKP-SOAP.php(146): BeSimple\SoapClient\SoapClient->sendMessage(Array) #2 {main} thrown in C:\xampp\htdocs\NIAS\HZZO-OKP-SOAP.php on line 146
I tried:
ini_set('soap.wsdl_cache_enabled',0);
and got this:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing Schema: can't import schema from 'file:///schema/GSBSchema.xsd' in C:\xampp\htdocs\NIAS\BeSimpleSoap-master\src\BeSimple\SoapClient\SoapClient.php:113 Stack trace: #0 C:\xampp\htdocs\NIAS\BeSimpleSoap-master\src\BeSimple\SoapClient\SoapClient.php(113): SoapClient->SoapClient('\wsdl_9429a1dff...', Array) #1 C:\xampp\htdocs\NIAS\HZZO-OKP-SOAP.php(134): BeSimple\SoapClient\SoapClient->__construct('GSBService.wsdl', Array) #2 {main} thrown in C:\xampp\htdocs\NIAS\BeSimpleSoap-master\src\BeSimple\SoapClient\SoapClient.php on line 113
The problem was in encoding of $par_envelope.
After I encoded string in UTF-8 with utf8_encode I didn't get
Fatal error: Uncaught SoapFault exception: [env:Client] Internal Error

Fatal error: Uncaught exception 'Exception' with message 'Serialization of

Fatal error: Uncaught exception 'Exception' with message 'Serialization of 'SimpleXMLElement' is not allowed' in C:\xampp\htdocs\t9l_loyaltyprogram\common\lib\Yii\web\CHttpSession.php:138 Stack trace:
#0 C:\xampp\htdocs\t9l_loyaltyprogram\common\lib\Yii\web\CHttpSession.php(138): session_write_close()
#1 [internal function]: CHttpSession->close()
#2 {main} Next exception 'Exception' with message 'Serialization of 'SimpleXMLElement' is not allowed' in C:\xampp\htdocs\t9l_loyaltyprogram\common\lib\Yii\web\CHttpSession.php:138 Stack trace:
#0 C:\xampp\htdocs\t9l_loyaltyprogram\common\lib\Yii\web\CHttpSession.php(0): session_write_close()
#1 [internal function]: CHttpSession->close()
#2 {main} Next exception 'Exception' with message 'Serialization of 'SimpleXMLElement' is not allowed' in C:\xampp\htdocs\t9l_loyaltyprogram\common\lib\Yii\web\CHttpSession.php:138 Stack trace:
#0 C:\xampp\htdocs\t9l_loyaltyprogram\common\lib\Yii\web\CHttpSession.php(0): session_write_close()
#1 [internal function]: CHttpSession->close()
#2 {ma in C:\xampp\htdocs\t9l_loyaltyprogram\common\lib\Yii\web\CHttpSession.php on line 138
how to fix this issue i'm unable to find any answer
I had the same error. I corrected it using an array of session
foreach ($output['tab_displayId'] as $id_display => $id_param){
$test = new ClParaWidget($id_param, $id_display);
$output[$id_display] = $test->toString($id_display);
if (Yii::app()->session['S' . $id_display] != $output[$id_display])
Yii::app()->session['S' . $id_display] = $output[$id_display];
}
I give more explanation. If I want to save in a session value an array:
Yii::app()->session['data'] = $array_data;
sometimes, this code returns an error:
Fatal error: Uncaught exception 'Exception' with message 'Serialization of 'SimpleXMLElement' is not allowed' in C:\xampp\htdocs\t9l_loyaltyprogram\common\lib\Yii\web\CHttpSession.php:138 Stack trace:
for that, I propose to use a array of session like here:
foreach ($array_data as $id => $data)
Yii::app()->session['S_' . $id] = $data;

Categories