douzhuijing4911 2013-09-26 04:55
浏览 53
已采纳

尝试使用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/>
 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.

  • 写回答

1条回答 默认 最新

  • douqiaoru2583 2013-09-26 05:08
    关注

    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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败