#/**************** Settings begin **************/ my $username = ''; # Enter your Interfax username here my $password = ''; # Enter your Interfax password here # See http://www.interfax.net/en/dev/webservice/reference/faxquery2 # for an explanation of properties # # Valid values for [property]_verb are: # Equals | GreaterThan | GreaterOrEqual | LessThan | LessOrEqual | Like | IncludedIn | Between # Leave both [property]_verb and [property]_data empty to ignore the property in the query my $queryForm = {}; $queryForm->{'Subject'} = {('Verb', 'Equals', 'VerbData', '')}; $queryForm->{'FaxNumber'} = {('Verb', 'Equals', 'VerbData', '')}; $queryForm->{'FaxNumber'} = {('Verb', 'Equals', 'VerbData', '')}; $queryForm->{'DateFrom'} = "2000-01-01T00:00:00.000Z"; $queryForm->{'DateTo'} = "2999-12-31T21:59:59.000Z"; $queryForm->{'UserID'} = {('Verb', 'Equals', 'VerbData', '')}; $queryForm->{'ReplyAddress'} = {('Verb', 'Equals', 'VerbData', '')}; $queryForm->{'TransactionID'} = {('Verb', 'Equals', 'VerbData', '')}; $queryForm->{'ParentTransactionID'} = {('Verb', 'Equals', 'VerbData', '')}; $queryForm->{'Status'} = {('Verb', 'Equals', 'VerbData', '')}; $queryForm->{'ShowHiddenTransactions'} = 'true'; my $queryControl = {}; $queryControl->{'OnlyParents'} = 'false'; $queryControl->{'NumOfResults'} = 999; $queryControl->{'StartingRecord'} = 0; # Valid values for $order_by are: # TransactionID | SubmitTime | CompletionTime | Status | DestinationFax | Subject | PagesSent | UserID | ReplyEmail $queryControl->{'OrderBy'} = 'TransactionID'; $queryControl->{'AscOrderDirection'} = 'true'; $queryControl->{'ReturnItems'} = 'true'; $queryControl->{'ReturnStats'} = 'true'; my $NS = 'http://www.interfax.cc'; #/**************** Settings end ****************/ my $client = SOAP::Lite ->uri($NS) ->on_action( sub { join '/', $NS, $_[1] } ) ->proxy('https://ws.interfax.net/dfs.asmx?WSDL'); my $result = $client ->call(SOAP::Data->name('FaxQuery2')->attr({xmlns => $NS}) => SOAP::Data->name('Username')->value($username), SOAP::Data->name('Password')->value($password), SOAP::Data->name('QueryForm')->value($queryForm), SOAP::Data->name('QueryControl')->value($queryControl) ); if ( $result->fault ) { print $result->faultstring . "\n"; } else { if( $result->valueof('//FaxQuery2Result/ResultCode') == 0 ) { my @fax_items = $result->valueof('//FaxQuery2Result/FaxItems/*'); print "Displaying information for " . @fax_items . " faxes." . "\n"; for(my $i=0; $i < @fax_items; $i++) { print "Item " . ($i + 1) . "\n"; print " ParentTransactionID=". $fax_items[$i]{'ParentTransactionID'} . "\n"; print " TransactionID=". $fax_items[$i]{'TransactionID'} . "\n"; print " SubmitTime=". $fax_items[$i]{'SubmitTime'} . "\n"; print " PostponeTime=". $fax_items[$i]{'PostponeTime'} . "\n"; print " CompletionTime=". $fax_items[$i]{'CompletionTime'} . "\n"; print " UserID=". $fax_items[$i]{'UserID'} . "\n"; print " Contact=". $fax_items[$i]{'Contact'} . "\n" if exists $fax_items[$i]{'Contact'}; print " Job=". $fax_items[$i]{'Job'} . "\n" if exists $fax_items[$i]{'Job'}; print " DestinationFax=". $fax_items[$i]{'DestinationFax'} . "\n"; print " ReplyEmail=". $fax_items[$i]{'ReplyEmail'} . "\n"; print " RemoteCSID=". $fax_items[$i]{'RemoteCSID'} . "\n" if exists $fax_items[$i]{'RemoteCSID'}; print " PagesSent=". $fax_items[$i]{'PagesSent'} . "\n"; print " Status=". $fax_items[$i]{'Status'} . "\n"; print " Duration=". $fax_items[$i]{'Duration'} . "\n"; print " Subject=". $fax_items[$i]{'Subject'} . "\n" if exists $fax_items[$i]{'Subject'}; print " PagesSubmitted=". $fax_items[$i]{'PagesSubmitted'} . "\n"; print " SenderCSID=". $fax_items[$i]{'SenderCSID'} . "\n"; print " Priority=". $fax_items[$i]{'Priority'} . "\n"; print " Units=". $fax_items[$i]{'Units'} . "\n"; print " CostPerUnit=". $fax_items[$i]{'CostPerUnit'} . "\n"; print " PageOrientation=". $fax_items[$i]{'PageOrientation'} . "\n"; print " PageResolution=". $fax_items[$i]{'PageResolution'} . "\n"; print " RenderingQuality=". $fax_items[$i]{'RenderingQuality'} . "\n"; print " PageHeader=". $fax_items[$i]{'PageHeader'} . "\n" if exists $fax_items[$i]{'PageHeader'}; print " RetriesToPerform=". $fax_items[$i]{'RetriesToPerform'} . "\n"; print " TrialsPerformed=". $fax_items[$i]{'TrialsPerformed'} . "\n"; print " LocaleID=". $fax_items[$i]{'LocaleID'} . "\n"; print " GMTBias=". $fax_items[$i]{'GMTBias'} . "\n"; print " RetriesInterval=". $fax_items[$i]{'RetriesInterval'} . "\n"; print " UserData=". $fax_items[$i]{'UserData'} . "\n" if exists $fax_items[$i]{'UserData'}; print " DeleteAfterUsage=". $fax_items[$i]{'DeleteAfterUsage'} . "\n"; print " Mode=". $fax_items[$i]{'Mode'} . "\n"; print " NumOfTransactions=". $fax_items[$i]{'NumOfTransactions'} . "\n"; print " MessageID=". $fax_items[$i]{'MessageID'} . "\n" if exists $fax_items[$i]{'MessageID'}; } } else { print "Error, return code=" . $result->valueof('//FaxQuery2Result/ResultCode') . "\n"; } }