正在加载图片...
MyEclipse6Java开发中文教程 Web service name:处输入 Helloworld,第二个地方是点击 Java package一行末尾的 New.按钮,在弹出的新建包对话框中输入 bellows,然后点击OK按钮返回(也可以直接 输入现有的包名)。这一页的其它地方包括设置Java源代码目录( Java source folder),以 及服务接口名( Service interface,会自动根据输入的服务名生成),服务实现类( Service impl cass),还有SOAP的风格( SOAP style/use)以及 Servlet的作用域( Servlet scope,可 用值包括app| ication, request, session)。当一切设置完毕后,点击 Finish按钮即可完成 向导并生成代码 Hey eb service New Web Service- Bottom-up Scenaric eb service from Ja Web service proiect: HelloWorldservice ervI ce nam HelloWorld Java Implementation Java source folder: src Java package bellows onse New Service interface:IHelloWorld Service impl. class: HelloWorldImpl SOAP Servlet Confi gurati SOAP style/use: wrapped/literal 191点击此接按钮输入包 图159新建Web服务向导第二页 此时我们看看所发生的变化,首先是 services. xM发生了改变: beansxmlns="http://xfire.codehaus.org/config/1.0"> <service> <name>Helloworld/name> <serviceclass>bellows. /Hello world</serviceclass> implementation class> hellos. HelloworldImpl </implementation <style>wrapped</style> <use>litera/</use> <scope>application</scope> </service> 这就给了我们一种提示,那就是我们可以自己手工修改这个文件来加入更多的Web Service,无非就是需要一个接口和一个实现类,然后在此配置文件中加入更多的 service 标签即可。再来看看在src/ bellows目录下多了两个Java类,分别是 Helloworlo和 Helloworld。源代码非常简单,先看接口 THelloworld 刘长炯著MyEclipse 6 Java 开发中文教程 10 刘长炯著 Web service name:处输入 HelloWorld,第二个地方是点击 Java package 一行末尾的 New...按钮,在弹出的新建包对话框中输入 hellows,然后点击 OK 按钮返回(也可以直接 输入现有的包名)。这一页的其它地方包括设置 Java 源代码目录(Java source folder),以 及服务接口名(Service interface,会自动根据输入的服务名生成),服务实现类(Service impl. class),还有 SOAP 的风格(SOAP style/use)以及 Servlet 的作用域(Servlet scope,可 用值包括 application,request,session)。当一切设置完毕后,点击 Finish 按钮即可完成 向导并生成代码。 图 15.9 新建 Web 服务向导第二页 此时我们看看所发生的变化,首先是 services.xml 发生了改变: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://xfire.codehaus.org/config/1.0"> <service> <name>HelloWorld</name> <serviceClass>hellows.IHelloWorld</serviceClass> <implementationClass> hellows.HelloWorldImpl </implementationClass> <style>wrapped</style> <use>literal</use> <scope>application</scope> </service> </beans> 。这就给了我们一种提示,那就是我们可以自己手工修改这个文件来加入更多的 Web Service,无非就是需要一个接口和一个实现类,然后在此配置文件中加入更多的 service 标签即可。再来看看在 src/hellows 目录下多了两个 Java 类,分别是 IHelloWorld 和 HelloWorld。源代码非常简单,先看接口 IHelloWorld:
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有