eyetowers / gonvif

Onvif Go client library and CLI tool.
MIT License
9 stars 3 forks source link

Error: Unkown Pullpoint (onvif error code:SOAP-ENV:Sender->ter:ResourceUnknownFault) #1

Closed wjcroom closed 1 year ago

wjcroom commented 1 year ago

this cmd events stream-events。 return this error。 Error: Unkown Pullpoint (onvif error code:SOAP-ENV:Sender->ter:ResourceUnknownFault) run gonvif events create-pull-point-subscription . can return the pullpoint refer url. -point-subscription { "SubscriptionReference": { "Address": "http://192.168.2.5:80/onvif/events/sub_pull_session_2" }, "CurrentTime": {}, "TerminationTime": {} }

use this url to run gonvif subcription pull-messages -s referusrl
return the same error .

-point-subscription { "SubscriptionReference": { "Address": "http://192.168.2.5:80/onvif/events/sub_pull_session_2" }, "CurrentTime": {}, "TerminationTime": {} use onvif device manager https://github.com/aleksandrm8/ONVIF-Device-Manager can get event only setting only pullpoint not setting base suscription.

so what is wrong in the gonvif events ?

I am reading the source code and try to fix this bug.

wjcroom commented 1 year ago

-capabilities { "Capabilities": { "WSSubscriptionPolicySupport": true, "WSPullPointSupport": true, "MaxNotificationProducers": 32, "MaxPullPoints": 8 } } properties { "TopicNamespaceLocation": [ "http://www.onvif.org/onvif/ver10/topics/topicns.xml" ], "FixedTopicSet": true, "TopicSet": {}, "TopicExpressionDialect": [ "http://docs.oasis-open.org/wsn/t-1/TopicExpression/Concrete", "http://www.onvif.org/ver10/tev/topicExpression/ConcreteSet" ], "MessageContentFilterDialect": [ "http://www.onvif.org/ver10/tev/messageContentFilter/ItemFilter" ], "MessageContentSchemaLocation": [ "http://www.onvif.org/onvif/ver10/schema/onvif.xsd" ] }

https://github.com/aleksandrm8/ONVIF-Device-Manager can get event

wjcroom commented 1 year ago

/* This method returns a PullPointSubscription that can be polled using PullMessages. This message contains the same elements as the SubscriptionRequest of the WS-BaseNotification without the ConsumerReference. the createsucription: use WS-BaseNotification. my cam only use PullPoint . not use BaseNotification .maybe

osery commented 1 year ago

Hi, can you try running with -v and pasting the whole output including the raw xml messages? Thank you.

osery commented 1 year ago

@wjcroom I pushed a few fixes regarding event streaming. Can you try again with v0.0.25?

wjcroom commented 1 year ago

I try the 0.026, it's work fine, use./gonvif events stream-events but a new error show Error: parsing time "2023-06-01T02:34:23" as "2006-01-02T15:04:05Z07:00": cannot parse "" as "Z07:00"

guess some date farmate have a 'Z' beturn date and time.

wjcroom commented 1 year ago

2023/06/01 02:34:24 --> POST http://192.168.2.8:7005/onvif/events/sub_pull_session_1 2023/06/01 02:34:24 BODY:

http://www.w3.org/2005/08/addressing/anonymous
http://192.168.2.5:80/onvif/events/sub_pull_session_1adminAc17TEs6rDljXkUhAcJVaaVDjgE=arbvrsw5lg6m119coq4oas7c23vp1t3m2023-06-01T02:34:24Z
PT60S100

2023/06/01 02:34:25 <-- 200 http://192.168.2.8:7005/onvif/events/sub_pull_session_1 2023/06/01 02:34:25 BODY: <?xml version="1.0" encoding="UTF-8"?>

http://www.w3.org/2005/08/addressing/anonymoushttp://192.168.2.5:80/onvif/events/sub_pull_session_1http://www.onvif.org/ver10/events/wsdl/PullPointSubscription/PullMessagesResponse2023-06-01T02:34:24Z2023-06-01T02:36:24Ztns1:VideoSource/MotionAlarm tns1:RuleEngine/CellMotionDetector/Motion tns1:VideoSource tns1:VideoAnalytics/tnshik:MotionAlarm tns1:UserAlarm/VideoCover tns1:RuleEngine/TamperDetector/Tamper tns1:Device/Trigger/DigitalInput tns1:Device/Trigger/AlarmIn tns1:Device/Trigger/DigitalInput tns1:Device/Trigger/AlarmIn 2023/06/01 02:34:25 --> POST http://192.168.2.8:7005/onvif/events/sub_pull_session_1 2023/06/01 02:34:25 BODY:
http://www.w3.org/2005/08/addressing/anonymous
http://192.168.2.5:80/onvif/events/sub_pull_session_1adminzy3L8wxgXyuTqUlIMTE3OdzYYoE=y9zwxwvnoqx3aa579ksil89nuwyypiry2023-06-01T02:34:25Z
2023/06/01 02:34:26 <-- 400 http://192.168.2.8:7005/onvif/events/sub_pull_session_1 2023/06/01 02:34:26 BODY: SOAP-ENV:SenderMethod 'Content' not implemented: method name or namespace not recognized Error: parsing time "2023-06-01T02:34:23" as "2006-01-02T15:04:05Z07:00": cannot parse "" as "Z07:00" this is part of return with -v
wjcroom commented 1 year ago

好吧,在打包,拆包过程中,由于时间格式不对,出现了错误,导致了订阅失败。

wjcroom commented 1 year ago

2023/06/01 02:34:24 --> POST http://192.168.2.8:7005/on

the port 7005,is the wan port - cam in the lan cam port is 80.

i use the wanport wanip:7005 to lan,cam. laniP:80 so on 0.0.24 govif, ,the reply . subcrition src must replaced with wanip:7005. maybe you have fix that .

.

wjcroom commented 1 year ago

POST http://192.168.2.8:7005/onvif/events/sub_pull_session_1 first post status is 200 。 but reply cotment [,“](tt:Message UtcTime="2023-06-01T02:34:23")” is not parsing,have a error

the second post status 400 so events stream-events still not work。

wjcroom commented 1 year ago

我看了一下代码,第一次对话,验证通过,第二次失败,可能的原因是使用的digest auth。密码是随机的吧。在时间格式解析出错外,可能还有验证登陆待修正。 我正在查找解析时间的出错位置,有可能会找到

wjcroom commented 1 year ago

post return 400 and error code message isMethod 'Content' not implemented: method name or namespace not recognized</SOAP-ENV:Text> 看来不是验证出的问题,是在pullmessage成功以后,又发送的一个Contend soap 这是要取得一个什么内容呢?虽然请求了,但是摄像头没有实现这个方法。 时间解析,应该是在return service.PullMessagesContext( context.Background(), request, 这里出的错,在xml处理过程中。

wjcroom commented 1 year ago

// CallContext performs HTTP POST request with a context func (s *Client) CallContext(ctx context.Context, soapAction string, request, response interface{}) error { return s.call(ctx, soapAction, request, response, nil, nil) }

// Call performs HTTP POST request. // Note that if the server returns a status code >= 400, a HTTPError will be returned

in gowsdl/soap/client.go

an other with -v

after create_subscription------------------------------------------- add get a rspt.subscrption url. http://192.168.2.5:80/onvif/events/sub_pull_session_1 the events stream-events funtion request s:

2023/06/01 07:27:22 --> POST http://192.168.2.8:7005/onvif/events/sub_pull_session_1 2023/06/01 07:27:22 BODY:

http://www.w3.org/2005/08/addressing/anonymous
http://192.168.2.5:80/onvif/events/sub_pull_session_1adminDa1Bqq1QfVTTmBY09bZUOmy3J2U=khnograluhi807fliwu6vbv24sctxmmo2023-06-01T07:27:22Z
PT60S100

2023/06/01 07:27:23 <-- 200 http://192.168.2.8:7005/onvif/events/sub_pull_session_1 2023/06/01 07:27:23 BODY: <?xml version="1.0" encoding="UTF-8"?>

http://www.w3.org/2005/08/addressing/anonymoushttp://192.168.2.5:80/onvif/events/sub_pull_session_1http://www.onvif.org/ver10/events/wsdl/PullPointSubscription/PullMessagesResponse2023-06-01T07:27:22Z2023-06-01T07:29:22Ztns1:VideoSource/MotionAlarm tns1:RuleEngine/CellMotionDetector/Motion tns1:VideoSource tns1:VideoAnalytics/tnshik:MotionAlarm tns1:UserAlarm/VideoCover tns1:RuleEngine/TamperDetector/Tamper tns1:Device/Trigger/DigitalInput tns1:Device/Trigger/AlarmIn tns1:Device/Trigger/DigitalInput tns1:Device/Trigger/AlarmIn 2023/06/01 07:27:23 --> POST http://192.168.2.8:7005/onvif/events/sub_pull_session_1 2023/06/01 07:27:23 BODY:
http://www.w3.org/2005/08/addressing/anonymous
http://192.168.2.5:80/onvif/events/sub_pull_session_1admind+fA/TNDwJrPf6cnrl6PoGdohXw=lf3jhmaw9lkttg87wmqjpmxuv0cftmlm2023-06-01T07:27:23Z
2023/06/01 07:27:23 <-- 400 http://192.168.2.8:7005/onvif/events/sub_pull_session_1 2023/06/01 07:27:23 BODY: SOAP-ENV:SenderMethod 'Content' not implemented: method name or namespace not recognized Error: parsing time "2023-06-01T07:27:22" as "2006-01-02T15:04:05Z07:00": cannot parse "" as "Z07:00"
osery commented 1 year ago

Hi @wjcroom, I think v0.0.27 should fix the date-time parsing issue. As to the port, I think that should already be done automatically. Am I missing something?

wjcroom commented 1 year ago

i will try it

At 2023-06-02 19:56:05, "Ondrej Sery" @.***> wrote:

Hi @wjcroom, I think v0.0.27 should fix the date-time parsing issue. As to the port, I think that should already be done automatically. Am I missing something?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

wjcroom commented 1 year ago

Yes I get the events real  time。 json , one by one 。 events stream-events cmd。

wjcroom commented 1 year ago

subscription pullmessages   still not work . while it will read event once by once ?

wjcroom commented 1 year ago

hava fixed

wjcroom commented 1 year ago

may i add args. to set event type. such as motion. alarm ....? behind the stream-events

osery commented 1 year ago

may i add args. to set event type. such as motion. alarm ....? behind the stream-events

Sure, PRs welcome. :v: