Search code examples
javaweb-servicessoapwsdlonvif

Generate Java webservice based on ONVIF wsdl (Top Down Method)


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?


Solution

  • 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.