I have a sample question,can i return a Jframe in a method defined in a jaxws webservice implementation class.if soo give me steps simple steps onlt or keywords,
i ve tried for example:

import java.awt.*;
import javax.jws.WebService;
import javax.jws.WebMethod;
    @WebService(serviceName="frameService", portName="framePort", name="frame",wsdlLocation = "WEB-INF/primary.wsdl")
    public class frameserver implements Serializable{
    public Object send()

     Object o=new Object();
     JFrame f=new JFrame("khaled");
     JLabel l=new JLabel("hiba");
     return o;


    public static void main(String[] args)

i ve created a jax ws web service and do this but i m receiving an error.pls tell me if possible sending jframe using this way or no .wish somebody would answer my question ive been searching for couple of months without finding a solution to my problem

Recommended Answers

All 5 Replies

Anyway why would you want to do something like that?

bcs as a client is requesting certain data from my database remotely,so i want to return certain records from my database to present it in a jtable so i want to return a jfraame.but in a normal method not used in a webservice i can return a jframe,why using jaxws i cant do so??

Well you got your facts wrong. Your Swing application should query service, service should process request and return data in some for of object. This object is then taken over by Swing and showed to user. Because you just want to show some data, example user details (username, real name, DOB, email address etc) you not gone push the whole java framework from your webservice. Besides recipient of the request doesn't have to be necessary Java application

apreciate ur response,
yes for sure the client side is not a java applications.i gave an example only,i can use a server side program as jsp or servlet to call the webservice,but i want to know as kind of curiosity is it possible to return a jtable for example in this web service that i m calling.bcs normally i programed many small applications and returned a jframe,but this is not the case in jaxws,i want to know only why??

For once you are sevice provider you provide responce to request and do not add any unnecessary extras.Secondly why would you want to push an elephant object that will take XYZ amount of time when you can push small ant and recepient. Lastly you do not know what version of Java recipient may run, it may be older or newer then what you are using to create response and may not have some of the stuff you reffering in your object because it was added in version after it or it was removed for some reason.

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.