5
votes

I want to generate server code for a device like Camera. There is a standard protocol for these device called ONVIF which publish some popular WSDL documents. So I must generate an interface and skelton from ONFIV's WSDL documents.

When I use wsdl2java to generate server code from ONVIF wsdl file, it says:

org.apache.axis2.AxisFault: No services found in the WSDL at https://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl with targetnamespace http://www.onvif.org/ver10/device/wsdl

Is there a problem via these WSDL files?
How can generate Server code based on ONVIF WSDL?

2

2 Answers

3
votes

I had a same problem in generating java classes from WSDL files in order to create ONVIF web server. After a great deal of investigation I found out there are some errors in WDSL files which I got form https://www.onvif.org

If you want to create java classes properly you need to make some changes on them. First, in each .wsdl file check the correct path of schemaLocation , it may need to change to : schemaLocation="../../../ver10/schema/onvif.xsd"/>

And also check whether all .wsdl files have service tag like this.

<wsdl:service name="DeviceIOPService">
        <wsdl:port name="DeviceIOPort" binding="tmd:DeviceIOBinding">
            <soap:address location="http://www.onvif.org/ver10/deviceIO/wsdl"/>
        </wsdl:port>
    </wsdl:service>

If they don't have , create for them, then run generating command. If you need further information, inform me.

0
votes

If you go the link https://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl as you specified for wsdl2java you hit a HTML page you are not getting a WSDL file. See the screenshot below:

enter image description here

The HTML document is actually a valid WSDL i.e. full xml document but it uses a XSLT to transform the XML to HTML for display and this creates a bit of problem for wsdl@java.

If you view the web page source and you remove the XSLT link code:

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../../../ver20/util/onvif-wsdl-viewer.xsl"?>

Becomes:

<?xml version="1.0" encoding="utf-8"?>

Then you can load the WSDL into a WSDL editor and see the operations see screen shot below:

enter image description here

To get this working I would contact the Onvif group and ask them for the WSDL location as the WSDL contains links to XSD files which you will need as well. The current location cannot be used as is.