2013-09-26 43 views
0

我正在与Openmeetings的SOAP API进行冒险。这是我的第一个使用SOAP的Rodeo,如果这里的解决方案显而易见,不用担心。尝试使用SOAP获取值时未定义的属性

无论如何,我试图检索与以下脚本的会话ID。

<?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"; 
?> 

但我发现了以下错误:

公告:未定义的属性:stdClass的:: $ getSessionResponse在第5行/home/sam/www/soap.php
公告:试图让非对象的财产/home/sam/www/soap.php第6行

使用soapUI的,我可以看到以下发送:

<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> 

当我进行该项研究的soapUI,返回以下(包含我想要的一切,以及更多):

<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 

因为soapUI的工作就可以了,我敢肯定,我使用url是正确的,并且API是可靠的。任何人都可以找到我在我的PHP不友善的地方?

作为参考,Openmeetings的SOAP API文档可以是found here.如果有人可能觉得有用或有趣。

很多人提前感谢任何能够检测到错误的人......或任何为此提供帮助的人。

回答

1

这里有点尴尬。当我在文章中编辑语法时,我注意到我应该使用“return”而不是“getSessionResponse”。我只是更换

$xml = $value->getSessionResponse; 

$xml = $value->return; 

和它的工作就像一个魅力。

抱歉浪费服务器空间:-P

相关问题