SOAP Issue

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
PhilAJ52
New php-forum User
New php-forum User
Posts: 3
Joined: Fri Feb 23, 2018 7:53 am

Wed Dec 04, 2019 10:25 am

I've create a SOAP Server using the PHP Soap functions. It has 3 functions in it and is initialised as follows;

Code: Select all

// Initialise the SOAP Server 
$opts = Array();
$opts['compression'] = SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP;
$server = new SoapServer('SOTBWSDL.wsdl', $opts);
$server->addFunction('getAvailability');
$server->addFunction('putReservation');
$server->addFunction('putCancelBooking');
$server->handle();
There are then 3 Functions as defined with the code in for each .

I have created a test client which makes the call as;

Code: Select all

$client = new SoapClient('http://xxxxxxxxx/SOTBWSDL.wsdl',array('trace'=>1,'exceptions=>1'));
$res   = $client->getAvailability($xmlparams);
This works and returns data as expected.

However - if I try the call as

Code: Select all

$res   = $client->putReservation($xmlparams);   (To another function) 
it is the first function (get Availability) that is executed.


Question 1: Are separate Functions ok to use - -or do they need to be in a Class?

Question 2: No Errors are thrown regarding the WSDL so I presume this must be ok ....

What reasons could cause this? Any help greatfully received.

Phil
Post Reply