Author

Topic: Dwolla C# Example Code (Read 2453 times)

hero member
Activity: 742
Merit: 500
July 07, 2011, 09:50:46 PM
#10
Yeah, I thought that was odd too, but what they're exposing to me has two boolean outs and if i leave either of them off it tells me that no override for that function has that number of parameters. Also its return type is void so no "bool whatever = function()"

I'm so confused at this point. They really should publish sample code Tongue
full member
Activity: 302
Merit: 100
Presale is live!
July 07, 2011, 06:51:49 PM
#9
aha sorry for my retardedness, i thought you were handling all the webrequests yourself as i've never worked with WCF myself but i came just came across it in my research now so i guess you're using that...

I've read up some more on dwolla dev forum and at first glanse it's kinda odd you're specifying 2 out parameters because according to http://www.dwolla.org/d/showthread.php?3-SOAP-API the API looks like this:

SendMoneyAssumeCosts (Sender will assume cost(s) of the transaction)
ParameterTypeDescription
ApiKeyStringDwolla assigned API key
ApiCodeStringDwolla assigned API code
AmountDecimalAmount to send to destination user
DescriptionStringDescription of the transfer (0-250 chars)
DestinationIDStringDestination user’s Dwolla ID
Returns: Boolean. True if the transfer was successfully processed. False or exception otherwise

However as i said i have never worked with WCF or dwolla so i can't tell if it's that...
hero member
Activity: 742
Merit: 500
July 07, 2011, 06:39:31 PM
#8
And yes, I realize that Dwolla's forums would be a more appropriate place to ask these questions, but their draconian registration process requires hand-approval which apparently no one is there to do right now, been waiting on approval for something like 7 hours now Tongue
hero member
Activity: 742
Merit: 500
July 07, 2011, 06:31:03 PM
#7
To make any qualified guess about what's wrong we're going to need the code of the client.SendMoneyAssumeCosts() method (just omit any API keys and what not)...

I do see one line that's supsecious: decimal amt = System.Convert.ToDecimal(1.00);

Why not just write decimal amt = 1.00d; ?



I don't have the code for client.SendMoneyAssumeCosts, client is an Api object, and Api is the class I'm pulling in from the https://www.dwolla.com/api/API.svc?wsdl web reference. SendMoneyAssumeCosts is Dwolla's code which I do not have.

As for the decimal conversion, there was much more code before and it's gone through many iterations. That didn't used to be a static value and I simply didn't change the code around it when I changed it to a static value for testing.
full member
Activity: 302
Merit: 100
Presale is live!
July 07, 2011, 06:25:56 PM
#6
To make any qualified guess about what's wrong we're going to need the code of the client.SendMoneyAssumeCosts() method (just omit any API keys and what not)...

I do see one line that's supsecious: decimal amt = System.Convert.ToDecimal(1.00);

Why not just write decimal amt = 1.00d; ?

hero member
Activity: 742
Merit: 500
July 07, 2011, 06:20:10 PM
#5
Oh and for the record, I'm using their SOAP API but if someone has sample code for REST I'll happily switch to that one instead.
hero member
Activity: 742
Merit: 500
July 07, 2011, 06:19:35 PM
#4
Hi Zagitta,

I wasn't looking for generic SOAP or REST instructions, I was looking for specific documentation of Dwolla's API as used in C#. Neither SOAP nor REST are that complicated, the problem is that I'm getting unexpected results from Dwolla and can't figure out why and there is no code that I can find floating around to tell me how wrong I've done this.

I'm quite sure it's something simple and stupid, I'm not even out of the initial testing phase, tapping out a few lines of untrapped code just to see what does and doesn't work. Perhaps I've just been staring at the problem too long and it needs fresh eyes.

I've got a web reference to https://www.dwolla.com/api/API.svc?wsdl set up in my project, as per their documentation. Here is the code I'm trying to make work, with API keys and account numbers redacted. Despite its brevity I'm sure it's a hot mess, considering what I've been up to these last few hours, but hopefully you can spot the problem?

protected void Page_Load(object sender, EventArgs e)
        {
            Api client = new Api();
           
            bool bResult;
            bool bResultSpec;
            decimal amt = System.Convert.ToDecimal(1.00);
           
            client.SendMoneyAssumeCosts("apikey_redacted", "apicode_redacted", amt, true, "test", "acct_num_redacted", out bResult, out bResultSpec);
            Label1.Text = bResult.ToString();

            client.Dispose();
        }

on the client.SendMoneyAssumecosts() line I get "The request failed with an empty response." and can't figure out why.
full member
Activity: 302
Merit: 100
Presale is live!
July 07, 2011, 06:06:54 PM
#3
http://rest.elkstein.org/2008/02/using-rest-in-c-sharp.html

http://developer.yahoo.com/dotnet/howto-rest_cs.html

Are you sure you googled? because it took me litterally 3 minutes to find something simple and useful searching for "C# REST"  Tongue

I can't make any comments on the error though before you post code Smiley

If you want i can probably help you over skype or MSN...
hero member
Activity: 742
Merit: 500
July 07, 2011, 06:02:06 PM
#2
For clarification, I've added the web reference to https://www.dwolla.com/api/API.svc?wsdl and added the appropriate references, etc.

I create a new instance of their Api object called "client" and throw my various values into variables, then execute this:

client.SendMoneyAssumeCosts("myapikeyhere", "mysecrethere", amt, true, "test", "account-number-here", out bResult, out bResultSpec);

This code fails and throws the error: "The request failed with an empty response."

Any ideas?
hero member
Activity: 742
Merit: 500
July 07, 2011, 05:40:51 PM
#1
So my google-fu is failing me. Does anyone have (or can find better than I can) a simple C# example of sending and requesting/receiving money with the Dwolla API (SOAP or REST, I don't really care at this point).

I've found example code in every other language, but for some reason it looks NOTHING like what's exposed to me via the exact same web reference...
Jump to: