4. 打开 toFlash.java 文件,对代码进行编辑。输入以下代码:
package f2k4;
/**
*
Title: Java For F2K4 WebService
*
Description: 这是一个非常简单的例子,希望能用这简单的例子带出大家更好更多的Idea
*
Copyright: Copyright (c) 2003
*
Company: moonfun
* @author Littlejie
* @version 1.0
*/public class toFlash {
//声明一个str的字符私有变量;
private String str;
//声明一个名叫 sayHello 的公开函数;
//参数:字符串;
//返回:字符串;
public String sayHello(String str){
this.str="你好阿"+str;
return this.str;
}
}
5. 选中 toFlash.java ,右键选择菜单,发布 webService。
如图:
请选择 Export as a Web Service,进行对WebService的发布。然后他会出现下面这两个面版的。我们全部都使用默认的缺省设置,直接按Finish就可以了。
如图:
6. 好了,现在 WebService 已经成功发布了。那么他究竟在哪里呢??很多朋友都没有配置 tomcat 等等,这怎么办呢??别怕,JB9能够帮你很容易的完成这个测试任务。
" Baby! Follow me ! "
如图:
请选择 example1 -> Root directory -> index.html ,然后右键。选择菜单->Web Run using “Web Service Server”
发布后,你访问的应该是:
http://localhost:8080/example1/index.html 这个网址。
点击View the list of deployed web service 试试吧。
如果你的命名等等都跟我是一样的话,那么你的WSDL地址应该是:
http://localhost:8080/example1/services/toFlash?wsdl
好了,Java的部分就已经完成了。下面就到Flash部分了。
注意:别把现在JB9里面的东西关掉哦~~~
出处:蓝色理想
责任编辑:qhwa
◎进入论坛Flash专栏版块参加讨论