You are doing it wrong.<br>Não é porque SOAP retorna um XML que você tem que "parsear" a resposta dele com o XML::Simple :P<br>Dê uma olhada no <a href="http://search.cpan.org/~berle/SOAP-Simple-0.00_03/lib/SOAP/Simple.pm">http://search.cpan.org/~berle/SOAP-Simple-0.00_03/lib/SOAP/Simple.pm</a> se não funcionar, vai ter que usar <a href="http://search.cpan.org/~mkutter/SOAP-Lite-0.710.10/lib/SOAP/Lite.pm">http://search.cpan.org/~mkutter/SOAP-Lite-0.710.10/lib/SOAP/Lite.pm</a> o SOAP::Lite tem uma pasta 'example' junto com o fonte que ajuda bastante<br>
<br><div class="gmail_quote">2009/12/4 Marcio Mello <span dir="ltr"><<a href="mailto:marcio@modapoint.com.br">marcio@modapoint.com.br</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#ffffff">
<div><font face="Arial" size="2">Olá à todos, </font></div>
<div><font face="Arial" size="2">Não conheço bem o módulo XML::Simple e não sei
como traduzir os dados corretamente.</font></div>
<div><font face="Arial" size="2">Se alguém puder ajudar, fico grato..</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">A resposta que recebo do servidor está aqui e
o código está abaixo:</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">===========================================================</font></div>
<div><font face="Arial" size="2">$VAR1 = { 'xmlns:xsi' =>
'<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a>', 'soap:Body' => {
'getUserTransactionsResponse' => { 'xmlns' => 'vscws',
'getUserTransactionsResult' => { 'VSC' => { 'xmlns' => '',
'userTransactions' => [ { 'Time' => '1:00', 'Limit' => '5', 'DNIS'
=> '56012', 'destinationDescription' => "Brasil - S\x{e3}o Paulo -
\x{c1}rea 11 - Celular", 'Income' => '0.0000', 'controlNumber' =>
'2414568', 'ANI' => '1145822125', 'DestinationNumber' => '551199117099',
'Balance' => '-44.024', 'startTime' => '2009-11-27 17:28:45', 'Cost' =>
'0.89', 'transactionDescription' => 'Termination', 'billing' => 'Limited',
'RealTime' => '0:22' }, { 'Time' => '1:00', 'Limit' => '5', 'DNIS'
=> '56012', 'destinationDescription' => 'Brasil - Roc', 'Income' =>
'0.0000', 'controlNumber' => '2414568', 'ANI' => '1145822125',
'DestinationNumber' => '551145215888', 'Balance' => '-44.314', 'startTime'
=> '2009-11-27 17:25:45', 'Cost' => '0.29', 'transactionDescription' =>
'Termination', 'billing' => 'Limited', 'RealTime' => '0:19' }, { 'Time'
=> '1:00', 'Limit' => '5', 'DNIS' => '56012', 'destinationDescription'
=> 'Brasil - Roc', 'Income' => '0.0000', 'controlNumber' => '2414568',
'ANI' => '1145822125', 'DestinationNumber' => '551145215888', 'Balance'
=> '-44.604', 'startTime' => '2009-11-27 17:16:30', 'Cost' => '0.29',
'transactionDescription' => 'Termination', 'billing' => 'Limited',
'RealTime' => '0:24' }, { 'Time' => '1:00', 'Limit' => '5', 'DNIS'
=> '56012', 'destinationDescription' => 'Brasil -', 'Income' =>
'0.0000', 'controlNumber' => '2414568', 'ANI' => '1145822125',
'DestinationNumber' => '551164545504', 'Balance' => '-45.494', 'startTime'
=> '2009-11-27 17:06:44', 'Cost' => '0.89', 'transactionDescription' =>
'Termination', 'billing' => 'Limited', 'RealTime' => '0:12' }, { 'Time'
=> '1:48', 'Limit' => '5', 'DNIS' => '56012', 'destinationDescription'
=> 'Brasil - Roc', 'Income' => '0.0000', 'controlNumber' => '2414568',
'ANI' => '1130337016', 'DestinationNumber' => '551130337005', 'Balance'
=> '-46.016', 'startTime' => '2009-11-27 12:19:22', 'Cost' => '0.522',
'transactionDescription' => 'Termination', 'billing' => 'Limited',
'RealTime' => '1:43' }, { 'Time' => '1:00', 'Limit' => '5', 'DNIS'
=> '56012', 'destinationDescription' => "Brasil - S\x{e3}o Paulo -
\x{c1}rea 11 - Celular", 'Income' => '0.0000', 'controlNumber' =>
'2414568', 'ANI' => '1130337016', 'DestinationNumber' => '551199117099',
'Balance' => '-46.906', 'startTime' => '2009-11-27 12:20:28', 'Cost' =>
'0.89', 'transactionDescription' => 'Termination', 'billing' => 'Limited',
'RealTime' => '0:13' }, { 'Time' => '1:00', 'Limit' => '5', 'DNIS'
=> '56012', 'destinationDescription' => "Brasil - S\x{e3}o Paulo -
\x{c1}rea 11 - Celular", 'Income' => '0.0000', 'controlNumber' =>
'2414568', 'ANI' => '1130337016', 'DestinationNumber' => '551199117099',
'Balance' => '-47.796', 'startTime' => '2009-11-27 12:07:35', 'Cost' =>
'0.89', 'transactionDescription' => 'Termination', 'billing' => 'Limited',
'RealTime' => '0:20' }, { 'Time' => '1:00', 'Limit' => '5', 'DNIS'
=> '56012', 'destinationDescription' => 'Brasil - Roc', 'Income' =>
'0.0000', 'controlNumber' => '2414568', 'ANI' => '1130337016',
'DestinationNumber' => '551130337005', 'Balance' => '-48.086', 'startTime'
=> '2009-11-27 12:06:08', 'Cost' => '0.29', 'transactionDescription' =>
'Termination', 'billing' => 'Limited', 'RealTime' => '0:21' }, { 'Time'
=> '0:00', 'Limit' => '5', 'DNIS' => {}, 'destinationDescription' =>
{}, 'Income' => '50', 'controlNumber' => '2414568', 'ANI' => {},
'DestinationNumber' => {}, 'Balance' => '1.914', 'startTime' =>
'2009-11-26 18:05:36', 'Cost' => '0.0000', 'transactionDescription' =>
'Payment', 'billing' => 'Limited', 'RealTime' => '0:00' }, { 'Time' =>
'1:00', 'Limit' => '5', 'DNIS' => '30338031', 'destinationDescription'
=> 'Brasil - Roc', 'Income' => '0.0000', 'controlNumber' => '2414568',
'ANI' => '1145822125', 'DestinationNumber' => '551145215888', 'Balance'
=> '1.624', 'startTime' => '2009-11-25 18:11:25', 'Cost' => '0.29',
'transactionDescription' => 'Termination', 'billing' => 'Limited',
'RealTime' => '0:47' }, { 'Time' => '1:00', 'Limit' => '5', 'DNIS'
=> '56012', 'destinationDescription' => 'Brasil - Roc', 'Income' =>
'0.0000', 'controlNumber' => '2414568', 'ANI' => '1145822125',
'DestinationNumber' => '551155478001', 'Balance' => '1.334', 'startTime'
=> '2009-11-25 11:55:47', 'Cost' => '0.29', 'transactionDescription' =>
'Termination', 'billing' => 'Limited', 'RealTime' => '0:09' }, { 'Time'
=> '1:00', 'Limit' => '5', 'DNIS' => '56012', 'destinationDescription'
=> 'Brasil - Roc', 'Income' => '0.0000', 'controlNumber' => '2414568',
'ANI' => '1145822125', 'DestinationNumber' => '551140040435', 'Balance'
=> '1.044', 'startTime' => '2009-11-25 11:48:00', 'Cost' => '0.29',
'transactionDescription' => 'Termination', 'billing' => 'Limited',
'RealTime' => '0:07' }, { 'Time' => '1:36', 'Limit' => '5', 'DNIS'
=> '56012', 'destinationDescription' => 'Brasil - Roc', 'Income' =>
'0.0000', 'controlNumber' => '2414568', 'ANI' => '1145822125',
'DestinationNumber' => '551140040435', 'Balance' => '0.58', 'startTime'
=> '2009-11-25 11:09:02', 'Cost' => '0.464', 'transactionDescription'
=> 'Termination', 'billing' => 'Limited', 'RealTime' => '1:31' }, {
'Time' => '1:00', 'Limit' => '5', 'DNIS' => '56012',
'destinationDescription' => 'Brasil - Roc', 'Income' => '0.0000',
'controlNumber' => '2414568', 'ANI' => '1145822125', 'DestinationNumber'
=> '551138330767', 'Balance' => '0.29', 'startTime' => '2009-11-25
10:11:35', 'Cost' => '0.29', 'transactionDescription' => 'Termination',
'billing' => 'Limited', 'RealTime' => '0:47' }, { 'Time' => '1:00',
'Limit' => '5', 'DNIS' => '56012', 'destinationDescription' => 'Brasil
- Roc', 'Income' => '0.0000', 'controlNumber' => '2414568', 'ANI' =>
'1145822125', 'DestinationNumber' => '551138330767', 'Balance' =>
'0.0000', 'startTime' => '2009-11-25 09:50:25', 'Cost' => '0.29',
'transactionDescription' => 'Termination', 'billing' => 'Limited',
'RealTime' => '0:52' } ], 'Val' => { 'UserID' => '2414568' }, 'STATUS'
=> '0' } } } }, 'xmlns:xsd' => '<a href="http://www.w3.org/2001/XMLSchema" target="_blank">http://www.w3.org/2001/XMLSchema</a>',
'xmlns:soap' => '<a href="http://schemas.xmlsoap.org/soap/envelope/" target="_blank">http://schemas.xmlsoap.org/soap/envelope/</a>' };
<br>=====================================================================</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">use LWP::UserAgent;<br>use HTTP::Request;<br>use
XML::Simple;<br>use Data::Dumper;</font></div>
<div> </div>
<div><font face="Arial" size="2">my $message = '<?xml version="1.0"
encoding="utf-8"?><br><soap:Envelope xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a>"
xmlns:xsd="<a href="http://www.w3.org/2001/XMLSchema" target="_blank">http://www.w3.org/2001/XMLSchema</a>"
xmlns:soap="<a href="http://schemas.xmlsoap.org/soap/envelope/" target="_blank">http://schemas.xmlsoap.org/soap/envelope/</a>"><br>
<soap:Header><br> <AuthHeader
xmlns="vscws"><br>
<distriID>XXXX</distriID><br>
<password>XXXXXX</password><br>
</AuthHeader><br> </soap:Header><br>
<soap:Body><br> <getUserTransactions
xmlns="vscws"><br>
<controlNumber>XXXXXX</controlNumber><br>
<transactionType></transactionType><br>
<dateFrom>2009-11-10</dateFrom><br>
<dateTo>2009-11-30</dateTo><br>
</getUserTransactions><br>
</soap:Body><br></soap:Envelope>';</font></div>
<div> </div>
<div><font face="Arial" size="2">my $length = length($message);</font></div>
<div> </div>
<div><font face="Arial" size="2">my $userAgent = LWP::UserAgent->new();<br>my
$request = HTTP::Request->new(POST =>
'<a href="http://200.XXX.XXX.XX:90/ws.asmx%27" target="_blank">http://200.XXX.XXX.XX:90/ws.asmx'</a>);<br>$request->header(SOAPAction =>
'"vscws/getUserTransactions"');<br>$request->content_type("text/xml;
charset=utf-8");<br>$request->content_length($length);<br>$request->content($message);</font></div>
<div> </div>
<div><font face="Arial" size="2">my $response =
$userAgent->request($request);</font></div>
<div> </div>
<div><font face="Arial" size="2"> #<br> # Parseando o resultado (XML) do
servidor<br> #</font></div>
<div><font face="Arial" size="2"> my $ref = XMLin( $response->content ) or
die $!;</font></div>
<div><font face="Arial" size="2"> my $xml = XMLout( my $hashref
);</font></div>
<div> </div>
<div><font face="Arial" size="2"> for ( my $i = $#{
$ref->{getUserTransactions} }; $i > 0; $i-- ) {</font></div>
<div> </div>
<div><font face="Arial" size="2"> $startdate =
"${ $ref->{getUserTransactions} }[$i]->{startTime}";<br>
$origem = "${ $ref->{getUserTransactions}
}[$i]->{ANI}";<br> $destino = "${
$ref->{getUserTransactions}
}[$i]->{DestinationNumber}";<br>
$descrip = "${ $ref->{getUserTransactions}
}[$i]->{destinationDescription}";<br>
$duration = "${ $ref->{getUserTransactions}
}[$i]->{Time}";<br>
$cost = "${
$ref->{getUserTransactions} }[$i]->{Cost}";</font></div>
<div> </div>
<div><font face="Arial" size="2"> $tabelaprint .= "<br>
<tr><br> <td><p
align=\"center\"><font face=\"Arial\"
size=\"1\"><b>$startdate</b></font></td><br>
<td><p align=\"center\"><font face=\"Arial\"
size=\"1\">$origem</font></td><br>
<td><p align=\"center\"><font face=\"Arial\"
size=\"1\"><b>$destino</b></font></td><br>
<td><p align=\"center\"><font face=\"Arial\"
size=\"1\"><b>$descrip</b></font></td><br>
<td><p align=\"center\"><font face=\"Arial\"
size=\"1\">$duration</font></td><br>
<td><p align=\"center\"><font face=\"Arial\"
size=\"1\">$cost</font></td><br>
</tr> <br> ";</font></div>
<div><font face="Arial" size="2"> }</font></div>
<div> </div>
<div><font face="Arial" size="2">if($response->code == 200) {</font></div>
<div><font face="Arial" size="2"> print "$tabelaprint";<br>}<br>else
{<br> print $response->error_as_HTML;<br>};<br></font></div>
<div><font face="Arial" size="2">Obrigado.</font></div>
<div><font face="Arial" size="2">Marcio Mello.</font></div><font color="#888888">
<div><font face="Arial" size="2"><a href="mailto:marcio@modapoint.com.br" target="_blank">marcio@modapoint.com.br</a></font></div></font></div>
<br>_______________________________________________<br>
SaoPaulo-pm mailing list<br>
<a href="mailto:SaoPaulo-pm@pm.org">SaoPaulo-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/saopaulo-pm" target="_blank">http://mail.pm.org/mailman/listinfo/saopaulo-pm</a><br></blockquote></div><br><br clear="all"><br>-- <br>lorn at lornlab dot org<br>Lindolfo "Lorn" Rodrigues<br>
<br>