wsimport for Onvif wsdl - no service definition

三世轮回 提交于 2019-12-11 02:35:16

问题


There are several questions along similar line but none answers this definitively.

I'm using wsimport to generate code from a .wsdl file (Onvif's wsdl files). Running

wsimport -keep https://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl -extension -Xnocompile

outputs

At least one WSDL with at least one service definition needs to be provided.

Based on this SO answer I added this service declaration, locally downloaded the onvif.xsd, and common.xsd, modified the path specified for these Onvif files, which then generated the code.

Is there a more straightforward way to run the wsimport command on each of these Onvif URLs? There are over 20 wsdl files, and I find it silly to manually download, then make the above changes in each file to be able to run wsimport.


回答1:


You should make these changes in your WSDL file:

  1. add name="DeviceService" in line 11 which starting with <wsdl:definitions...

  2. add

    <wsdl:service name="DeviceService"> <wsdl:port name="DevicePort" binding="tds:DeviceBinding"> <soap:address location="http://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl"/> </wsdl:port> </wsdl:service>

at the end of file after </wsdl:binding>

Then run the generating command.



来源:https://stackoverflow.com/questions/49937930/wsimport-for-onvif-wsdl-no-service-definition

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!