http://www.perlmonks.org?node_id=1225214

bigup401 has asked for the wisdom of the Perl Monks concerning the following question:

500 read timeout at Business/PayPal/API.pm line 164.: /usr/home/bigup401/public_html/prod/test.pl localhost Sun Nov 04 13:44:13 2018 error pid 17698 mod_cgi.c(175): client 31.210.141.800:21824 AH01215: Sun Nov 4 13:44:13 2018 test.pl: at test.pl line 21.: /usr/home/bigup401/public_html/prod/test.pl

use Business::PayPal::API::TransactionSearch; use Data::Dumper; $ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0; my $pp = Business::PayPal::API::TransactionSearch->new( Username => 'username', Password => 'password', CertFile => 'paypal_cert_key_pem.txt', KeyFile => 'paypal_cert_key_pem.txt', sandbox => 0, timeout => 5 ); $transid = '98832432992384234'; my $transactions = $pp->TransactionSearch( TransactionID => $transid ); print "Content-type: text/html\n\n"; for my $rec ( @$transactions ) { print "Record:\n"; print "TransactionID: " . $rec->{TransactionID} . "\n"; print "Payer Email: " . $rec->{Payer} . "\n"; print "Amount: " . $rec->{GrossAmount} . "\n\n"; print "Status: " . $rec->{Status} . "\n\n"; }

Replies are listed 'Best First'.
Re: 500 timeout on paypal module
by zentara (Archbishop) on Nov 04, 2018 at 22:52 UTC
    Hi, it would seem the next step would be to turn on debugging in the PayPal module. From the perldoc:
    DEBUGGING You can see the raw SOAP XML sent and received by Business::PayPal::AP +I by setting its $Debug variable: $Business::PayPal::API::Debug = 1; $pp->SetExpressCheckout( %args ); this will print the XML being sent, and dump a Perl data structure of +the SOM received on STDERR (so check your error_log if running inside + a web server). If anyone knows how to turn a SOAP::SOM object into XML without settin +g outputxml(), let me know.

    There is also a section in the perldoc on Error Handling. You might want to setup more error checking in your code to find the cause of the timeout.


    I'm not really a human, but I play one on earth. ..... an animated JAPH

      after adding debug to 1. look wat i got LOL

      localhost [Sun Nov 04 18:13:50 2018] [error] [pid 628] mod_cgi.c(175): + [client 41.210.141.161:27391] AH01215: <?xml version="1.0" encoding= +"UTF-8"?><soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.or +g/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelop +e/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:x +sd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/20 +01/XMLSchema-instance"><soap:Header><RequesterCredentials soap:mustUn +derstand="1" xmlns="urn:ebay:api:PayPalAPI"><Credentials xmlns="urn:e +bay:apis:eBLBaseComponents"><Username>username</Username><Password>pa +ssword</Password><Signature /><Subject /></Credentials></RequesterCre +dentials></soap:Header><soap:Body><TransactionSearchReq xmlns="urn:eb +ay:api:PayPalAPI"><TransactionSearchRequest xsi:type="ns:TransactionS +earchRequestType"><Version xmlns="urn:ebay:apis:eBLBaseComponents" xs +i:type="xs:string">61.0</Version><StartDate xsi:nil="true" xsi:type=" +xs:dateTime" /><TransactionID xsi:type="xs:string">88343499343434</Tr +ansactionID></TransactionSearchRequest></TransactionSearchReq></soap: +Body></soap:Envelope>

        OK, so that request looks like this once it's been cleaned up ..

        <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soap:Header> <RequesterCredentials soap:mustUnderstand="1" xmlns="urn:ebay:api:PayPalAPI"> <Credentials xmlns="urn:ebay:apis:eBLBaseComponents"> <Username>username</Username> <Password>password</Password><Signature /> <Subject /> </Credentials> </RequesterCredentials> </soap:Header> <soap:Body> <TransactionSearchReq xmlns="urn:ebay:api:PayPalAPI"> <TransactionSearchRequest xsi:type="ns:TransactionSearchRequestType"> <Version xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="xs:string">61.0</Version> <StartDate xsi:nil="true" xsi:type="xs:dateTime" /> <TransactionID xsi:type="xs:string"> 88343499343434 </TransactionID> </TransactionSearchRequest> </TransactionSearchReq> </soap:Body> </soap:Envelope>
        This looks like the request that you were sending out. Not having used SOAP in about ten years, I don't know if this is properly formed, but it looks OK -- you're searching for a specific transaction by ID. Is it failing to send this request? Are you getting a response that you're not telling us about? Does this transaction really exist? Are your credentials valid?

        You need to show more work.

        Alex / talexb / Toronto

        Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.

Re: 500 timeout on paypal module
by afoken (Canon) on Nov 04, 2018 at 19:18 UTC

    STOP creating new threads for the same problem!

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

      i think that was other thread asking wat module can i use. and now this thread point to the error i got using the same module

      thanks

        this is wired and scares. this module has the latest update for 20 days back. after following the developer of this module i found out the latest version made 20 days back. metacpan.org has this module last update i show something like nov 2017. first, the documentation scares coz the module itself has no direct error handling to handle errors. second, the developer was wise in his new update he updated the PayPal links which is ok. and also fixed the https problem. but the documentation to wired cant fix my error in my script