从Onvif wsdl文件生成客户端Web服务

时间:2014-02-19 10:42:04

标签: java wsdl2java webservices-client onvif

我正在尝试从位于here Onvif标准 wsdl文件创建客户端Web服务。在我使用Apache CFX完成Eclipse向导中的所有步骤后,我得到了这个输出:


Loading FrontEnd jaxws ...
Loading DataBinding jaxb ...
wsdl2java -client -d /storage/workspaces/homework/ws1/.cxftmp/src -classdir /storage/workspaces/homework/ws1/build/classes -impl -validate -exsh false -dns true -dex true -wsdlLocation http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl -verbose -defaultValues -fe jaxws -db jaxb -wv 1.1 http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl
wsdl2java - Apache CXF 2.7.10

Feb 19, 2014 12:38:27 PM org.apache.cxf.tools.validator.internal.WSDLRefValidator collectValidationPoints
WARNING: WSDL document http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl does not define any services

WSDLToJava Error: Schema Error : src-resolve: Cannot resolve the name 'wsa:EndpointReferenceType' to a(n) 'type definition' component.

org.apache.cxf.tools.common.ToolException: Schema Error : src-resolve: Cannot resolve the name 'wsa:EndpointReferenceType' to a(n) 'type definition' component.
    at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.validateSchema(JAXBDataBinding.java:1001)
    at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.addSchemas(JAXBDataBinding.java:652)
    at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:443)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer.java:714)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:270)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:164)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:412)
    at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
    at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
    at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
    at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:184)
Caused by: org.xml.sax.SAXParseException; src-resolve: Cannot resolve the name 'wsa:EndpointReferenceType' to a(n) 'type definition' component.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:347)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:4166)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:4145)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getGlobalDecl(XSDHandler.java:1678)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(XSDElementTraverser.java:405)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseLocal(XSDElementTraverser.java:194)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.traverseLocalElements(XSDHandler.java:3618)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:633)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:616)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:574)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:540)
    at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:252)
    at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:627)
    at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.validateSchema(JAXBDataBinding.java:995)
    ... 10 more

我是网络服务的新手。任何人都可以解释我的问题是什么,我该怎么做才能解决它?

1 个答案:

答案 0 :(得分:1)

最后,我设法找到了我的方案的解决方法:

我没有通过Eclipse生成Java类,而是通过CLI直接完成,使用apache-cfx tutorial中建议的命令。在此之后,我在Eclipse项目中导入了生成的文件。对于那些需要在这个问题上进行更多挖掘的人,here我对一个非常相似的问题做了回应。

希望对某人有用。