工程结构如下:
main.c代码如下:
[cpp] view plain copy #include "wsdd.h" #include <stdio.h> static struct soap* ONVIF_Initsoap(struct SOAP_ENV__Header *header, const char *was_To, const char *was_Action, int timeout) { struct soap *soap = NULL; unsigned char macaddr[6]; char _HwId[1024]; unsigned int Flagrand; soap = soap_new(); if(soap == NULL) { printf("[%d]soap = NULL\n", __LINE__); return NULL; } soap_set_namespaces( soap, namespaces); if (timeout > 0) { soap->recv_timeout = timeout; soap->send_timeout = timeout; soap->connect_timeout = timeout; } else { //Maximum wait time: 20S soap->recv_timeout = 20; soap->send_timeout = 20; soap->connect_timeout = 20; } soap_default_SOAP_ENV__Header(soap, header); // Create SessionID randomly srand((int)time(0)); Flagrand = rand()