Can I force XML parsing in SOAP :: Lite?

I am trying to write a simple SOAP client using SOAP :: Lite . After executing the request, the answer only seems to be parsed down a couple of levels in the perl data structure. After that, this is just a string of the remaining XML. I feel that it would be really kludgy to take this line and parse it manually using another XML parsing.

my $response = $soap->getVersionInfo;    
my $data = $response->dataof('//getVersionInfoResponse');

The SOAP response looks like this in the SOAP :: Lite trace:

<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <ns:getVersionInfoResponse xmlns:ns="http://webservice.jchem.chemaxon">
         <ns:return>
            &lt;Info>
            &lt;JChem>
            &lt;Version>5.2.6&lt;/Version>
            &lt;/JChem>
            &lt;Java>
            &lt;Vendor>Sun Microsystems Inc.&lt;/Vendor>
            &lt;VmName>Java HotSpot(TM) Client VM&lt;/VmName>
            &lt;Version>1.6.0_05&lt;/Version>
            &lt;/Java>
            &lt;Os>
            &lt;Arch>x86&lt;/Arch>
            &lt;Name>Windows XP&lt;/Name>
            &lt;Version>5.1&lt;/Version>
            &lt;/Os>
            &lt;/Info>
         </ns:return>
      </ns:getVersionInfoResponse>
   </soapenv:Body>
</soapenv:Envelope>

But what is parsed in $datalooks like this (from Data :: Dumper :: Concise):

\bless( {
    _attr => {},
    _name => "getVersionInfoResponse",
    _prefix => "ns",
    _signature => [],
    _uri => "http://webservice.jchem.chemaxon",
    _value => [
      {
        return => "<Info>\n<JChem>\n<Version>5.2.6</Version>\n</JChem>\n<Java>\n<Vendor>Sun Microsystems Inc.</Vendor>\n<VmName>Java HotSpot(TM) Client VM</VmName>\n<Version>1.6.0_05</Version>\n</Java>\n<Os>\n<Arch>x86</Arch>\n<Name>Windows XP</Name>\n<Version>5.1</Version>\n</Os>\n</Info>\n"
      }
    ]
  }, 'SOAP::Data' )

This is a simple example, but for more complex answers, it can be a huge problem for parsing this XML.

SOAP:: Lite ( 2003!), :

, , SOAP .

, , , . SOAP:: Lite XML , ? ?

UPDATE:
, SOAP:: Lite - . ,

: <ns:return> . (, xml < , &lt; ). .

, , , . SOAP:: Lite, , , . , . . , , &lt; <, right? ?; _;

XML:: LibXML, . SOAP:: Lite XML, ?

+3
2

, SOAP:: Lite (post), SOAP:: Lite , , . XML:: Simple .

0

; $response->result Info :

{
  Info => {
    JChem => {
      Version => "5.2.1"
    },
    Java => {
      Vendor => "Sun Microsystems Inc.",
      Version => "1.6.0_06",
      VmName => "Java HotSpot(TM) Server VM"
    },
    Os => {
      Arch => "x86",
      Name => "Windows XP",
      Version => "5.1"
    }
  }
}

$response->dataof('//getVersionInfoResponse') .

Soap:: Lite ? 0.710.10:

$sudo perl -MCPAN -e shell
cpan[6]> i SOAP:Lite
    ...
    INST_VERSION 0.710.10
+4

Source: https://habr.com/ru/post/1722278/


All Articles