Link to home
Start Free TrialLog in
Avatar of tjyoung
tjyoung

asked on

Trying to query using SOAP/ soapClient

Hi,
I'm trying to use a webservice (.net if it matters).
Using the code directly below I get a response.
$options = array(
	'username' => "myusername",
	'password' => "mypassword"

);

$url = "https://service.mydomain.com/soap12";

$client = new SoapClient($url);
$client->__soapCall('login',$options);
$fcs = $client->__getFunctions();
dd($fcs);

Open in new window


I get a return so thinking something is working (shortened below):
array:145 [▼
  0 => "UNKNOWN ActivityChange(UNKNOWN $par)"
  1 => "UNKNOWN Admin(UNKNOWN $par)"
  2 => "UNKNOWN DirectIntefaceTest3(UNKNOWN $par)"
  3 => "UNKNOWN DirectIntefaceTest(UNKNOWN $par)"
  4 => "UNKNOWN LogEntryGet(UNKNOWN $par)"
  5 => "UNKNOWN LogEntryDetails(UNKNOWN $par)"
  6 => "UNKNOWN SystemUploads(UNKNOWN $par)"
  7 => "UNKNOWN TestUpload(UNKNOWN $par)"
  8 => "UNKNOWN AppointmentGet(UNKNOWN $par)"
]

Open in new window


I'm trying to use the AppointmentGet. Trying below:
$params = array(
	'AppointmentSince'  =>'2017-07-11T07:00:00',
	'AppointmentUntil'  =>'2017-07-11T012:00:00',
	'SerialNumber'		=> '9999'
);

$response = $client->__soapCall('AppointmentGet', $params);
also:
$response = $client->AppointmentGet($params);

Open in new window

Regardless same error:

SoapFault in TestController.php line 70: Internal Server Error
(line 70 being the $response line)

The company that provides the service has some documentation:
https://partnerhub.pbsdealers.com/soap12/metadata?op=AppointmentGet

Any ideas?
Avatar of Jim Riddles
Jim Riddles
Flag of United States of America image

I believe that you need to encapsulate your array as a SOAP object.  Try this:

$params_obj = new SoapVar($params, SOAP_ENC_OBJECT, 'AppointmentGet');
$response = $client->AppointmentGet($params_obj);

Open in new window


Let me know if that works for you.
Avatar of tjyoung
tjyoung

ASKER

l'm in laravel. Getting
Class 'Steele\Http\Controllers\SoapVar' not found
I've imported soapClient into laravel.
Trying to figure out the soapVar problem. Wondering if its a configuration issue on the server?
Avatar of tjyoung

ASKER

Checking the php setttings, everything seems enabled:

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
My apologies for the late reply.  Have you imported the SoapClient into your Laravel app?  Add this at the top of your app:

use SoapClient;

Open in new window


Let me know if that helps.
ASKER CERTIFIED SOLUTION
Avatar of Jim Riddles
Jim Riddles
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tjyoung

ASKER

Thank you. I'm working with it now.