Hi,
I am working on a wbsite for a training centre.
I am querying a web service for the list of their courses.
There are three parametres in the query: centre, coursetype and courselocation.
When querying it directly or using SoapUI it can be queried using 1, 2, 3 or none of the parametres (none returns all courses). However, when I query it from within php I can only get a result if I use the first two parametres, but I want to only use the first "centre" so I can get a full list of all the courses for that centre.
This is my php code but instead of returning all courses for selected centre it will only return coursetype 1's for that centre, again, I need ALL courses returned.
<?php
$wsdl = "https://pm_for_link/courseinfo/courseinfo.asmx?WSDL";
$client = new SoapClient($wsdl);
$centre = 'CO';
$parameters = array(
"centre" => $centre,
"coursetype" => "1",
"courselocation" => " ",);
$values = $client->getCourseInfo($parameters);
$xml = $values->getCourseInfoResult->any;
print_r($xml);
?>
If I omit the coursetype parametre i get this error message:
Fatal error: Uncaught SoapFault exception: [Client] looks like we got no XML document in /location_of_file/test.php:15
Stack trace:
#0 /home/digi1816/public_html/test.php(15): SoapClient->__call('getCourseInfo', Array)
#1 /home/digi1816/public_html/test.php(15): SoapClient->getCourseInfo(Array)
#2 {main}
thrown in /location_of_file/test.php on line 15
this is the SOAP Request and Response:
POST /courseinfo/courseinfo.asmx HTTP/1.1
Host: PM For Host Address
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<getCourseInfo xmlns="http://pm_for_address.com/">
<centre>string</centre>
<coursetype>string</coursetype>
<courselocation>string</courselocation>
</getCourseInfo>
</soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<getCourseInfoResponse xmlns="http://pm_for_address.com/">
<getCourseInfoResult>xml</getCourseInfoResult>
</getCourseInfoResponse>
</soap12:Body>
</soap12:Envelope>
I have tried every combination I can think of but the only one that works and gives me any results is the above one with centre and coursetype parametres set.
Because of client confidentiality I can not put the web service link here but can PM it if anyone thinks they can help.
Appreciate any time or assitance offered,
Donna :)