2

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.

Crearo Rotar
  • 559
  • 7
  • 23

1 Answers1

3

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.

Yoones Imani
  • 106
  • 1
  • 6
  • I understand this is to be done. I would like to avoid making these changes for all Onvif wsdl files - my question specifically is how to avoid adding these lines to all wsdl file. – Crearo Rotar Apr 23 '18 at 08:36
  • 1
    I think there is not another choice, these errors come from `WSDL` files which have been uploaded in `ONVIF` web site. It may be company's trick! I tried for about more than 2 weeks to find out these errors. – Yoones Imani Apr 23 '18 at 10:15
  • 2
    That's just a shame. It's very annoying that being an _open standard_, they don't have any open source full usage example. All they've provided is an Application Programmer's Guide and nothing else; and that is almost unusable. Took me over 2 days just to get login to work. – Crearo Rotar Apr 30 '18 at 09:50
  • That works for me, too. Thanks. To automate the replacement process, I developed a linux shell script using "sed" and "grep" commands. – Mohammad Hadi May 13 '18 at 04:50