AXIS2/C and ONVIF

AXIS2/C and ONVIF

本文关键字:ONVIF and AXIS2      更新时间:2023-10-16

我尝试使用AXIS2/C (c++)创建wsdl http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl的存根,使用以下命令:

./WSDL2CPP.sh -uri http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl

,我得到以下答案:

Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing WSDL
    at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:153)
    at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
    at org.apache.axis2.wsdl.WSDL2CPP.main(WSDL2CPP.java:19)
Caused by: org.apache.axis2.AxisFault: **`No service was not found in the WSDL at http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl with targetnamespace http://www.onvif.org/ver10/device/wsdl`**
    at org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder.populateAllServices(WSDL11ToAllAxisServicesBuilder.java:115)
    at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:147)
    ... 2 more

我使用了python-zeep上使用的hack,但它也有助于axis2/c:

将此添加到devicemgmt。Wsdl,就在结束标记":

<wsdl:service name="DeviceService">
             <wsdl:port name="DevicePort" binding="tds:DeviceBinding">
               <soap:address location="http://192.168.1.100/onvif/device_service"/>
             </wsdl:port>
</wsdl:service>

然而,我仍然有问题生成代码与任何变量绑定("XSD complexType与混合内容不支持在ADB")。我必须禁用它,如下所示:

./WSDL2C.sh -o ../axis2c-test/gen -d none -uri devicemgmt.wsdl

此错误通常是因为工具无法在WSDL中找到服务元素而出现的。因为在WSDL定义中,它必须定义一个端点。请检查您的WSDL是否包含服务元素,或者任何其他导入的WSDL是否包含服务元素。

所以基本上要摆脱这个,你必须在这个WSDL中定义一个端点。