2011-08-22 85 views
6

我試圖使用AXIS2/C(C++)創建的wsdl http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl的存根,使用下面的命令:AXIS2/C和ONVIF

./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 

回答

0

這個錯誤通常來,因爲該工具無法找到在WSDL服務元素。因爲在WSDL定義中必須定義一個端點。請檢查您的WSDL是否包含服務元素或任何其他導入的WSDL具有服務元素。

所以基本上要擺脫這個,你必須在這個WSDL中定義一個端點。

0

我用了hack used on python-zeep,但它與幫助的Axis2/C作爲得好:

添加這devicemgmt.wsdl,剛剛結束標記 「</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> 

但是,在使用任何變量綁定生成代碼(「ADB中不支持混合內容的XSD complexType」)時,我仍然遇到問題。我不得不禁用它如下:

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