1

everybody!

I have troubles parsing response of SOAP request with SOAP:Lite library in perl.

Here is XML request I'm sending with SOAP:

SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0x9c62028)
SOAP::Transport::HTTP::Client::send_receive: POST https://109.235.185.235:8443/tvrauto         
HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 571
Content-Type: text/xml; charset=utf-8
SOAPAction: "soapenv#PutCoord"

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 

xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ws="soapenv" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
  <ws:PutCoord>
    <ObjectID>79032058458</ObjectID>
    <Coord time="2010-01-29T01:28:01Z" lon="37.754689" lat="55.6586458" speed="20.1" dir="301" valid="1"/>
  </ws:PutCoord>
</soapenv:Body>
</soapenv:Envelope>

Here is XML answer from remote server:

<?xml version="1.0" encoding="windows-1251"?>
  <soapenv:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope">
    <soapenv:Header/>
      <soapenv:Body>
         <ws:PutCoordResponse>
            <ObjectID>79032058458</ObjectID>
         </ws:PutCoordResponse>
      </soapenv:Body>
  </soapenv:Envelope>

Here is the list of errors from SOAP::Lite:

Unresolved prefix 'soapenv' for element 'Envelope'
Wrong SOAP version specified. Supported versions:
  1.1 (http://schemas.xmlsoap.org/soap/envelope/)
  1.2 (http://www.w3.org/2003/05/soap-envelope)
Unresolved prefix 'soapenv' for element 'Header'
Unresolved prefix 'soapenv' for element 'Body'
Unresolved prefix 'ws' for element 'PutCoordResponse'

Here is Perl code:

#!/usr/bin/perl

use SOAP::Lite  +autodispatch;
use SOAP::Lite  +trace;

use SOAP::Transport::HTTP;

sub SOAP::Transport::HTTP::Client::get_basic_credentials { 
  return 'yyyyyy' => 'xxxxxxxxxx';
}

$soap = SOAP::Lite  
  -> uri('soapenv') 
  -> proxy('https://109.235.185.235:8443/tvrauto');

$soap->default_ns('https://109.235.185.235:8443','soapenv');
$soap->ns('soapenv', 'ws');
$soap->envprefix('soapenv');
$soap->uri('soapenv');
$soap->soapversion('1.2');

$xml=<<XML;
  <ObjectID>79032058458</ObjectID>
  <Coord time="2010-01-29T01:28:01Z" lon="37.754689" lat="55.6586458" speed="20.1" dir="301" valid="1"/>
XML


$params=SOAP::Data->type('xml' => $xml);

print $soap->PutCoord($params)->result;
print "\n";

The question is - how to avoid "Unresolved prefix" error. I have tried to play with uris and namespace in different combination but get no result.

And connected question - what is the problem with SOAP version? As I can see - server did't return to us any version information.

Thank you in advance. Sorry for stupid questions - I'm not really familiar with SOAP at all :( Looking forward for your reply.

1 Answers1

0

Don't use

$soap->soapversion('1.2');

Use

$soap->soapversion('1.1');