问题描述
类似的问题中有几个问题,但没有一个可以肯定地回答.
There are several questions along similar line but none answers this definitively.
我正在使用wsimport
从.wsdl文件生成代码( Onvif的wsdl文件).正在运行
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
输出
At least one WSDL with at least one service definition needs to be provided.
基于此SO答案,我添加了此服务声明,在本地下载了onvif.xsd
和common.xsd
,修改了为这些Onvif文件指定的路径,然后生成了代码.
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.
在每个Onvif URL上是否都有更直接的方法来运行wsimport
命令? wsdl文件超过20个,我发现手动下载很愚蠢,然后在每个文件中进行上述更改以能够运行wsimport
.
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
.
推荐答案
您应在WSDL
文件中进行以下更改:
You should make these changes in your WSDL
file:
-
在以
<wsdl:definitions...
添加
<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>
<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>
在</wsdl:binding>
然后运行生成命令.
这篇关于用于Onvif wsdl的wsimport-无服务定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!