IOTechSystems / onvif

full and enhanced onvif protocol stack in golang.
MIT License
17 stars 12 forks source link

Incorrect response type for Renew #36

Closed zebox closed 7 months ago

zebox commented 7 months ago

RenewRespone defined in event does not match to scheme described in WS-Notification

<wsnt:RenewResponse>
   <wsnt:TerminationTime>xsd:dateTime</wsnt:TerminationTime>
   <wsnt:CurrentTime>xsd:dateTime</wsnt:CurrentTime>?
   {any} *
</wsnt:RenewResponse>

When I try unmarshal response of Renew method with defined type it always is empty, but response body contains raw data:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope
    xmlns:env="http://www.w3.org/2003/05/soap-envelope"
    xmlns:soapenc="http://www.w3.org/2003/05/soap-encoding"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:tt="http://www.onvif.org/ver10/schema"
    xmlns:tds="http://www.onvif.org/ver10/device/wsdl"
    xmlns:trt="http://www.onvif.org/ver10/media/wsdl"
    xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl"
    xmlns:tev="http://www.onvif.org/ver10/events/wsdl"
    xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl"
    xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl"
    xmlns:tst="http://www.onvif.org/ver10/storage/wsdl"
    xmlns:ter="http://www.onvif.org/ver10/error"
    xmlns:dn="http://www.onvif.org/ver10/network/wsdl"
    xmlns:tns1="http://www.onvif.org/ver10/topics"
    xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl"
    xmlns:wsoap12="http://schemas.xmlsoap.org/wsdl/soap12"
    xmlns:http="http://schemas.xmlsoap.org/wsdl/http"
    xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery"
    xmlns:wsadis="http://schemas.xmlsoap.org/ws/2004/08/addressing"
    xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"
    xmlns:wsa="http://www.w3.org/2005/08/addressing"
    xmlns:wstop="http://docs.oasis-open.org/wsn/t-1"
    xmlns:wsrf-bf="http://docs.oasis-open.org/wsrf/bf-2"
    xmlns:wsntw="http://docs.oasis-open.org/wsn/bw-2"
    xmlns:wsrf-rw="http://docs.oasis-open.org/wsrf/rw-2"
    xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
    xmlns:wsrf-r="http://docs.oasis-open.org/wsrf/r-2"
    xmlns:trc="http://www.onvif.org/ver10/recording/wsdl"
    xmlns:tse="http://www.onvif.org/ver10/search/wsdl"
    xmlns:trp="http://www.onvif.org/ver10/replay/wsdl"
    xmlns:tnshik="http://www.hikvision.com/2011/event/topics"
    xmlns:hikwsd="http://www.onvifext.com/onvif/ext/ver10/wsdl"
    xmlns:hikxsd="http://www.onvifext.com/onvif/ext/ver10/schema"
    xmlns:tas="http://www.onvif.org/ver10/advancedsecurity/wsdl"
    xmlns:tr2="http://www.onvif.org/ver20/media/wsdl"
    xmlns:axt="http://www.onvif.org/ver20/analytics">
    <env:Header>
        <wsa:Action>http://docs.oasis-open.org/wsn/bw-2/SubscriptionManager/RenewResponse</wsa:Action>
    </env:Header>
    <env:Body>
        <wsnt:RenewResponse>
            <wsnt:TerminationTime>2023-11-25T18:08:15Z</wsnt:TerminationTime>
            <wsnt:CurrentTime>2023-11-24T14:50:25Z</wsnt:CurrentTime>
        </wsnt:RenewResponse>
    </env:Body>
</env:Envelope>

Valid response type same as field CurrentTime and TerminationTime in SubscribeResponse

// valid RenewResponse type
type RenewResponse struct { //http://docs.oasis-open.org/wsn/b-2.xsd
    TerminationTime *xsd.String
    CurrentTime     *xsd.String
}

I tested it with real ONVIF IP Camera (Hikvsion). Also I can prepare PR for fix this, if need.

cloudxxx8 commented 7 months ago

Yes, please help contribute the fix if possible. Thanks.

weichou1229 commented 7 months ago

@zebox PR merged and the tag v1.1.2 was created.

cloudxxx8 commented 7 months ago

@zebox v1.1.2 tag was removed @weichou1229 we can't tag 1.1.2 directly since there is a breaking change in https://github.com/IOTechSystems/onvif/pull/33

cloudxxx8 commented 7 months ago

close this issuse as #38 merged