Hi,Thanks for your help.However ,I do not know how to serialize JComponent and send it as a binary element within the SOAP ,or serialize it and send it as an attachment.The attachment is a simple example whose return type is JComponent,but it does not work.Could anyone help me to correct it or tell me some related websites ?Many thanks in advance.
kind regards, GS
From: "Anne Thomas Manes" <[EMAIL PROTECTED]> Reply-To: [email protected] To: [email protected] Subject: Re: return type of web service is swing. Date: Sun, 3 Sep 2006 13:55:46 -0400 SOAP is designed for exchanging XML, not Java components. If you want to use SOAP for this application, then you have two options -- you can serialize it and send it as a binary element within the SOAP message, or you can serialize it and send it as an attachment. Your other option is to use a native Java remoting technology, such as RMI, Jini, or JMS -- which is probably a better idea than using SOAP. Anne On 9/3/06, shu gao <[EMAIL PROTECTED]> wrote:Hi all, Thanks for your reply.I have to return JComponent because I am developing visualization web service about medical image using vtk tool (http://ij-plugins.sourceforge.net/vtk-examples/index.html).Do you think there is not other way except serializing the JComponent and sending it as an attachment,which is a very bad news for me?If so ,could you tell me how to do that or give me some related website?Many thanks in advance. Kind regards, Gao shu >From: "" Hasalaka Waravita<[EMAIL PROTECTED]> >Reply-To: [email protected] >To: [email protected] >Subject: Re: return type of web service is swing. >Date: Mon, 28 Aug 2006 17:10:01 +0530 > >This is such a bad design, WS meant to be remote services and should not >give UI specific output. Best thing would be to change the design and >return >a Model object may be a Object of complex type depending on requirement.>If it is unavoidable, you will have to think of something like serializing>the object and send it as an attachment, which anyway need redoing a >service. > >On 8/27/06, shu gao <[EMAIL PROTECTED]> wrote: >> >>Dear all,>> I am a newbie in web service.I am running into a problem.The return>>type of my web >>>>service is JComponent/JFrame.I do not know how to transfer it using soap>>message and how to >>>>develop the client program.Have you got some ideas for this trouble?Could>>you give me a >> >>hand?Many thanks in advance. >> >>Gao s >> >>_________________________________________________________________>>Be the first to hear what's new at MSN - sign up to our free newsletters!>>http://www.msn.co.uk/newsletters >> >> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: [EMAIL PROTECTED] >>For additional commands, e-mail: [EMAIL PROTECTED] >> >> _________________________________________________________________ Windows Live?Messenger has arrived. Click here to download it for free! http://imagine-msn.com/messenger/launch80/?locale=en-gb --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________Download the new Windows Live Toolbar, including Desktop search! http://toolbar.live.com/?mkt=en-gb
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.utils.Options;
import javax.xml.rpc.ParameterMode;
import javax.xml.namespace.QName;
import javax.swing.*;
import java.awt.*;
public class ClientWSDD
{
public static void main(String [] args) throws Exception {
String host = "http://localhost:";
String servicepath = "/axis/services";
Options options = new Options(args);
int port = options.getPort();
String endpoint = host + port + servicepath;
String method = null;
args = options.getRemainingArgs();
String op1 = null;
QName qn = new QName("exjc","jc");
// String ret = null;
JComponent ret=null;
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL (endpoint));
{
call.setOperationName(new QName ("exjc", "count"));
// call.setReturnType(XMLType.XSD_INT);
// ret = ((Integer) call.invoke((Object[])null)).toString();
System.out.println("Got result--JComponent " );
call.setReturnType(qn);
ret=(JComponent) call.invoke((Object[])null);
}
}
}
deploy.wsdd
Description: Binary data
package ex;
import javax.swing.*;
import java.awt.*;
public class exjc
{
public exjc(){}
/*public static void main(String s[]) {
zjc pp=new zjc();
JComponent panel=pp.disp();
JFrame frame = new JFrame("JComponent-ex");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add("Center", panel);
frame.pack();
frame.setVisible(true);
}*/
/*public int count(){
zjc pp=new zjc();
return 200;
}*/
public JComponent count(){
zjc pp=new zjc();
return pp.disp();
}
}
class zjc extends JComponent{
public zjc(){
JLabel label = new JLabel("Hello World");
JPanel p1=new JPanel();
p1.setLayout(new GridLayout(1,1));
p1.add(label);
setLayout(new BorderLayout());
add(p1,BorderLayout.CENTER);
}
public JComponent disp()
{
zjc panel = new zjc();
return panel;
/* JFrame frame = new JFrame("Helloworld");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add("Center", panel);
frame.pack();
frame.setVisible(true);*/
}
}
exjc.java --web service ClientWSDD.java --Client program error-message.jpg--error message while runing the ClientWSDD.java
undeploy.wsdd
Description: Binary data
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
