Jump to content


Photo

Sample code not working


  • This topic is locked This topic is locked
15 replies to this topic

#1 midntrdr

midntrdr

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 22 March 2003 - 06:07 PM

I have taken the sample code provided an turned it into a servlet (my host doesn't support JSP). Basically just put the sample code into my "doPost". Shouldn't be any problems there.

The sample code doesn't seem to be working. If I test it myself I basically get no response from my servlet. Now I have started testing it at http://www.eliteweav...ing/ipntest.php

It says that my script isn't responding. I put in some trace messages to see if I could pinpoint where something was going wrong. Used the follow ipn button and got my trace messages to tell me that I was getting a "INVALID" response. But if I test it by sending money I don't get a "INVALID" response. It's like I get no response at all?

If anyone has had expierence with similar problems or can help in anyway I would be very greatful!!! I'm getting frustrated.

#2 midntrdr

midntrdr

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 24 March 2003 - 02:16 PM

Anyone?????? Any Java people out there?

#3 paypal_pb

paypal_pb

    Advanced Member

  • Members
  • 2,960 posts

Posted 24 March 2003 - 03:48 PM

A simple way to test your script: http://www.paypaldev...p?TOPIC_ID=1658

Patrick Breitenbach
PayPal, Inc.
Dev Net: https://www.paypal.com/pdn

#4 midntrdr

midntrdr

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 24 March 2003 - 07:53 PM

can I change variables like payer and reciever emails?

#5 midntrdr

midntrdr

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 24 March 2003 - 08:11 PM

Ok, if I post the form you are suggesting I get a VERIFIED response. But of course I am that form sends the script exact values. If I make an actual payment through paypal I get nothing! Not Verified or invalid just no response. If I test it with that eliteweaver script I get an invalid response and it says my script is not responding. Anything will work if you send it exactly what it's looking for in hidden fields. This is getting really frustrating because I originally wanted to go with paypal because I figured it would be a quick and easy process. That form you suggested isn't a good way to test because it isn't tesing the script its just assigning variables regardless of whether the post back to paypal works. This sample code to post back to paypal, has it really been tested and proven to work?

#6 midntrdr

midntrdr

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 25 March 2003 - 08:32 AM

Ok, I thought maybe it was my servlet engine. My host is using jserv which is horribly outdated and I think it uses jdk 1.1 which maybe some of the sample code isn't compatible with that jdk.

NOPE!! Just ran the same code at work on two different servers. One was JRun 3.1 using jdk 1.3 and the other is Bea Weblogic running jdk 1.4. Guess what? Same problem, script doesn't respond. The post back to paypal doesn't work.

Can anyone help please??????????


#7 midntrdr

midntrdr

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 25 March 2003 - 08:55 AM

I took the exact code provided by paypal and ran it as a JSP on Bea Weblogic and JRun. Much to my surprise, that doesn't even work.

#8 paypal_pb

paypal_pb

    Advanced Member

  • Members
  • 2,960 posts

Posted 25 March 2003 - 12:51 PM

The POST on http://www.paypaldev...p?TOPIC_ID=1658 simulates nearly identically what happens in IPN. You need to modify the "action" to the URL of *your* script.

The JSP sample code has been tested on mycgiserver.com.

Patrick Breitenbach
PayPal, Inc.
Dev Net: https://www.paypal.com/pdn

#9 midntrdr

midntrdr

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 28 March 2003 - 08:06 AM

I finally got this working! Sorry for ranting and raving that the code doesn't work. It was a problem in my conversion of it to a servlet.

#10 OrderFormCity

OrderFormCity

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 12 May 2003 - 11:19 AM

Yes. OrderFormCity.com

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Originally posted by midntrdr
[br]Anyone?????? Any Java people out there?
<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">

Aggregate client side invoicing. Customized shipping and quantity adjusted rates.
Add the power of Java to your shopping cart.

#11 jholme

jholme

    Member

  • Members
  • PipPip
  • 16 posts

Posted 13 June 2003 - 01:53 PM

midntrdr,

I'm getting ready to access IPN via a Servlet, and I'm curious to know exactly what the problem was when you converted the sample JSP code to Servlet code.

thanks,
John

John Holme
J2EE UI Developer

#12 paypal_pb

paypal_pb

    Advanced Member

  • Members
  • 2,960 posts

Posted 16 June 2003 - 02:07 PM

I suspect a typo or bug and nothing inherent to servlets.

Patrick Breitenbach
PayPal, Inc.
Dev Net: https://www.paypal.com/pdn

#13 richy

richy

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 17 January 2004 - 09:39 PM

midntrdr or anyone else,

can someone assist or send me a servlet code for the sample code?
i'm having a hard time trying to get it working...
also, if anyone has any advice on how to use IPN with struts?
thanks

email: teamrichy@hotmail.com

#14 znaps

znaps

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 21 January 2004 - 08:41 AM

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Originally posted by richy
[br]midntrdr or anyone else,

can someone assist or send me a servlet code for the sample code?
i'm having a hard time trying to get it working...
also, if anyone has any advice on how to use IPN with struts?
thanks

email: teamrichy@hotmail.com
<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">

Richy, I'm developing a Struts action. I'll post it up here when I'm done and sure it works correctly...but basically it's the same as the example code provided by Paypal for a Servlet, since Struts Actions are called from a Servlet.

In the webpage that contacts Paypal for the payment, you'll place something like <input type="hidden" name="notify_url" value="http://myserver.com/myPaymentAction.do"> so your Struts action class gets hit when the payment is processed by Paypal.



#15 Boombastik

Boombastik

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 16 February 2004 - 09:27 AM

znaps,

I'm also integrating Paypal with Struts. Progress is good, but I'm stuck on trying to get the initial form posted to the action forwarded to the external Paypal URL. The reason I post the form to the action is that I want to persist it (using hibernate).

Redirect works, but it's no good as the form data is lost...

#16 Andy_Baptiste

Andy_Baptiste

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 20 April 2005 - 12:49 PM

***if anyone can sort this out for me I'd be very even maybe 'financialy' grateful****


I'm adding IPN to a struts website also and can't get the sample code to work.

I think the jsp form that is submitted may work, its the servlet (struts action) that falls over when I reconnect to paypal to confirm:

// post back to PayPal system to validate
URL u = new URL("http://www.paypal.com/cgi-bin/webscr");
URLConnection uc = u.openConnection();
uc.setDoOutput(true);
uc.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
PrintWriter pw = new PrintWriter(uc.getOutputStream());

Its the final line above that falls over.

I'm getting www.paypal.com UnknownHostException

Tried with and without http.

Has anyone had and got over this?

Thanks People,

Andy

Andy




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users