java - wsgen 限制 : what constructs to avoid

标签 java web-services soap wsgen

我正在使用 JAX-WS (JSR 224) 的@WebService 和@WebMethod 注释创建一个网络服务。虽然我找到了the specification ,我找不到任何记录在案的我遇到的限制。

到目前为止,这是我使用 JDK 6 提供的 JAX-WS 2.1.6 时偶然发现的内容:

  • 您不能将接口(interface)用作参数、返回值或对象成员
  • 所有类都必须提供无参默认构造函数

wsgen 的局限性是什么?我应该避免哪些结构?

我也偶然发现了一些奇怪的错误,所有这些错误看起来都类似于以下内容,并且可能是一个错误:

Note:   ap round: 1
Problem encountered during annotation processing; 
see stacktrace below for more information.
java.lang.NullPointerException
        at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.isLegalType(WebServiceVisitor.java:770)
        at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.isLegalMethod(WebServiceVisitor.java:618)
        at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.methodsAreLegal(WebServiceVisitor.java:588)
        at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.isLegalImplementation(WebServiceVisitor.java:506)
        at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.shouldProcessWebService(WebServiceVisitor.java:309)
        at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.visitClassDeclaration(WebServiceVisitor.java:112)
        at com.sun.tools.apt.mirror.declaration.ClassDeclarationImpl.accept(ClassDeclarationImpl.java:95)
        at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP.buildModel(WebServiceAP.java:315)
        at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP.process(WebServiceAP.java:256)
        at com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.process(AnnotationProcessors.java:60)
        at com.sun.tools.apt.comp.Apt.main(Apt.java:454)
        at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:258)
        at com.sun.tools.apt.main.Main.compile(Main.java:1102)
        at com.sun.tools.apt.main.Main.compile(Main.java:964)
        at com.sun.tools.apt.Main.processing(Main.java:95)
        at com.sun.tools.apt.Main.process(Main.java:85)
        at com.sun.tools.apt.Main.process(Main.java:67)
        at com.sun.tools.internal.ws.wscompile.WsgenTool.buildModel(WsgenTool.java:204)
        at com.sun.tools.internal.ws.wscompile.WsgenTool.run(WsgenTool.java:112)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.tools.internal.ws.Invoker.invoke(Invoker.java:105)
        at com.sun.tools.internal.ws.WsGen.main(WsGen.java:41)
error: compilation failed, errors should have been reported

最佳答案

看看这是否有助于解决奇怪的错误(我通过适当的类路径设置解决了与您类似的错误): http://eskatos.wordpress.com/2007/10/16/glassfish-hibernate-and-webservices-wsgen-classpath/

关于java - wsgen 限制 : what constructs to avoid,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2587823/

相关文章:

web-services - Delphi 2010导入WCF wsdl时锁定然后关闭

c# - ...可能不会在这种情况下使用...而序列化

node.js - 在 node-soap 中,如何查看/调试生成的 XML SOAP 请求?

java - java在内存中存储数据的数据库是哪个?

java - 单击 x 时隐藏而不是处置 viewpart

java - 按钮执行绝对忽略 for 循环

python - 使用 django 的 heroku 不允许使用 405 POST 方法

java - 如何在 Spring 中创建数据更改表单

api - REST API 模式的替代方案

Android SOAP XML 解析 ListView 错误