wsimport for Onvif wsdl - no service definition

2019-07-13 18:03发布

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.

标签: soap wsdl onvif
1条回答
聊天终结者
2楼-- · 2019-07-13 19:00

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.

查看更多
登录 后发表回答