<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY 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' =>
'http://www.w3.org/2001/XMLSchema-instance', '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' => 'http://www.w3.org/2001/XMLSchema',
'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/' };
<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">http://www.w3.org/2001/XMLSchema-instance</A>"
xmlns:xsd="<A
href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>"
xmlns:soap="<A
href="http://schemas.xmlsoap.org/soap/envelope/">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 =>
'http://200.XXX.XXX.XX:90/ws.asmx');<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.</DIV></FONT>
<DIV><FONT face=Arial size=2>Marcio Mello.</FONT></DIV>
<DIV><FONT face=Arial size=2><A
href="mailto:marcio@modapoint.com.br">marcio@modapoint.com.br</A></DIV></FONT></BODY></HTML>