logo       

Re: NuSOAP does not return XML attribute to array: msg#00089

php.nusoap.general

Subject: Re: NuSOAP does not return XML attribute to array

You are correct: NuSOAP parses elements in a SOAP message, but not attributes.
Right now, to get the attributes, you would need to look at the raw message
(soapclient::responseData), and do your own parsing.

I have considered attribute parsing before. It is pretty straightforward when
there are attributes on an XML complexType, but less so for something like

<foo attr="bute" xsi:type="xsd:double">4.35</foo>

Since the value is most naturally a PHP scalar, and current code might access
it as such, using an associative array to hold the value + attribute value
would break code, as would using something like a soapval.

I am *not* giving up on parsing attributes, but it requires more thought than I
can give it currently.

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message -----
From: "Chhai Thach" <chhait@xxxxxxxxxxxxxxxxxx>
To: <nusoap-general@xxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, May 18, 2004 11:28 PM
Subject: [Nusoap-general] NuSOAP does not return XML attribute to array


Hi All,



I have a web service running to get phone details from Cisco AXL. But
NuSOAP doesn't seem to parse the complex XML response attribute into the
array. For example :

<device ctiid="1580890216"
uuid="{28F325B6-A872-47B3-80D3-8034554F5F5A}"></device>

I wont be able to get the value for the ctiid and the uuid. Please see
below:


Response

HTTP/1.1 200 OK
Content-Type: text/xml
Content-Length: 2817

<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
<SOAP-ENV:Body>
<axl:getPhoneResponse xmlns:axl="http://www.cisco.com/AXL/1.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://www.cisco.com/AXL/1.0
http://G1-CCM1-MCS7835/CCMApi/AXL/V1/axlsoap.xsd";>
<return>
<device xsi:type="axl:XIPPhone" ctiid="1580890216"
uuid="{28F325B6-A872-47B3-80D3-8034554F5F5A}">
<name>SEP00036BC38X00</name>
<description>Hello</description>
<product>Cisco 7960</product>
<model>Cisco 7960</model>
<class>Phone</class>
<protocol>Cisco-station</protocol>
<lines>
<line uuid="{468AA98A-380D-4805-B7E4-F277BD05FE01}" index="1">
<label>Hello</label>
<display>Hello World</display>
<dirn uuid="{44D0EAC2-68EC-4C27-9270-E3D8D6DF5AAD}"></dirn>
<ringSetting>Use System Default</ringSetting>
<consecutiveRingSetting>Use System Default</consecutiveRingSetting>
</line>
</lines>
<speeddials></speeddials>
<addOnModules></addOnModules>
<deviceSecurityMode>Use System Default</deviceSecurityMode>
</device>
</return>
</axl:getPhoneResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>



When doing print_r() I get the following:



Array
(
[device] => Array
(
[name] => SEP00036BC38X00
[description] => Hello
[product] => Cisco 7960
[model] => Cisco 7960
[class] => Phone
[protocol] => Cisco-station
[lines] => Array
(
[line] => Array
(
[label] => Hello
[display] => Hello World
[dirn] =>
[ringSetting] => Use System Default
[consecutiveRingSetting] => Use System
Default
)

)

[speeddials] =>
[addOnModules] =>
[deviceSecurityMode] => Use System Default
)

)



Is there a way around this?



Thanks,

Chhai




-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id%62&alloc_ida84&op=click


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise