soap中输出数据都有两个函数soap_out_TYPE,soap_put_TYPE
两个的区别是put只能输出一次,只能在一个函数中调用一次,out则可以调用多次,根据id的不同实现多个输出SOAP_FMAC3 int SOAP_FMAC4 soap_put_int(struct soap *soap, const int *a, const char *tag, const char *type) { register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_int); if (soap_out_int(soap, tag?tag:"int", id, a, type)) return soap->error; return soap_putindependent(soap); }
int num=12345; soap_put_int(soap, &num, "myint", NULL);
<?xml version="1.0" encoding="UTF-8"?> <myint>12345</myint>
soap_out_int(soap,"myint",1,&num,NULL); soap_out_int(soap,"myint",2,&num,NULL);
<?xml version="1.0" encoding="UTF-8"?> <myint id="_1" >12345</myint><myint id="_2" >12345</myint>
char *str="hehe"; soap_serialize_string(soap, &str); soap_put_string(soap, &str , "mystring", NULL);
<?xml version="1.0" encoding="UTF-8"?> <mystring>hehe</mystring>
soap_out_string(soap, "mystring",1,&str, NULL); soap_out_string(soap, "mystring",2,&str, NULL);
<?xml version="1.0" encoding="UTF-8"?> <mystring id="_1">hehe</mystring><mystring id="_2">hehe</mystring>
struct LogInfo loginfo={"哈哈",1}; soap_serialize_LogInfo(soap,&loginfo) soap_put_LogInfo(soap, &loginfo, "logs", NULL);
<?xml version="1.0" encoding="UTF-8"?> <logs> <content>hehe</content> <id>1</id> </logs>
soap_serialize_LogInfo(soap,&loginfo) soap_out_LogInfo(soap, "logs",1, &loginfo, NULL); soap_out_LogInfo(soap, "logs",2, &loginfo, NULL);
<?xml version="1.0" encoding="UTF-8"?> <logs id="_1"> <content>hehe</content> <id>1</id> </logs> <logs id="_2"> <content>hehe</content> <id>1</id> </logs>