phpsoapopenmeetings

Undefined property while attempting to get values using SOAP


I'm having an adventure with Openmeetings' SOAP API. This is my first rodeo with SOAP so don't worry if the solution here seems obvious.

Anyway, I'm attempting to retrieve the session id with the following script.

<?php
    $wsdl = "http://localhost:5080/openmeetings/services/UserService?wsdl";
    $session = new SoapClient($wsdl, array("trace" =>1, "exceptions"=>0));
    $value = $session->getSession();
    $xml = $value->getSessionResponse;
    $ssid = $xml->session_id;
    print "<br/>\n SSID: $ssid";
?>

But I'm getting the following errors:

Notice: Undefined property: stdClass::$getSessionResponse in /home/sam/www/soap.php on line 5
Notice: Trying to get property of non-object in /home/sam/www/soap.php on line 6

Using soapUI, I can see that the following is sent:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.axis.openmeetings.apache.org">
  <soapenv:Header/>
  <soapenv:Body>
      <ser:getSession/>
  </soapenv:Body>
</soapenv:Envelope>

When I carry it out on soapUI, the following is returned (which contains everything I want and more):

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Body>
      <ns:getSessionResponse xmlns:ns="http://services.axis.openmeetings.apache.org">
    <ns:return xsi:type="ax22:Sessiondata" xmlns:ax27="http://asterisk.sip.beans.persistence.openmeetings.apache.org/xsd" xmlns:ax213="http://basic.beans.data.openmeetings.apache.org/xsd" xmlns:ax24="http://domain.beans.persistence.openmeetings.apache.org/xsd" xmlns:ax21="http://user.beans.persistence.openmeetings.apache.org/xsd" xmlns:ax22="http://basic.beans.persistence.openmeetings.apache.org/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <ax22:id>14</ax22:id>
        <ax22:language_id xsi:nil="true"/>
        <ax22:organization_id xsi:nil="true"/>
        <ax22:refresh_time>2013-09-26</ax22:refresh_time>
        <ax22:sessionXml xsi:nil="true"/>
        <ax22:session_id>90a4d3dc876460e119d068969def236c</ax22:session_id>
        <ax22:starttermin_time>2013-09-26</ax22:starttermin_time>
        <ax22:storePermanent xsi:nil="true"/>
        <ax22:user_id xsi:nil="true"/>
    </ns:return>
      </ns:getSessionResponse>
  </soapenv:Body>
</soapenv:Envelope

Since soapUI works on it, I'm certain the url I'm using is correct and that the API is solid. Can anyone find where I'm amiss in my php?

For reference, the SOAP API documentation for Openmeetings can be found here. In case anyone might find that useful or interesting.

MANY thanks in advance to anyone able to detect the error...or to anyone who gives it a shot for that matter.


Solution

  • A little embarrassment here. As I was editing the grammar in the post, I noticed that I should be using "return" instead of "getSessionResponse." I merely replaced

    $xml = $value->getSessionResponse;
    

    with

    $xml = $value->return;
    

    and it worked like a charm.

    Sorry to waste server space :-P