问题
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:
add
name="DeviceService"
in line 11 which starting with<wsdl:definitions...
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