当前位置: 首页>>代码示例>>C++>>正文


C++ soap_new函数代码示例

本文整理汇总了C++中soap_new函数的典型用法代码示例。如果您正苦于以下问题:C++ soap_new函数的具体用法?C++ soap_new怎么用?C++ soap_new使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了soap_new函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main()
{
	struct _ns1__postMsgToQueue message;
	struct _ns1__postMsgToQueueResponse response;
	struct soap *soap; // gSOAP runtime environment

	message.in0 = "queue/testQueue";
	message.in1 = "teste message";

	soap = soap_new();
	if (!soap) {
		return 1;
	}

	soap_call___ns1__postMsgToQueue(soap, NULL, NULL, &message, &response);
	/*
	if (*soap.error) {
		soap_print_fault(soap, stderr);
		exit(1);
	}
	*/
	
	soap_destroy(soap);
	soap_end(soap);
	soap_done(soap);
}
开发者ID:magsilva,项目名称:slapi-plugin-publisher,代码行数:26,代码来源:post_message_queue.c

示例2: main

int main(int argc, char* argv[])
{
  ns2BikeList bl;
  struct soap *soap = soap_new();
  char search[MAX_POST_FIELD] = "";
  char type  [MAX_POST_FIELD] = "";
  uint32_t priceFrom = 0;
  uint32_t priceTo   = 0;
 
  parseArgs(argc, argv, search, MAX_POST_FIELD, type, MAX_POST_FIELD, 
            &priceFrom, &priceTo);

  if(soap_call_ns2__bikeGet(soap, NULL, NULL, search, type, priceFrom, 
                            priceTo, bl) == SOAP_OK)
  {
    logList(bl);
  }
  else
  {
    soap_print_fault(soap, stderr);
  }
  soap_end(soap);
  soap_free(soap);
  return 0;
}
开发者ID:sarroutbi,项目名称:buscobici,代码行数:25,代码来源:ws_client.cpp

示例3: ptz_ctrl_init

int ptz_ctrl_init()
{
    int i,j;
    int dev_input, option_input;
    /*创建soap通讯实体*/
    soap = soap_new();
    if(soap == NULL)
    {
        printf("soap new error\n");
        return -1;
    }

    soap_set_namespaces(soap, namespaces);
    soap->recv_timeout = 5;

    /*设备列表初始化*/
    dev_list = (ov_devices_list *)calloc(1, sizeof(ov_devices_list));
    for(i = 0; i < OV_DEV_MAX_SIZE; i++)
    {
        INIT_LIST_HEAD(&(dev_list->dev[i].presets_list));
        INIT_LIST_HEAD(&(dev_list->dev[i].tours_list));
        for(j = 0; j < OV_TOURS_NUM_EACH_DEV; j++)
        {
            INIT_LIST_HEAD(&(dev_list->dev[i].tours[j].presets_list));
        }
    }
    /*寻找网络上的IPC,获取设备入口decive_addr*/
    ov_discovery_device("/root/devinfo.ini", dev_list);
    ov_show_device_list(dev_list);

}
开发者ID:github188,项目名称:guangxi,代码行数:31,代码来源:hy_ptz_ctrl.c

示例4: EventingServiceImpl

void* NotificationConsumer::notifyFunc(void* ptr) {
    NotificationConsumer* consumer = static_cast<NotificationConsumer*>(ptr);
    int iRet;
    EventingServiceImpl* serv = new EventingServiceImpl(consumer, NULL, soap_new());

    if ( (iRet = soap_bind(serv->soap, NULL, 8080, 100) == SOAP_INVALID_SOCKET ) ) {
        SIGRLOG(SIGRCRITICAL, "NotificationConsumer::notifyFunc Binding on %d port failed", 8080);
        return NULL;
    }

    while(1) {
        bool bBreak = false;
        pthread_mutex_lock( &consumer->mutex_ );
        if(consumer->shutdownFlag_) bBreak = true;
        pthread_mutex_unlock( &consumer->mutex_ );
        if(bBreak)
            break;

        if( (iRet = soap_accept(serv->soap)) == SOAP_INVALID_SOCKET) {
            SIGRLOG(SIGRCRITICAL, "NotificationConsumer::notifyFunc accepting failed");
            return NULL;
        }

        if ( (soap_begin_serve(serv->soap)) != SOAP_OK) {
            SIGRLOG(SIGRWARNING, "NotificationConsumer::notifyFunc serve %d failed", iRet);
            continue;
        }

        if( serv )
            iRet = serv->dispatch();
        continue;
    }

    serv->destroy();
}
开发者ID:EricChen2013,项目名称:OpenONVIF,代码行数:35,代码来源:NotificationConsumer.cpp

示例5: getQuote

int getQuote (char *symbol, char *Result) {

	FlpCompDouble d;
	struct soap *soap;
	float result;
	int rc;
    char *addr = "http://services.xmethods.net/soap/";

	soap = soap_new();
	soap->namespaces = (struct Namespace *)namespaces;
	rc = soap_call_ns__getQuote(soap, addr, "", (char*)symbol, &result);
	soap_end(soap);
	free(soap);
  
	if (rc==SOAP_OK) {
		d.d= result;
		FlpFToA (d.fd,Result);
		StdEtoA(Result);
	} else {
		soap_set_fault(soap);
		strcpy (Result, soap->msgbuf);
	}
	
	return rc;

}
开发者ID:xin3liang,项目名称:platform_external_gsoap,代码行数:26,代码来源:stockquote.c

示例6: main1

int __cdecl main1() {

	struct soap *soap = soap_new();
	//struct_ns1__getFilesResponse response;
	struct _ns1__getFilesResponse response;
	struct _ns1__getFiles request;

		
	request.path= "/";
	
	if (soap_call___ns1__getFiles(soap,NULL,NULL,&request,&response) == SOAP_OK) {	
		printf("Current IBM Stock Quote = %d\n", response.__sizegetFilesReturn); 
		if (response.__sizegetFilesReturn > 0) {
			int i = 0;
			for (i=0; i<response.__sizegetFilesReturn; i++) {		
				if (response.getFilesReturn[i].attributes & 2)
					printf("D");
				else
					printf(" ");
				
				printf(" %s\n", response.getFilesReturn[i].name); 
			}
		}
		
	} else {
		char buffer[1024];
		soap_sprint_fault(soap,buffer,1024);
		printf("%s",buffer);
	}
		
	return 0;
}
开发者ID:ohierro,项目名称:gDrive,代码行数:32,代码来源:testSoap.c

示例7: main

int main(int argc, char **argv)
{ struct soap *soap;
  int m, s;
  soap = soap_new();
  if (argc < 3)
    soap_serve(soap); // run as CGI application over the Web
  else // run as stand-alone server on machine given by argv[1] listening to port argv[2]
  { m = soap_bind(soap, argv[1], atoi(argv[2]), 100);
    if (m < 0)
    { soap_print_fault(soap, stderr);
      exit(-1);
    }
    fprintf(stderr, "Socket connection successful: master socket = %d\n", m);
    for (int i = 1; ; i++)
    { s = soap_accept(soap);
      if (s < 0)
      { soap_print_fault(soap, stderr);
        exit(-1);
      }
      fprintf(stderr, "%d: accepted connection from IP = %d.%d.%d.%d socket = %d ... ", i, (int)(soap->ip>>24)&0xFF, (int)(soap->ip>>16)&0xFF, (int)(soap->ip>>8)&0xFF, (int)soap->ip&0xFF, s);
      soap_serve(soap);		// process request
      fprintf(stderr, "request served\n");
      soap_destroy(soap);	// delete class instances
      soap_end(soap);		// clean up everything and close socket
    }
  }
  return 0;
}
开发者ID:xin3liang,项目名称:platform_external_gsoap,代码行数:28,代码来源:luserver.cpp

示例8: complexGsoap4

inline void complexGsoap4()
{
	struct soap *soap = soap_new();
	soap_init(soap);
	soap_set_omode(soap, SOAP_XML_GRAPH);
	soap_imode(soap, SOAP_XML_GRAPH);
	soap_begin(soap);

	_ns1__complexGsoap4 input, output;
	input.soap = soap;
	input.att1 = 0;
	input.att2 = 1;
	input.att3 = 2;
	input.att4 = 3;
	input.att5 = 0;
	input.att6 = 1;
	input.att7 = 2;
	input.att8 = 3;
	input.att9 = "TEST 0";
	input.att10 = "TEST 1";
	input.att11 = "TEST 2";
	input.att12 = "TEST 3";
	input.att13 = 2.5;
	input.att14 = 3.6;
	input.att15 = 4.7;
	input.att16 = 5.8;
	input.att17 = 27.1;
	input.att18 = 28.2;
	input.att19 = 29.3;
	input.att20 = 30.4;
	input.att21 = true;
	input.att22 = true;
	input.att23 = true;
	input.att24 = true;

	boost::asio::streambuf streambuf;
	std::ostream *ost = new std::ostream(&streambuf);
	std::istream *ist = new std::istream(&streambuf);
	input.soap->os = ost;
	input.soap->is = ist;

	boost::timer::auto_cpu_timer t;

	for(int i=0; i < NUMBER_OF_LOOPS; ++i){
		soap_write__ns1__complexGsoap4(soap, &input);
		
		//streambuf.pubseekpos(0);
		//ost->rdbuf(&streambuf);
		//std::cout << "Str: " << streambuf.size() << endl;
		//break;
		
		soap_read__ns1__complexGsoap4(soap, &output);
	}

	soap_destroy(soap);
	soap_end(soap);
	soap_done(soap);
}
开发者ID:eProsima,项目名称:Dynamic-Fast-Buffers,代码行数:58,代码来源:main.cpp

示例9: ONVIF_Initsoap

//初始化soap函数
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);
	//超过5秒钟没有数据就退出
	if (timeout > 0)
	{
		soap->recv_timeout = timeout;
		soap->send_timeout = timeout;
		soap->connect_timeout = timeout;
	}
	else
	{
		//如果外部接口没有设备默认超时时间的话,我这里给了一个默认值10s
		soap->recv_timeout    = 10;
		soap->send_timeout    = 10;
		soap->connect_timeout = 10;
	}
	soap_default_SOAP_ENV__Header(soap, header);

	// 为了保证每次搜索的时候MessageID都是不相同的!因为简单,直接取了随机值
	srand((int)time(0));
	Flagrand = rand()%9000 + 1000; //保证四位整数
	macaddr[0] = 0x1; macaddr[1] = 0x2; macaddr[2] = 0x3; macaddr[3] = 0x4; macaddr[4] = 0x5; macaddr[5] = 0x6;
	sprintf(_HwId,"urn:uuid:%ud68a-1dd2-11b2-a105-%02X%02X%02X%02X%02X%02X", 
			Flagrand, macaddr[0], macaddr[1], macaddr[2], macaddr[3], macaddr[4], macaddr[5]);
	header->wsa__MessageID =(char *)malloc( 100);
	memset(header->wsa__MessageID, 0, 100);
	strncpy(header->wsa__MessageID, _HwId, strlen(_HwId));

	if (was_Action != NULL)
	{
		header->wsa__Action =(char *)malloc(1024);
		memset(header->wsa__Action, '\0', 1024);
		strncpy(header->wsa__Action, was_Action, 1024);//"http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe";
	}
	if (was_To != NULL)
	{
		header->wsa__To =(char *)malloc(1024);
		memset(header->wsa__To, '\0', 1024);
		strncpy(header->wsa__To,  was_To, 1024);//"urn:schemas-xmlsoap-org:ws:2005:04:discovery";	
	}
	soap->header = header;
	return soap;
}
开发者ID:jiangbing9293,项目名称:ONVIF,代码行数:56,代码来源:main.c

示例10: simpleGsoap20

inline void simpleGsoap20()
{
	struct soap *soap = soap_new();
	soap_init(soap);
	soap_set_omode(soap, SOAP_XML_GRAPH);
	soap_imode(soap, SOAP_XML_GRAPH);
	soap_begin(soap);

	_ns1__simpleGsoap20 input, output;
	input.soap = soap;
	input.att1 = 1;
	input.att2 = 2;
	input.att3 = 3;
	input.att4 = 4;
	input.att5 = 5;
	input.att6 = 6;
	input.att7 = 7;
	input.att8 = 8;
	input.att9 = 9;
	input.att10 = 10;
	input.att11 = 11;
	input.att12 = 12;
	input.att13 = 13;
	input.att14 = 14;
	input.att15 = 15;
	input.att16 = 16;
	input.att17 = 17;
	input.att18 = 18;
	input.att19 = 19;
	input.att20 = 20;

	boost::asio::streambuf streambuf;
	std::ostream *ost = new std::ostream(&streambuf);
	std::istream *ist = new std::istream(&streambuf);
	input.soap->os = ost;
	input.soap->is = ist;

	boost::timer::auto_cpu_timer t;

	for(int i=0; i < NUMBER_OF_LOOPS; ++i){
		soap_write__ns1__simpleGsoap20(soap, &input);

		//streambuf.pubseekpos(0);
		//ost->rdbuf(&streambuf);
		//std::cout << "Str: " << streambuf.size() << endl;
		//break;

		soap_read__ns1__simpleGsoap20(soap, &output);
	}

	soap_destroy(soap);
	soap_end(soap);
	soap_done(soap);
}
开发者ID:eProsima,项目名称:Dynamic-Fast-Buffers,代码行数:54,代码来源:main.cpp

示例11: main

int main(int argc, char **argv)
{ struct soap *soap = soap_new();
  const char *endpoint;
  matrix a(soap, 3); // matrix with 3 rows created in current soap env.
  // set up matrix by specifying non-zero elements only (this is optional)
  a[1].resize(1,2); // 2-element vector indexed from 1 to 2
  a[1][1] = 2;
  a[1][2] = 1;
  a[2].resize(1,3); // 3-element vector
  a[2][1] = 1;
  a[2][2] = 2;
  a[2][3] = 1;
  a[3].resize(2,3); // 2-element vector indexed from 2 to 3
  a[3][2] = 1;
  a[3][3] = 2;
  cout << "* Demonstration example *" << endl;
  cout << "Matrix:" << endl;
  a.print();
  vector b(soap, 3);
  b[1] = 1;
  b[2] = 2;
  b[3] = 3;
  cout << "Vector:" << endl;
  b.print();
  vector x(soap);
  if (argc < 2)
    endpoint = luserver;
  else
    endpoint = argv[1];
  /* solve ax=b */
  if (soap_call_ns1__lusol(soap, endpoint, "", &a, &b, &x))
  { soap_print_fault(soap, stderr);
    soap_print_fault_location(soap, stderr);
  }
  else
  { cout << "Solution vector from service:" << endl;
    x.print();
  }
  matrix a1(soap);
  if (soap_call_ns1__luinv(soap, endpoint, "", &a, &a1))
  { soap_print_fault(soap, stderr);
    soap_print_fault_location(soap, stderr);
  }
  else
  { cout << "Inverse matrix matrix from service:" << endl;
    a1.print();
  }
  soap_destroy(soap);
  soap_end(soap);
  free(soap);
  return 0;
}
开发者ID:carriercomm,项目名称:PrologMUD,代码行数:52,代码来源:luclient.cpp

示例12: soap_new

Root::Root(const char *factory, enum t__object object, char *name)
{ soap = soap_new();
  endpoint = soap_strdup(soap, factory);
  status = FACTORY_NOTFOUND;
  if (name)
    if (soap_call_ns__lookup(soap, endpoint, "", object, name, status))
      soap_print_fault(soap, stderr);	// for demo, just print
  if (status == FACTORY_NOTFOUND)
    do
    { if (soap_call_ns__create(soap, endpoint, "", object, name, status))
        soap_print_fault(soap, stderr);	// for demo, just print
    } while (status == FACTORY_RETRY);
}
开发者ID:allenway,项目名称:onvif,代码行数:13,代码来源:factorytest.cpp

示例13: innercomplexGsoap1

inline void innercomplexGsoap1()
{
	struct soap *soap = soap_new();
	soap_init(soap);
	soap_set_omode(soap, SOAP_XML_GRAPH);
	soap_imode(soap, SOAP_XML_GRAPH);
	soap_begin(soap);

	_ns1__outercomplexGsoap1 input, output;
	input.soap = soap;

	ns1__innercomplexGsoap1 inner1;
	inner1.soap = soap;
	inner1.att1 = 0;
	inner1.att2 = 0;
	inner1.att3 = "TEST 0";
	inner1.att4 = 1.5;
	inner1.att5 = 10.0;
	inner1.att6 = true;

	input.att1 = 1;
	input.att2 = 1;
	input.att3 = "TEST 1";
	input.att4 = &inner1;
	input.att5 = 10.6;
	input.att6 = 2.18;
	input.att7 = false;

	boost::asio::streambuf streambuf;
	std::ostream *ost = new std::ostream(&streambuf);
	std::istream *ist = new std::istream(&streambuf);
	input.soap->os = ost;
	input.soap->is = ist;

	boost::timer::auto_cpu_timer t;

	for(int i=0; i < NUMBER_OF_LOOPS; ++i){
		soap_write__ns1__outercomplexGsoap1(soap, &input);

		//streambuf.pubseekpos(0);
		//ost->rdbuf(&streambuf);
		//std::cout << "Str: " << streambuf.size() << endl;
		//break;

		soap_read__ns1__outercomplexGsoap1(soap, &output);
	}

	soap_destroy(soap);
	soap_end(soap);
	soap_done(soap);
}
开发者ID:eProsima,项目名称:Dynamic-Fast-Buffers,代码行数:51,代码来源:main.cpp

示例14: main

int main(int argc, char **argv)
{ struct soap *soap = soap_new();
  float q;
  if (argc <= 2)
  { soap->user = soap_new(); // pass a new gSOAP environment which we need to make server-side client calls
    soap_serve(soap);	// serve request
    soap_destroy((struct soap*)soap->user);
    soap_end((struct soap*)soap->user);
    soap_done((struct soap*)soap->user);
    free(soap->user);
    soap->user = NULL;
  }
  else if (soap_call_ns3__getQuote(soap, endpoint, NULL, argv[1], argv[2], q) == 0)
    printf("\nCompany %s: %f (%s)\n", argv[1], q, argv[2]);
  else
  { soap_print_fault(soap, stderr);
    soap_print_fault_location(soap, stderr);
  }
  soap_destroy(soap);
  soap_end(soap);
  soap_done(soap);
  free(soap);
  return 0;
}
开发者ID:xin3liang,项目名称:platform_external_gsoap,代码行数:24,代码来源:quotex.cpp

示例15: innersimpleGsoap2

inline void innersimpleGsoap2()
{
	struct soap *soap = soap_new();
	soap_init(soap);
	soap_set_omode(soap, SOAP_XML_GRAPH);
	soap_imode(soap, SOAP_XML_GRAPH);
	soap_begin(soap);

	_ns1__outersimpleGsoap2 input, output;
	input.soap = soap;

	ns1__innersimpleGsoap2 inner1;
	inner1.soap = soap;
	inner1.att1 = 1;
	inner1.att2 = 2;

	ns1__innersimpleGsoap2 inner2;
	inner2.soap = soap;
	inner2.att1 = 1;
	inner2.att2 = 2;

	input.att1 = &inner1;
	input.att2 = &inner2;

	boost::asio::streambuf streambuf;
	std::ostream *ost = new std::ostream(&streambuf);
	std::istream *ist = new std::istream(&streambuf);
	input.soap->os = ost;
	input.soap->is = ist;

	boost::timer::auto_cpu_timer t;

	for(int i=0; i < NUMBER_OF_LOOPS; ++i){
		soap_write__ns1__outersimpleGsoap2(soap, &input);

		//streambuf.pubseekpos(0);
		//ost->rdbuf(&streambuf);
		//std::cout << "Str: " << streambuf.size() << endl;
		//break;

		soap_read__ns1__outersimpleGsoap2(soap, &output);
	}

	soap_destroy(soap);
	soap_end(soap);
	soap_done(soap);
}
开发者ID:eProsima,项目名称:Dynamic-Fast-Buffers,代码行数:47,代码来源:main.cpp


注:本文中的soap_new函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。