title: Simple Web Service adding two numbers
body: <p>I have created a simple Webservice function as shown below;</p>
  
  <pre><code>/*
   * To change this template, choose Tools | Templates
   * and open the template in the editor.
   */
  package ws;
  import javax.jws.WebService;
  /**
   *
   * @author Joe
   */
  @WebService()
  public class Add2Int {
  public int add(int a, int b) {
      return (a+b);
  }
  }
  </code></pre>
  
  <p>and I have created a very simple gui that allows the user to enter 2 numbers and which should output the result however this does not work?  I tried it without the gui and it works but when i build the gui it does not work?  here is my code for that side of things</p>
  
  <pre><code>/*
   * To change this template, choose Tools | Templates
   * and open the template in the editor.
   */
  
  package myjavawsclient;
  //import java.io.*;
  import javax.swing.*;
  import java.awt.*;
  import java.awt.event.*;
  
  /**
   *
   * @author Joe
   */
  public class Calculator extends JFrame implements FocusListener {
      JTextField value1 = new JTextField("", 5);
      JLabel plus = new JLabel("+");
      JTextField value2 = new JTextField("",5);
      JLabel equals = new JLabel("=");
      JTextField sum = new JTextField("", 5);
  
      public Calculator() {
          super("The Calculator");
          setSize(350,90);
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          FlowLayout flow = new FlowLayout(FlowLayout.CENTER);
          setLayout(flow);
          // add the listners
          value1.addFocusListener(this);
          value2.addFocusListener(this);
          // set up sum field
          sum.setEditable(true);
          //add componets
          add(value1);
          add(plus);
          add(value2);
          add(equals);
          add(sum);
          setVisible(true);
      }
  
      public void focusGained(FocusEvent event){
          try { // Call Web Service Operation
              ws.Add2IntService service = new ws.Add2IntService();
              ws.Add2Int port = service.getAdd2IntPort();
              // TODO initialize WS operation arguments here
              int result = 0;
              int result2 = 0;
              result = Integer.parseInt(value1.getText());
              result2 = Integer.parseInt(value2.getText());
  
              int total = port.add(result, result2);
              sum.setText("" +total);
  
              //float plusTotal = Float.parseFloat(value1.getText()) +
                  Float.parseFloat(value2.getText());
  
          } catch (Exception ex) {
              // TODO handle custom exceptions here
              //value1.setText("0");
              //value2.setText("0");
              //sum.setText("0");
          }
      }
  
      public void focusLost(FocusEvent event){
        focusGained(event);
      }
  
      /**
       * @param args the command line arguments
       */
      public static void main(String[] args) {
  
          // TODO code application logic here
  
          Calculator frame = new Calculator();
      }
  }
  </code></pre>
  
  <p>I am not getting any errors I am just not getting any result from the 2 numbers, for example 1+1=2 but with my application it allows the user to enter 1 + 1 = ? but where the question mark is nothing gets shown.</p>
  
  <p>I was wondering if anyone could solve this problem for me. Oh and I am using NetBeans and GlassFish App server with WSDL</p>
  
  <p>Joe</p>