in reply to SOAP::Lite Client - Read response header
Hi,
I had to smile seeing that Anonymous Monk gave a snippet hopefully extracting information from Body while you asked for Header, but probably he wanted to test your transfer capabilities.
Here is my snippet in the hope it helps you:
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; use local::lib 'lib1'; use SOAP::Lite; my $xml = q{<?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/e +nvelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="htt +p://www.w3.org/2001/XMLSchema-instance"> <soapenv:Header> <ns1:sessionID soapenv:actor="http://schemas.xmlsoap.org/s +oap/actor/next" soapenv:mustUnderstand="0" href="#id0" xmlns:ns1="htt +p://xml.apache.org/axis/session"/> </soapenv:Header> <soapenv:Body> <ns2:initExportDeviceResponse soapenv:encodingStyle="http: +//schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://diamondip.com +/netcontrol/ws/"> <initExportDeviceReturn href="#id1"/> </ns2:initExportDeviceResponse> <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle= +"http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:long" x +mlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">-91025392591 +2285490</multiRef> <multiRef id="id1" soapenc:root="0" soapenv:encodingStyle= +"http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns3:WSContext" +xmlns:ns3="http://service.ipcontrol.diamondip.com" xmlns:soapenc="htt +p://schemas.xmlsoap.org/soap/encoding/"> <contextId xsi:type="soapenc:string">ContextId_1364228 +178892</contextId> <contextType xsi:type="soapenc:string">Export_Device</ +contextType> <filter xsi:type="soapenc:string">DeviceType='NAS'</fi +lter> <firstResultPos href="#id2"/> <internalResultCount href="#id3"/> <maxResults href="#id4"/> <options xsi:type="soapenc:string" xsi:nil="true"/> <query xsi:type="soapenc:string">SELECT DISTINCT huge- +ass sql statement cropped for clarity) ) ) ) ) ORDER BY 1</query> <resultCount href="#id5"/> </multiRef> <multiRef id="id4" soapenc:root="0" soapenv:encodingStyle= +"http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns: +soapenc="http://schemas.xmlsoap.org/soap/encoding/">5000</multiRef> <multiRef id="id3" soapenc:root="0" soapenv:encodingStyle= +"http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns: +soapenc="http://schemas.xmlsoap.org/soap/encoding/">0</multiRef> <multiRef id="id5" soapenc:root="0" soapenv:encodingStyle= +"http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns: +soapenc="http://schemas.xmlsoap.org/soap/encoding/">152</multiRef> <multiRef id="id2" soapenc:root="0" soapenv:encodingStyle= +"http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns: +soapenc="http://schemas.xmlsoap.org/soap/encoding/">0</multiRef> </soapenv:Body> </soapenv:Envelope> }; my $som = SOAP::Deserializer->deserialize($xml); my $subsom = $som->match('/Envelope/Header/[1]'); my $res = $subsom->valueof(); print "Result: $res\n";
McA
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: SOAP::Lite Client - Read response header
by sojourner9 (Initiate) on Mar 26, 2013 at 13:36 UTC | |
by McA (Priest) on Mar 26, 2013 at 14:19 UTC | |
by Anonymous Monk on Mar 26, 2013 at 15:33 UTC |