Array values disappear in PHP SoapClient call to Cisco phone system.

Posted by Jamin on Stack Overflow See other posts from Stack Overflow or by Jamin
Published on 2009-08-11T16:27:45Z Indexed on 2010/05/30 3:02 UTC
Read the original article Hit count: 321

Filed under:
|
|

I am attempting to consume a SOAP service provided by our Cisco phone system (documentation), to get the current status of a given set of phones. I have an array of phone names, which I'm trying to pass to the service, however, the values of the array are being eaten somewhere

Array of items like so:

$items = array(
    0 => "SEP0004F2E57F8C",
    1 => "SEP001111BF8758",
    2 => "SEP001320BD485C"
);

Attempting to call the method:

$client = new SoapClient(
    "https://x.x.x.x/realtimeservice/services/RisPort?wsdl", 
    array(
        "login" => "admin",
        "password"=> "xxxxx",
        "trace" => true
    )
);
$devices = $client->SelectCmDevice(
    "",
    array(
        "SelectBy" => "Name",
        "Status" => "Any",
        "SelectedItems" => $items
    )
);

When I debug the complete request I get the following:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope 
mlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:ns1="http://schemas.cisco.com/ast/soap/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
        <ns1:SelectCmDevice>
            <StateInfo xsi:type="xsd:string"></StateInfo>
            <CmSelectionCriteria xsi:type="ns1:CmSelectionCriteria">
                <MaxReturnedDevices xsi:nil="true"/>
                <Class xsi:nil="true"/>
                <Model xsi:nil="true"/>
                <Status xsi:type="xsd:string">Any</Status>
                <NodeName xsi:nil="true"/>
                <SelectBy xsi:type="xsd:string">Name</SelectBy>
                <SelectItems SOAP-ENC:arrayType="ns1:SelectItem[3]" xsi:type="ns1:SelectItems">
                    <item xsi:type="ns1:SelectItem"/>
                    <item xsi:type="ns1:SelectItem"/>
                    <item xsi:type="ns1:SelectItem"/>
                </SelectItems>
            </CmSelectionCriteria>
        </ns1:SelectCmDevice>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The correct number of <Item> elements were counted and inserted into the <SelectItems> object, however, the actual item names themselves are gone. I would guess it needs to be <Item>SEP0004F2E57F8C</Item>, etc., but I can't seem to figure out how to make it do that.

Thank you in advance for any help!!!

© Stack Overflow or respective owner

Related posts about php

Related posts about soap