hey guys,
i have been asked to create a little web service. i have a very little understanding of how web services work but as far as im told is that all of my GUI has to be on client side and the logic of the program needs to be on the server.
now i am trying to work out how to crate a JButton and add actionListener to it without using the actionsPerfomed() method in the clients side. so the actionsPerformed() method would be on the server and the simple deceleration of the button

JButton button = new JButton();

would be on the client side
any suggestions or references would be greatly appreciated. also if you know some basic tutorials for web services i would also be very thankful for.

thank you

Recommended Answers

All 2 Replies

When you say web services do you mean real web services or are you talking about network programming with Java? Because the way you described what you want to do you could accomplish with network programming.

im not too sure about the correct terminology all i know i have one example to make a much bigger program
this is the client:
it only contains the output of the program. there is no logical code in this class!

import java.io.*;

public class Main
{

  
    public static void main(String[] args) 
    { try
      { calc.CalculatorService service = new calc.CalculatorService();
        calc.Calculator    port = service.getCalculatorPort();

        int a = 0;
        int b = 0;

        BufferedReader keybrd = new BufferedReader(new InputStreamReader(System.in));
        System.out.println("enter number a: ");
        a= Integer.parseInt(keybrd.readLine());
        System.out.println("enter number b: ");
        b= Integer.parseInt(keybrd.readLine());

        int c = port.add(a,b);
        System.out.println("sum = " + c);
      }
      catch (Exception ex)
      { System.out.println("exception = " + ex);
      }
     }

}

here is the server side

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package calc;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

@WebService()
public class Calculator {

    /**
     * Web service operation
     */
    @WebMethod(operationName = "add")
    public int add(@WebParam(name = "a")int a, @WebParam(name = "b") int b)
    {
        int c = a + b;
        return c;
    }

}

i need to follow this example and create GUI on the client side and add many more methods on the server side.
but im not even sure how to make a button to work in this principle.
thanks for your help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.