AnsweredAssumed Answered

web services in PHP vs. Python

Question asked by hanleybrand on Aug 30, 2016
Latest reply on Sep 1, 2016 by david.cartwright

I'm having bizarre troubles with web services, probably due to inconsistencies between the different SOAP libraries*, but still I'm finding that having solved or figured out one WS call in one language doesn't necessarily translate to another.


In this particular case, I'm trying to work with groups. For example, I can get this to work in python:


#  c = Client(url, autoblend=True)
gg_headers = create_headers('getGroup', "session", sessionId, 'Course.WS')
c.set_options(soapheaders=gg_headers, port='Course.WSSOAP12port_https')
cgf = c.factory.create('ns1:GroupFilter')
cgf.filterType = 2
gg = c.service.getGroup(course_id, [cgf])
ggg = [{'title': g['title'], 'id': g['id'], 'available': g['available']} for g in gg]
### json.dumps(ggg) == [{"available": true, "id": "_20733_1", "title": "GUI group"},  ### {"available": true, "id": "_22156_1", "title": "Go Group"}, ###  {"available": true, "id": "_22157_1", "title": "Wat Group"}]


but the analogue in PHP would be


$blackboard = new BbPhp($server);
// ((skipped passwords, login, etc  -- that's working)
$group_args = array('courseId'=>$course_id, "filter" => array("filterType" => 2));
$group = $blackboard->Course("getGroup", $group_args);
// unfortunately, $group is NULL
// I've also tried 
$group_args = array($course_id, "filter" => array("filterType" => 2));
// same deal


Maddeningly, the "same" operation (in quotes because it's not the same at all) for Courses (i.e. Course.WS.getCourse) works fine in PHP


 $this_course = $blackboard->Course("getCourse", array("filterType" => '3', 'ids' => $course_id));
 $course_name = $this_course['name'];  // $course_name = "Testing Group WS"  in this case


but I can't get it to work in python:


headers = create_headers('getCourse', "session", session_id, 'Course.WS')
filter = c.factory.create('ns1:CourseFilter')
filter.filterType = 3
filter.ids = '_70515_1'
c.set_options(soapheaders=headers, port='Course.WSSOAP12port_https')
course = c.service.getCourse(filter)
# course == [ ] -- I also tried   c.service.getCourse([filter])


Does anyone have any tips for working with the PHP library?  Our utility tools are written in PHP, so it would be awesome if I could get this working in PHP, but for some reason getGroup just doesn't seem to work (in PHP).



* I'm using suds-jurko with python and Blackboard-Web-Services-PHP-Library with PHP