我刚刚开始使用红宝石,并且整个上午一直在打我的脑袋。我从SOAP服务器获得一个响应作为一个数组(如下所示),并使用此代码尝试获取活动调用的callID(78523):
activecall = driver.GetActiveCalls("clientHandle"=>handle,
"lineID"=>line["OpenLineResult"].lineID,
"getCallParties"=>1,
"getCallProperties"=>1)
print " call ID = ", activecall["GetActiveCallsResult"].callID,
"\n Line Type = ", activecall["GetActiveCallsResult"].calledID, "\n\n"
我收到错误:
undefined method `callID' for #<SOAP::Mapping::Object:0x..fdb79d636> (NoMethodError)
任何想法我做错了什么,以及如何提取这些数据?
<SOAP::Mapping::Object:0x..fdb7ab5e2 {http://www.ShoreTel.com/ProServices/SDK/Web}GetActiveCallsResult=#
<SOAP::Mapping::Object:0x..fdb7ab4b6 {http://www.ShoreTel.com/ProServices/SDK/Web}ShoreTelCallStateInfo=[#
<SOAP::Mapping::Object:0x..fdb7ab3b2 {http://www.ShoreTel.com/ProServices/SDK/Web}callInfo=#
<SOAP::Mapping::Object:0x..fdb7ab25e {http://www.ShoreTel.com/ProServices/SDK/Web}lineID="20659"
{http://www.ShoreTel.com/ProServices/SDK/Web}callID="71495"
{http://www.ShoreTel.com/ProServices/SDK/Web}isExternal="true"
{http://www.ShoreTel.com/ProServices/SDK/Web}isInbound="false"
{http://www.ShoreTel.com/ProServices/SDK/Web}callReason="None"
{http://www.ShoreTel.com/ProServices/SDK/Web}connectedID="9+18012624550"
{http://www.ShoreTel.com/ProServices/SDK/Web}callerID="1955"
{http://www.ShoreTel.com/ProServices/SDK/Web}callerIDName="Joel Lewis"
{http://www.ShoreTel.com/ProServices/SDK/Web}calledID="9+18012624550"
{http://www.ShoreTel.com/ProServices/SDK/Web}callParties=#
<SOAP::Mapping::Object:0x..fdb7a8b3a {http://www.ShoreTel.com/ProServices/SDK/Web}CallPartyInfo=#
<SOAP::Mapping::Object:0x..fdb7a89fa {http://www.ShoreTel.com/ProServices/SDK/Web}partyNumber="1"
{http://www.ShoreTel.com/ProServices/SDK/Web}partyType="Trunk"
{http://www.ShoreTel.com/ProServices/SDK/Web}partyCCOID="1073742591"
{http://www.ShoreTel.com/ProServices/SDK/Web}trunkInfo=#
<SOAP::Mapping::Object:0x..fdb7a7cb2 {http://www.ShoreTel.com/ProServices/SDK/Web}trunkType="DigitalPRI"
{http://www.ShoreTel.com/ProServices/SDK/Web}trunkSwitch="5"
{http://www.ShoreTel.com/ProServices/SDK/Web}trunkPort="21"
{http://www.ShoreTel.com/ProServices/SDK/Web}trunkPortName=" E-Link (21)">>>
{http://www.ShoreTel.com/ProServices/SDK/Web}callUniqueID="2572420445"
{http://www.ShoreTel.com/ProServices/SDK/Web}callGUID="{00030000-D992-537E-3FD3-0010492377D9}">
{http://www.ShoreTel.com/ProServices/SDK/Web}callState="OnHold"
{http://www.ShoreTel.com/ProServices/SDK/Web}callStateDetail="Active">,
#<SOAP::Mapping::Object:0x..fdb7a4d1e {http://www.ShoreTel.com/ProServices/SDK/Web}callInfo=#
<SOAP::Mapping::Object:0x..fdb7a4bca {http://www.ShoreTel.com/ProServices/SDK/Web}lineID="20659"
{http://www.ShoreTel.com/ProServices/SDK/Web}callID="78523"
{http://www.ShoreTel.com/ProServices/SDK/Web}isExternal="true"
{http://www.ShoreTel.com/ProServices/SDK/Web}isInbound="false"
{http://www.ShoreTel.com/ProServices/SDK/Web}callReason="None"
{http://www.ShoreTel.com/ProServices/SDK/Web}connectedID="9+13852045017"
{http://www.ShoreTel.com/ProServices/SDK/Web}callerID="1955"
{http://www.ShoreTel.com/ProServices/SDK/Web}callerIDName="Joel Lewis"
{http://www.ShoreTel.com/ProServices/SDK/Web}calledID="9+13852045017"
{http://www.ShoreTel.com/ProServices/SDK/Web}callParties=#
<SOAP::Mapping::Object:0x..fdb7a256e {http://www.ShoreTel.com/ProServices/SDK/Web}CallPartyInfo=#
<SOAP::Mapping::Object:0x..fdb7a2460 {http://www.ShoreTel.com/ProServices/SDK/Web}partyNumber="1"
{http://www.ShoreTel.com/ProServices/SDK/Web}partyType="Trunk"
{http://www.ShoreTel.com/ProServices/SDK/Web}partyCCOID="1073742590"
{http://www.ShoreTel.com/ProServices/SDK/Web}trunkInfo=#<SOAP::Mapping::Object:0x..fdb7a172c
{http://www.ShoreTel.com/ProServices/SDK/Web}trunkType="DigitalPRI"
{http://www.ShoreTel.com/ProServices/SDK/Web}trunkSwitch="5"
{http://www.ShoreTel.com/ProServices/SDK/Web}trunkPort="20" {http://www.ShoreTel.com/ProServices/SDK/Web}trunkPortName=" E-Link (20)">>>
{http://www.ShoreTel.com/ProServices/SDK/Web}callUniqueID="2320005488"
{http://www.ShoreTel.com/ProServices/SDK/Web}callGUID="{00030000-D995-537E-3FD3-0010492377D9}">
{http://www.ShoreTel.com/ProServices/SDK/Web}callState="Connected"
{http://www.ShoreTel.com/ProServices/SDK/Web}callStateDetail="Active">]>>
答案 0 :(得分:1)
从ruby方面处理SOAP,它会建议使用http://savonrb.com/version2。但无论如何你有没有试过像
这样的东西activecall["GetActiveCallsResult"]["ShoreTelCallStateInfo"]
我认为这些MappingObjects提供了对chield节点的访问,就像你使用密钥访问哈希一样,在这种情况下,xml模式的限定名称见http://ruby-doc.org/stdlib-1.8.7/libdoc/soap/rdoc/SOAP/Mapping/Object.html。