PHP SOAP fatal error message - php

My webserver has SOAP installed correctly (phpinfo has Soap Client/Server - Enabled).
I'm trying to create a SOAP request to a remote magento store, and I'm getting this error message:
[Mon Aug 29 20:13:59 2011] [error] [client 79.178.13.67] PHP Fatal error: Uncaught SoapFault exception: [0] Unable to load Soap extension on the server in /home/example/public_html/mag/index.php:3
Stack trace:
#0 [internal function]: SoapClient->__call('login', Array)
#1 /home/example/public_html/mag/index.php(3): SoapClient->login('user', 'pass')
#2 {main}\n thrown in /home/example/public_html/mag/index.php on line 3
Code snippet here:
$client = new SoapClient('http://www.example.com/api/soap/?wsdl=1');
$session = $client->login('user','pass');
$attributeSets = $client->call($session,'product_attribute_set.list');
$set = current($attributeSets);
$sku = 'iphone-12345';
$imagePath="../image.jpg";
$newProductData = array(
'name' => 'iPhone',
'websites' => array(1),
'short_description' => 'short description',
'description' => 'description',
'price' => 150,
'status' => '1',
);
$newImage = array(
'file' => array(
'name' => 'file_name',
'content' => base64_encode(file_get_contents($imagePath)),
'mime' => 'image/jpeg'
),
'label' => 'Cool Image',
'position' => 0,
'types' => array('image','small_image','thumbnail'),
'exclude' => 0
);
$imageFilename = $client->call($sessionId, 'product_media.create', array($sku,$newImage));
$productId = $client->call($session,'product.create',array('simple', $set['set_id'],$sku,$newProductData));
echo $productId;
Any ideas?
Thanks,

Try to updating Server side of WSDL (where SoapServer runs)
update :
PHP
PHP-SOAP
and dependencies ;-)
maybe outdated version of php (and/or soap) on server side

Related

Ride reminder api 404 error

When we are calling Uber Products API, its working perfect but when we call Ride Reminder API, we getting following 404 errors:
PHP Fatal error: Uncaught exception GuzzleHttp\Exception\ClientException
with message
Client error: POST https://sandbox-api.uber.com/v1.2/reminders
resulted in a 404 Not Found response:
404 page not found in
/var/www/html/uber/uber/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
Stack trace:
#0 /var/www/html/uber/uber/vendor/guzzlehttp/guzzle/src/Middleware.php(65):
GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request),
Object(GuzzleHttp\Psr7\Response))
#1 /var/www/html/uber/uber/vendor/guzzlehttp/promises/src/Promise.php(203):
GuzzleHttp\Middleware::GuzzleHttp{closure}(Object(GuzzleHttp\Psr7\Response))
#2 /var/www/html/uber/uber/vendor/guzzlehttp/promises/src/Promise.php(156):
GuzzleHttp\Promise\Promise::callHandler(1,
Object(GuzzleHttp\Psr7\Response), Array)
#3 /var/www/html/uber/uber/vendor/guzzlehttp/promises/src/TaskQueue.php(47):
GuzzleHttp\Promise\Promise::GuzzleHttp\Promise{closure}()
#4 /var/www/html/uber/uber/vendor/guzzlehttp/promises/src/Promise.php(246):
Guzzle in
/var/www/html/uber/uber/vendor/stevenmaguire/uber-php/src/Client.php
on line 173
We are using following sample code to work out, let me know what could be issue.
<?php
include "vendor/autoload.php";
$client = new Stevenmaguire\Uber\Client(array(
'access_token' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
'server_token' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
'use_sandbox' => true, // optional, default false
'version' => 'v1.2', // optional, default 'v1.2'
'locale' => 'en_US', // optional, default 'en_US'
));
$products = $client->getProducts(array(
'latitude' => '41.85582993',
'longitude' => '-87.62730337'
));
var_dump($products);
$attributes = array(
'reminder_time' => '1429294463',
'phone_number' => '555-555-5555',
'event' => array(
'time' => '1515750429',
'name' => 'John with friends',
'location' => 'Dolores Park',
'latitude' => '37.759773',
'longitude' => '-122.427063',
'product_id' => "737d4e43-9e12-4a81-add3-acb101bab4c7",
),
);
$reminder = $client->createReminder($attributes);
var_dump($reminder);
Please help us to fix this.
Documentation is removed for ride reminders from http://developer.uber.com and they are not currently supported.

Uncaught SoapFault exception: [HTTP] Could not connect to host...[internal function]

I have a PHP Client.
The Server WSDL is https://34.200.105.231/VENTAS_SOAP/VentaService.svc?wsdl
The webservices generated by the session work without any problems
$params = array('soap_version' => SOAP_1_2);
$ws = new SoapClient(
'https://34.200.105.231/VENTAS_SOAP/VentaService.svc?wsdl',
$params
);
$parametros = array( 'sesion' => array(
'IDSesion' => "44444",
'IDCliente' => "rick",
'IDEmpresa' => "rick",
'IDUsuario' => "user",
'Token' => '',
),'codigo' => 'ac',
'descripcion' => '',
'cantidadRegistros' => '1',
'pagina' => '0'
);
print_r(print_r($ws->__soapCall("ConsultaArticulosServicios",$parametros)));
Not work, Response:
Fatal error: Uncaught SoapFault exception:
[HTTP] Could not connect to host in /home/admin/web/xxxxxxxx/public_html/nusoapfontana/metodos/index3.php:41
Stack trace:
#0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'https://df-0e7d...', 'VentaServicio/V...', 2, 0)
#1 /home/admin/web/xxxxxxxx/public_html/nusoapfontana/metodos/index3.php(41): SoapClient->__soapCall('ConsultaArticul...', Array)
#2 {main} thrown in /home/admin/web/xxxxxxxx/public_html/nusoapfontana/metodos/index3.php on line 41
If I can access the Login function found here:
Http://34.200.105.231/SID/Service.svc?wsdl
Here I generate the data for the session.

SoapFault exception: [soap:Server] Index: 1, Size: 1 error in php

I am trying to get data from an API service using SOAP.Everything works fine except the data.
Here is the code
$body=array(
'Origin' => 'BOM',
'Destination' => 'DEL',
'DepartDate' => '2013-09-05',
'ReturnDate' => '2013-09-06',
'AdultPax' => '1',
'ChildPax' => '0',
'InfantPax' => '0',
'Currency' => 'INR',
'Clientid' => 'XXX',
'Clientpassword' => '*4X',
'Clienttype' => 'XXXX',
'Preferredclass' => 'E',
'mode' => 'ONE',
'PreferredAirline' => 'AI,G8,IC,6E,9W,S2,IT,9H,I7,SG');
Php code for executing SOAP
$location_URL='http://59.162.33.102/ArzooWS/services/DOMFlightAvailability?wsdl';
$client = new SoapClient('http://59.162.33.102/ArzooWS/services/DOMFlightAvailability?wsdl');
try
{
print_r($client->__getFunctions());
$result = $client->__call('getAvailability',$body);
print_r($result);
}catch(Exception $e){
echo $e;
}
Result of print_r($client->__getFunctions()) returns getAvailability,when try to get the data i will get the exception
SoapFault exception: [soap:Server] Index: 1, Size: 1 in C:\xampp\htdocs\apihack\index.php:80 Stack trace: #0 C:\xampp\htdocs\apihack\index.php(80): SoapClient->__call('getAvailability', Array) #1 {main}

Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object hasn't 'source' property in

I am trying to connect osticket support system with opencart.
I tried to integrate with this SOAP
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
$osticket = new SoapClient('http://www.website.com/osticket/api/soap/index.php?wsdl');
// Set up the parameters
$args = array(
'username' => 'WebService',
'password' => 'MySecr3tp#ssword',
'origin' => 'Web',
'alertUser' => true,
'alertStaff' => true,
'ticketData' => array(
'name' => utf8_encode('sir Test'),
'email' => utf8_encode('some#email.com'),
'subject' => utf8_encode('testing'),
'message' => utf8_encode('this is a message'),
'topicId' => 3, //topic Website Support
'deptId' => 2, //department Sales
'staffId' => null,
'duedate' => null,
'time' => null,
'pri' => 2, // default priority
'phone' => null,
)
);
try {
// Send the request and receive the ticketID
$result = $osticket->__call('ostTicket.open',$args);
}
catch (SoapFault $e) {
throw $e;
}
?>
The error I get is
Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object hasn't 'source' property in /home/website/website.com/catalog/view/theme/testtheme/template/information/contact.tpl:60
Stack trace:
#0 /home/website/website.com/catalog/view/theme/testtheme/template/information/contact.tpl(60): SoapClient->__call('ostTicket.open', Array)
#1 /home/website/website.com/vqmod/vqcache/vq2-system_engine_controller.php(67): require('/home/website/tu...')
#2 /home/website/website.com/catalog/controller/information/contact.php(127): Controller->render()
#3 /home/website/website.com/vqmod/vqcache/vq2-system_engine_front.php(43): ControllerInformationContact->index()
#4 /home/website/website.com/vqmod/vqcache/vq2-system_engine_front.php(29): Front->execute(Array, Array)
#5 /home/website/website.com/index.php(238): Front->dispatch(Object(Action))
#6 {main} thrown in/home/website/website.com/catalog/view/theme/testtheme/template/information/contact.tpl on line 60
Here is the line 60 (/template/information/contact.tpl):
$result = $osticket->__call('ostTicket.open',$args);
I'd be grateful if anyone kindly help me in this issue.
SOAP Info
This is from phpinfo
Soap Client enabled
Soap Server enabled
Directive Local Value Master Value
soap.wsdl_cache 1 1
soap.wsdl_cache_dir /tmp /tmp
soap.wsdl_cache_enabled 1 1
soap.wsdl_cache_limit 5 5
soap.wsdl_cache_ttl 86400 86400
I'm also having same problem, and I've been searching the web and found no answer. So, I traced it myself. And I loved to share how I fixed it.
As you can see on the http://www.website.com/osticket/api/soap/index.php?wsdl (change it to your URL)
under the ( xsd:complexType name="TicketData" ),which parameters needed for ostTicket.open
you can see that there's an element (xsd:element name="source" type="xsd:string") named source, so that's what is missing on the ticketData array. Just add that inside your ticketData array, can be assigned w/ null.
ex. 'source' => null,
This solved my problem. Hope it helps.

Consume ASP.NET WebService In php and return soap error

i am trying to calling .net webservice in php
below is my code.
<?php
$client = new SoapClient("http://test.etech.net/PanelIntegration/PanelIntegration.asmx?wsdl");
<?php
$sh_param = array(
'Username' => 'IntegratorLPI',
'Password' => 'password531');
$headers = new SoapHeader('http://wms.etech.net/', 'UserCredentials', $sh_param);
$client->__setSoapHeaders($headers);
$params = array('CustomerName' => 'Mr Smith','ContactMobileNo' => '01237 376347',
'AddressLine1' => '33 Amblecote Road',
'AddressTown' => 'Cambridgeshire',
'AddressPostCode' => 'NW23 6TR',
'VendorAddressLine1' => '80 Norton Road',
'VendorAddressTown' => 'Hickley ',
'VendorAddressCounty' => 'Cambridgeshire',
'VendorAddressPostCode' => 'NW23 2AQ',
'RegionalOfficeID' => '3',
'ExternalNotes' => 'Case Accepted',
'UPRN' => '',
'InstructionTypeID' => '2',
'PropertyTypeID' => '11',
'PropertyTenure' => '2',
'SurveyorID' => '23',
'RRN' => '0240-9002-0391-3520-0020',
'NewInstruction'=> 'true',
'StatusID' => '1'
);
$result = $client->__soapCall("UpdateInstruction", $params );
print_r( $result);
?>
i have got this error
Fatal error: Uncaught SoapFault exception: [soap:Server] Server was unable to process request. ---> Object reference not set to an instance of an object. in C:\xampp\htdocs\test2.php:33 Stack trace: #0 C:\xampp\htdocs\test2.php(33): SoapClient->__soapCall('UpdateInstructi...', Array) #1 {main} thrown in C:\xampp\htdocs\test2.php on line 33
You probably need to send something like:
$result = $client->__soapCall("UpdateInstruction", array('Instruction' => $params );
Where Instruction is the name of the object that you are passing.
It looks like a NullReferenceException was thrown on the server side. So, it's a matter of the parameters to whatever function is occurring on the server side generating that error.
Regardless of why, per best practices, this is an error in the .NET service. The NullReferenceException should really be replaced with something more specific.
Can you get in touch with whomever wrote the service to get more information to troubleshoot? It's quite possible that you have a parameter misnamed in your $params array, but you're probably going to need some help from the service writer.

Categories