Time out error in every request


(Ravi Mittal) #1

I am new to Dwolla and have created my account on sandbox and then created new application in it. I have assigned all permissions to the application. But when I run any request it gives timeout error. Following is my code:

<?php
require('vendor/autoload.php');
DwollaSwagger\Configuration::$access_token =     'M2fykrChI9bneNkE3O8Jl90DK3EcA5aWA0su66KumDwSGsURaE';
$apiClient = new DwollaSwagger\ApiClient("https://api-uat.dwolla.com");

$customersApi = new DwollaSwagger\CustomersApi($apiClient);

$customer = $customersApi->create([
  'firstName' => 'Ravi',
  'lastName' => 'Mittal',
  'email' => 'ravi@dexteroustechnologies.co.in',
  'ipAddress' => '99.99.99.99'
]);
print($customer); # => "https://api-uat.dwolla.com/customers/4e74b1a2-6974-44ee-9b63-ee623eb3cc9d"

And when I run file with above code, I get following error:

Fatal error: Uncaught exception 'DwollaSwagger\ApiException' with message 'API call to https://api-uat.dwolla.com/customers timed out: a:26:{s:3:"url";s:36:"https://api-uat.dwolla.com/customers";s:12:"content_type";N;s:9:"http_code";i:0;s:11:"header_size";i:0;s:12:"request_size";i:0;s:8:"filetime";i:-1;s:17:"ssl_verify_result";i:1;s:14:"redirect_count";i:0;s:10:"total_time";d:0.10899999999999999966693309261245303787291049957275390625;s:15:"namelookup_time";d:0.01499999999999999944488848768742172978818416595458984375;s:12:"connect_time";d:0.04700000000000000011102230246251565404236316680908203125;s:16:"pretransfer_time";d:0;s:11:"size_upload";d:0;s:13:"size_download";d:0;s:14:"speed_download";d:0;s:12:"speed_upload";d:0;s:23:"download_content_length";d:-1;s:21:"upload_content_length";d:-1;s:18:"starttransfer_time";d:0;s:13:"redirect_time";d:0;s:12:"redirect_url";s:0:"";s:10:"primary_ip";s:13:"104.20.47.245";s:8:"certinfo";a:0:{}s:12:"primary_port";i:443;s:8:"local_ip";s:13:"192.168.1.187";s:10:"local_port";i:49267;}' in D: in D:\xampp\htdocs\dwolla-swagger-php-master\lib\ApiClient.php on line 298

Please let me know what I need to do here. Thanks in Advance.


(Spencer Hunter) #2

@Ravi_Mittal, Can you try enabling the debug flag and then reattempt the request? Once you’ve done that, reply back with the updated response.

To enable the debug flag: DwollaSwagger\Configuration::$debug = 1;

Also, make sure you have initialized the client passing in the root of the API $apiClient = new DwollaSwagger\ApiClient("https://api-uat.dwolla.com/");


(Ravi Mittal) #3

Now my new code is :

<?php
require('vendor/autoload.php');
DwollaSwagger\Configuration::$access_token = 'M2fykrChI9bneNkE3O8Jl90DK3EcA5aWA0su66KumDwSGsURaE';
DwollaSwagger\Configuration::$debug = 1;
$apiClient = new DwollaSwagger\ApiClient("https://api-uat.dwolla.com/");

$customersApi = new DwollaSwagger\CustomersApi($apiClient);

$customer = $customersApi->create([
  'firstName' => 'Ravi',
  'lastName' => 'Mittal',
  'email' => 'ravi@dexteroustechnologies.co.in',
  'ipAddress' => '99.99.99.99'
]);
print($customer); # => "https://api-uat.dwolla.com/customers/4e74b1a2-6974-44ee-9b63-ee623eb3cc9d"

And result which I am getting is:

[DEBUG] HTTP Request body ~BEGIN~ {"firstName":"Ravi","lastName":"Mittal","email":"ravi@dexteroustechnologies.co.in","ipAddress":"99.99.99.99"} ~END~ 
Warning: curl_setopt(): cannot represent a stream of type Output as a STDIO FILE* in D:\xampp\htdocs\dwolla-swagger-php-master\lib\ApiClient.php on line 276
[DEBUG] HTTP Response body ~BEGIN~ ~END~ 
Fatal error: Uncaught exception 'DwollaSwagger\ApiException' with message 'API call to https://api-uat.dwolla.com//customers timed out: a:26:{s:3:"url";s:37:"https://api-uat.dwolla.com//customers";s:12:"content_type";N;s:9:"http_code";i:0;s:11:"header_size";i:0;s:12:"request_size";i:0;s:8:"filetime";i:-1;s:17:"ssl_verify_result";i:1;s:14:"redirect_count";i:0;s:10:"total_time";d:0.1409999999999999864552790995730902068316936492919921875;s:15:"namelookup_time";d:0.061999999999999999555910790149937383830547332763671875;s:12:"connect_time";d:0.0940000000000000002220446049250313080847263336181640625;s:16:"pretransfer_time";d:0;s:11:"size_upload";d:0;s:13:"size_download";d:0;s:14:"speed_download";d:0;s:12:"speed_upload";d:0;s:23:"download_content_length";d:-1;s:21:"upload_content_length";d:-1;s:18:"starttransfer_time";d:0;s:13:"redirect_time";d:0;s:12:"redirect_url";s:0:"";s:10:"primary_ip";s:13:"104.20.47.245";s:8:"certinfo";a:0:{}s:12:"primary_port";i:443;s:8:"local_ip";s:13:"192.168.1.187";s:10:"local_port";i:61096;}' in D:\x in D:\xampp\htdocs\dwolla-swagger-php-master\lib\ApiClient.php on line 298

(Ravi Mittal) #4

Please help if anyone has solution for this?


(Spencer Hunter) #5

Hey @Ravi_Mittal, Just as a sanity check, are you able to curl this endpoint?

curl -X POST -H "Accept: application/vnd.dwolla.v1.hal+json" -H "Content-Type: application/json" -H "Authorization: Bearer M2fykrChI9bneNkE3O8Jl90DK3EcA5aWA0su66KumDwSGsURaE" -d '{
    "firstName": "Ravi",
    "lastName": "Mittal",
    "email": "ravi@dexteroustechnologies.co.in",
    "ipAddress": "99.99.99.99"
}' "https://api-uat.dwolla.com/customers" -v

(Ravi Mittal) #6

@spencer Its working now, I was earlier trying in localhost, but now moved to https domain. Thanks for your help…


(Frank Rao) #7

Hi, I had the same issue today, same like Ravi_Mittal, I’m testing on localhost, is the request blocked from localhost ?

Message: API call to https://api-uat.dwolla.com/customers timed out: a:26:{s:3:“url”;s:36:“https://api-uat.dwolla.com/customers";s:12:“content_type”;N;s:9:“http_code”;i:0;s:11:“header_size”;i:0;s:12:“request_size”;i:0;s:8:“filetime”;i:-1;s:17:“ssl_verify_result”;i:1;s:14:“redirect_count”;i:0;s:10:“total_time”;d:0.17199999999999999;s:15:“namelookup_time”;d:0.125;s:12:“connect_time”;d:0.14099999999999999;s:16:“pretransfer_time”;d:0;s:11:“size_upload”;d:0;s:13:“size_download”;d:0;s:14:“speed_download”;d:0;s:12:“speed_upload”;d:0;s:23:“download_content_length”;d:-1;s:21:“upload_content_length”;d:-1;s:18:“starttransfer_time”;d:0;s:13:“redirect_time”;d:0;s:12:“redirect_url”;s:0:"";s:10:“primary_ip”;s:13:“104.20.47.245”;s:8:“certinfo”;a:0:{}s:12:“primary_port”;i:443;s:8:“local_ip”;s:13:“192.168.1.103”;s:10:"local_port”;i:61165;}


(Spencer Hunter) #8

Hey @Frank_Rao, Were you able to curl that endpoint with success? Do you have the full request and response body, as well as headers?


(Frank Rao) #9

@spencer Sorry to respond late.

I tried this curl command
curl -X GET -H "Accept: application/vnd.dwolla.v1.hal+json" -H "Content-Type: application/json" -H "Authorization: Bearer y6ILZWALoqNOjQBAwV5uLgF48uUv9PNKRZJHO66dmaZ8htoMYi" -d '{"limit": "10"}' "https://api-uat.dwolla.com/customers" -v

It works fine
But through the php web page call to the API, it still errors out

                DwollaSwagger\Configuration::$access_token = 'y6ILZWALoqNOjQBAwV5uLgF48uUv9PNKRZJHO66dmaZ8htoMYi';
  	$apiClient = new DwollaSwagger\ApiClient("https://api-uat.dwolla.com/");			
  	$customersApi = new DwollaSwagger\CustomersApi($apiClient);
  	$myCusties = $customersApi->_list(10);
An uncaught Exception was encountered

Type: DwollaSwagger\ApiException

Message: API call to https://api-uat.dwolla.com//customers?limit=10 timed out: a:26:{s:3:"url";s:46:"https://api-uat.dwolla.com//customers?limit=10";s:12:"content_type";N;s:9:"http_code";i:0;s:11:"header_size";i:0;s:12:"request_size";i:0;s:8:"filetime";i:-1;s:17:"ssl_verify_result";i:1;s:14:"redirect_count";i:0;s:10:"total_time";d:0.047;s:15:"namelookup_time";d:0;s:12:"connect_time";d:0.032000000000000001;s:16:"pretransfer_time";d:0;s:11:"size_upload";d:0;s:13:"size_download";d:0;s:14:"speed_download";d:0;s:12:"speed_upload";d:0;s:23:"download_content_length";d:-1;s:21:"upload_content_length";d:-1;s:18:"starttransfer_time";d:0;s:13:"redirect_time";d:0;s:12:"redirect_url";s:0:"";s:10:"primary_ip";s:13:"104.20.48.245";s:8:"certinfo";a:0:{}s:12:"primary_port";i:443;s:8:"local_ip";s:13:"192.168.1.113";s:10:"local_port";i:57980;}

Filename: \application\libraries\dwollaApi\ApiClient.php

Line Number: 298

(3lots Com) #10

I am getting exactly the same issues. I don’t see any resolution to this problem. I am using localhost


(jason) #11

@3lots.com There is a small bug with the php sdk that expects the root url that is passed into the DwollaSwagger\ApiClient to not contain an ending slash. We are updating the sdk to remove this assumption. I will post back here when the new version is released.

In the meantime, you can remove the trailing slash from the url and it should work for you.


(jason) #12

@3lots.com Version 1.0.14 of the SDK is available now which includes the root url fix. Let us know if you have any other issues or questions.


(3lots Com) #13

seems to be a cert error now. I guess I need a legit cert on localhost.

fixed the log error and now getting a certificate error. I guess I need to legitimize my cert on localhost
[DEBUG] HTTP Request body ~BEGIN~

~END~
[DEBUG] HTTP Response body ~BEGIN~

~END~

  • Hostname in DNS cache was stale, zapped
  • Trying 104.20.48.245…
  • Connected to api-sandbox.dwolla.com (104.20.48.245) port 443 (#0)
  • Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
  • NPN, negotiated HTTP1.1
  • SSL certificate problem: unable to get local issuer certificate
  • Closing connection 0

(Spencer Hunter) #16

@3lots.com, You may find this thread here to be helpful.