onvif告警實現
星星之城 2013-07-22 10:39:34 小弟在实现onvif Event时出现了问题,不知道出在哪里了
用的是WS-BaseNotification
在填充Subscribe接口函数时有问题,我的代码是
SOAP_FMAC5 int SOAP_FMAC6 __denf__Subscribe(struct soap*psoap, _wsnt__Subscribe *wsnt__Subscribe, _wsnt__SubscribeResponse *wsnt__SubscribeResponse)
{
wsnt__SubscribeResponse->soap->header->wsa5__ReplyTo->Address = wsnt__Subscribe->soap->header->wsa5__ReplyTo->Address;
wsnt__SubscribeResponse->soap->header->wsa5__MessageID = wsnt__Subscribe->soap->header->wsa5__MessageID;
char *wsato = (char *)soap_malloc(psoap,sizeof(char) *128);
char LocalIP[32] = {0};
char NetMask[32] = {0};
g_NetApp.GetHostIP(LocalIP, sizeof(LocalIP), NetMask, sizeof(NetMask));
sprintf(wsato,"http://%s:8080/onvif/event_service",LocalIP);
wsnt__SubscribeResponse->soap->header->wsa5__To = wsato;
wsnt__SubscribeResponse->soap->header->wsa5__Action = "http://docs.oasis-open.org/wsn/bw-2/NotificationProducer/SubscribeResponse";
char *address = (char *)soap_malloc(psoap,sizeof(char) * 128);
sprintf(address,"http://%s:8080/onvif/Subscription?Idx=833",LocalIP);
wsnt__SubscribeResponse->SubscriptionReference.Address = address;
wsnt__SubscribeResponse->CurrentTime = (time_t *)soap_malloc(psoap, sizeof(time_t));
wsnt__SubscribeResponse->TerminationTime = (time_t *)soap_malloc(psoap, sizeof(time_t));
*wsnt__SubscribeResponse->CurrentTime = time(NULL);
int _time = 0;
_time = atoi(wsnt__Subscribe->InitialTerminationTime->c_str() + 2);
*wsnt__SubscribeResponse->TerminationTime = *wsnt__SubscribeResponse->CurrentTime + _time;
return SOAP_NO_METHOD;
}
客户端的错误显示为
<SOAP-ENV:Fault>
<SOAP-ENV:Code>
<SOAP-ENV:Value>SOAP-ENV:Sender</SOAP-ENV:Value>
</SOAP-ENV:Code>
<SOAP-ENV:Reason>
<SOAP-ENV:Text xml:lang="en">Method 's:Envelope' not implemented: method name or namespace not recognized</SOAP-ENV:Text>
</SOAP-ENV:Reason>
</SOAP-ENV:Fault>
请问Subscribe接口函数应该怎样填充呢?