能看到wwdl文档,就说明你得web服务发布成功了,你现在可以开发一个客户端来消耗他了!!!

解决方案 »

  1.   

    第一个问题:可能是版本问题吧,1.1后,只要http://localhost/services/BookService?WSDL  成功就可以了。
    第二个问题:说明你没有把User Guide中的所有项看完.我这有个例子你照着做一下:
    <project name="Tapestry/Spring/Hibernate Example" default="client" basedir=".">
    <path id="cp">
    <fileset dir="WebContent/WEB-INF/lib/">
    <include name="**/*.jar" />
    </fileset>
    </path>
    <taskdef name="wsgen" classname="org.codehaus.xfire.gen.WsGenTask" classpathref="cp" />
    <target name="client">
    <wsgen outputDirectory="client" wsdl="./src/wsdl/XmlService.wsdl" package="com.test.transition" binding="xmlbeans" />
    </target>
    </project>
      

  2.   

    http://localhost/services/下你没配访问请求的文件,不能访问也没什么.
    http://localhost/services/BookService?WSDL  可以打开说明你的Xfire的服务发布没有问题了
    下面要作的是写一个客户端来使用类似下面
    Service serviceModel = new ObjectServiceFactory().create(BookService.class);        
          
           XFire xfire = XFireFactory.newInstance().getXFire();
          XFireProxyFactory factory = new XFireProxyFactory(xfire);      
      
          String serviceUrl = "http://localhost:8080/service/bookService";
          
          BookService client =  (BookService) factory.create(serviceModel, serviceUrl);
    然后客户端就可以用client .*....来调用服务器方法了
      

  3.   

    楼上的大虾我按照你写的客户端调用webservice报错.
    Exception in thread "main" java.lang.IllegalStateException: Service class is not an interface. Please use an interface specify or specify one via a @WebService annotation.public class Client {
        public static void main(String arg[]) throws Exception {
            Service serviceModel = new ObjectServiceFactory().create(BookService.class);        XFire xfire = XFireFactory.newInstance().getXFire();
            XFireProxyFactory factory = new XFireProxyFactory(xfire);        String serviceUrl = "http://localhost/servlet/XFireServlet/";        BookService client = (BookService) factory.create(serviceModel, serviceUrl);
        }
    }
      

  4.   

    断点显示是这行的错
    BookService  client  =  (BookService)  factory.create(serviceModel,  serviceUrl);
      

  5.   

    看你也是属狗的我就帮帮你啦
    来我的BLOG看看,有你需要的东东,另外,你也可以考虑一下用AXIS2开发WEB Services.
    http://www.blogjava.net/lbx19822004/
    欢迎过来啊!
      

  6.   

    有什么问题的话,请在我的BLOG上也留个言。
      

  7.   

    一共两个问题:
    我看的是晁岳攀写的tutorial,按照他写的我配置了xfire附带的book例子。
    问题1:启动服务后输入地址http://localhost/services/  却显示“找不到网页”
    但是输入http://localhost/services/BookService?WSDL  却可以显示这个webservice的wsdl,请问这是怎么会事问题2:而且他里面写到了可以用Wsgen生成客户端代码,但是我搜遍了整个xfire-distribution-1.0文件夹也没看见。请问怎样生成客户端代码-----------------------------------------
    你需要输入具体服务的URL,在你的例子中就是http://localhost?services/BookService在xfire的文档里有生成client的例子,你可以看看,但我是自己手写的
      

  8.   

    楼上的大虾我按照你写的客户端调用webservice报错.
    Exception in thread "main" java.lang.IllegalStateException: Service class is not an interface. Please use an interface specify or specify one via a @WebService annotation.public class Client {
        public static void main(String arg[]) throws Exception {
            Service serviceModel = new ObjectServiceFactory().create(BookService.class);        XFire xfire = XFireFactory.newInstance().getXFire();
            XFireProxyFactory factory = new XFireProxyFactory(xfire);        String serviceUrl = "http://localhost/servlet/XFireServlet/";        BookService client = (BookService) factory.create(serviceModel, serviceUrl);
        }
    }-----------------------------------开头报的异常已经说的很清楚了,new ObjectServiceFactory().create(BookService.class);
    这里传进去的应该是一个接口,如果服务不是接口必须要用@WebService annotation在类的开头声明一下,具体用法请参考文档
      

  9.   

    大家都是webservice高手啊,向大家学习!
      

  10.   

    to leafxx(我是你装满回忆的盒饭,你的承诺)
    谢谢,厉害,我已经明白了,马上结帖