3 Adding the Code
 
SOAP API > Tutorials > Java > Net Beans > Simple Credit Card Checker >
Simple Credit Card Validator - Part 3

Adding the Code.

1: First we need to create an event for when a user clicks the 'Validate' button. Make sure only the jButton1 is selected and right click on the button. Choose Events>Action>actionPerformed[jButton1ActionPerformed]

2: Add the following code the newly created jButton1ActionPerformed method.

validate.Validate service = new validate.Validate();validate.ValidateSoap port = service.getValidateSoap12();

java.lang.String keycode = "qwerty" ;
java.lang.String cardnumber = jTextField1.getText();
     
validate.Creditcard result = port.validateCreditCard(keycode, cardnumber);
         
jLabel2.setText( "Result: " +result.getValidity());

 

3: Now run the application and you should see a Window looking something like this:

4: You can now enter a credit card number into the text box, press the Validate button to determine if the card number is valid or not.

 

 

 

 


 


 

 ©Copyright 2023 Paygate Solutions Limited