std::ostream &operator<<(std::ostream &o, const struct soap_dom_element &e) { if (!e.soap) { struct soap soap; soap_init2(&soap, SOAP_IO_DEFAULT, SOAP_XML_GRAPH); soap_serialize_xsd__anyType(&soap, &e); soap_begin_send(&soap); soap.ns = 2; /* do not dump namespace table */ soap_out_xsd__anyType(&soap, NULL, 0, &e, NULL); soap_end_send(&soap); soap_end(&soap); soap_done(&soap); } else { std::ostream *os = e.soap->os; e.soap->os = &o; soap_mode omode = e.soap->omode; soap_set_omode(e.soap, SOAP_XML_GRAPH); soap_serialize_xsd__anyType(e.soap, &e); soap_begin_send(e.soap); e.soap->ns = 2; /* do not dump namespace table */ soap_out_xsd__anyType(e.soap, NULL, 0, &e, NULL); soap_end_send(e.soap); e.soap->os = os; e.soap->omode = omode; } return o; }
std::ostream &operator<<(std::ostream &o, const struct soap_dom_element &e) { if (!e.soap) { struct soap soap; soap_init2(&soap, SOAP_IO_DEFAULT, SOAP_XML_GRAPH); soap_mark_xsd__anyType(&soap, &e); soap_begin_send(&soap); soap_put_xsd__anyType(&soap, &e, NULL, NULL); soap_end_send(&soap); soap_end(&soap); soap_done(&soap); } else { std::ostream *os = e.soap->os; e.soap->os = &o; short omode = e.soap->omode; soap_set_omode(e.soap, SOAP_XML_GRAPH); soap_mark_xsd__anyType(e.soap, &e); soap_begin_send(e.soap); soap_put_xsd__anyType(e.soap, &e, NULL, NULL); soap_end_send(e.soap); e.soap->os = os; e.soap->omode = omode; } return o; }
int save_options(const char *file, const char *name, struct option *options) { struct soap soap; soap_init1(&soap, SOAP_XML_TREE); soap.namespaces = NULL; soap.encodingStyle = NULL; if (file) { soap.sendfd = open(file, O_CREAT | O_WRONLY); if (soap.sendfd < 0) { soap_done(&soap); return EOF; } } if (!soap_begin_send(&soap) && !soap_element_begin_out(&soap, name, 0, NULL)) { struct option *p; struct t__Option t; for (p = options; p->name; p++) { t.val = NULL; if (!p->name[0]) { if (!p->value) continue; t.key = NULL; t.val = p->value; } else if (p->name[1] == '.') t.key = (char*)p->name + 2; else t.key = (char*)p->name; if (p->selections && strchr(p->selections, ' ')) { const char *s = p->selections - 1; char *r; int i; for (i = p->selected; i > 0; i--) { s = strchr(s + 1, ' '); if (!s) break; } if (s) { t.val = soap_strdup(&soap, s + 1); r = strchr(t.val, ' '); if (r) *r = '\0'; } } else if (p->value) t.val = p->value; else if (!p->selected) continue; if (soap_out_t__Option(&soap, "option", 0, &t, NULL)) break; } if (!soap_element_end_out(&soap, name)) soap_end_send(&soap); } if (file) close(soap.sendfd); soap_end(&soap); soap_done(&soap); return soap.error; }
/* * dump the data returned from JP IS */ static int queryresult_dump(struct soap *soap, int fd, const struct _jpelem__QueryJobsResponse *qjr) { int retval; soap->sendfd = fd; soap_begin_send(soap); soap_serialize__jpelem__QueryJobsResponse(soap, qjr); retval = soap_put__jpelem__QueryJobsResponse(soap, qjr, "QueryJobsResponse", NULL); soap_end_send(soap); write(fd, "\n", strlen("\n")); return retval; }
/* * dump the XML query */ static int query_dump(struct soap *soap, int fd, struct _jpelem__QueryJobs *qj) { int retval; soap->sendfd = fd; soap_begin_send(soap); soap_serialize__jpelem__QueryJobs(soap, qj); retval = soap_put__jpelem__QueryJobs(soap, qj, "jpelem:QueryJobs", NULL); soap_end_send(soap); write(fd, "\n", strlen("\n")); return retval; }
std::ostream &operator<<(std::ostream &o, const MultiXTpm__ConfigData &p) { if (!p.soap) return o; // need a gSOAP environment to serialize std::ostream *os = p.soap->os; p.soap->os = &o; soap_omode(p.soap, SOAP_XML_GRAPH); // XML tree or graph p.soap_serialize(p.soap); soap_begin_send(p.soap); p.soap_put(p.soap, "ConfigData", NULL); soap_end_send(p.soap); p.soap->os = os; soap_clr_omode(p.soap, SOAP_XML_GRAPH); return o; }
messages_t* getMessages(struct soap* soap, char* date) { struct _ns1__messageResponseTypeDef* msgs = getMessage(soap, new_reqList(soap, "getMessageAll", "sent", "greaterthan", date)); if (msgs) { int old_fd = soap->sendfd; messages_t* msg_t = NULL; msg_t = (messages_t*) malloc(sizeof(messages_t)); if (!msg_t) { perror("Error converting alerts to text. Out of memory [0]"); return NULL; } msg_t->size = msgs->__sizealert; msg_t->alerts = (char**) malloc(sizeof(char*)*(msg_t->size)); if (!msg_t->alerts) { perror("Error converting alerts to text. Out of memory [1]"); free(msg_t); return NULL; } msg_t->ids = (char**) malloc(sizeof(char*)*(msg_t->size)); if (!msg_t->ids) { perror("Error converting alerts to text. Out of memory [2]"); free(msg_t->alerts); free(msg_t); return NULL; } msg_t->expires = (time_t**) malloc(sizeof(time_t*)*(msg_t->size)); if (!msg_t->ids) { perror("Error converting alerts to text. Out of memory [3]"); free(msg_t->ids); free(msg_t->alerts); free(msg_t); return NULL; } for (unsigned int i = 0; i < msg_t->size; i++) { msg_t->alerts[i] = NULL; msg_t->ids[i] = NULL; msg_t->expires[i] = NULL; } for (int i = 0; i < msgs->__sizealert; i++) { FILE* tmpf = tmpfile(); struct stat stbuf; soap->sendfd = fileno(tmpf); soap_set_omode(soap, SOAP_ENC_XML); soap_begin_send(soap); soap_serialize__ns4__alert(soap, &(msgs->ns4__alert[i])); soap_put__ns4__alert(soap, &(msgs->ns4__alert[i]), NULL, NULL); soap_end_send(soap); soap_clr_omode(soap, SOAP_ENC_XML); soap->sendfd = old_fd; if ( fstat(fileno(tmpf), &stbuf) == -1 ) { perror("Encountered error converting alert to text"); goto error_inconsistent_msg_t; } msg_t->alerts[i] = (char*) malloc(stbuf.st_size+1); if (msg_t->alerts[i]) { rewind(tmpf); if (fread(msg_t->alerts[i], stbuf.st_size, 1, tmpf) < 1) { perror("Incomplete conversion of alert to text. Discarding"); free(msg_t->alerts[i]); goto error_inconsistent_msg_t; } msg_t->alerts[i][stbuf.st_size] = '\0'; fclose(tmpf); msg_t->ids[i] = strdup(msgs->ns4__alert[i].identifier); if (!msg_t->ids[i]) { perror("Incomplete conversion of alert to text, discarding"); free(msg_t->alerts[i]); goto error_inconsistent_msg_t; } // Get the latest expiration date for(int j = 0; j < msgs->ns4__alert[i].__sizeinfo; j++) { if (msg_t->expires[i] == NULL) { // Don't alloc more than once msg_t->expires[i] = malloc(sizeof(time_t)); if (msg_t->expires[i]) { if (msgs->ns4__alert[i].info) { if (msgs->ns4__alert[i].info[j].expires) { *(msg_t->expires[i]) = *(msgs->ns4__alert[i].info[j].expires); } else { error(0, 0, "Allocated info doesn't have expires field"); free(msg_t->expires[i]); msg_t->expires[i] = NULL; } } else { error(0, 0, "Despite the sizeinfo %d, no allocation at info %d", msgs->ns4__alert[i].__sizeinfo, j); } } else { perror("Incomplete conversion of alert to text, discarding"); free(msg_t->alerts[i]); free(msg_t->ids[i]); goto error_inconsistent_msg_t; } } else { if (difftime(*msg_t->expires[i],*(msgs->ns4__alert[i].info[j].expires)) < 0.) { *(msg_t->expires[i]) = *(msgs->ns4__alert[i].info[j].expires); } } } // If there was no info block, make it expire in a week. if (msg_t->expires[i] == NULL) { msg_t->expires[i] = malloc(sizeof(time_t)); if (msg_t->expires[i]) *(msg_t->expires[i]) = msgs->ns4__alert[i].sent + 60*60*24*7; else { perror("Incomplete conversion of alert to text, discarding"); free(msg_t->alerts[i]); free(msg_t->ids[i]); goto error_inconsistent_msg_t; } } } else { perror("Ran out of memory converting alert to text"); goto error_inconsistent_msg_t; } continue; error_inconsistent_msg_t: fclose(tmpf); if ( i > 0 ) { msg_t->size = i; return msg_t; } else { perror("Unable to convert alerts to text [2]"); free(msg_t->expires); free(msg_t->ids); free(msg_t->alerts); free(msg_t); return NULL; } } return msg_t; } else { perror("Error retreiving alerts"); return NULL; } }
char *soap_parser_encode(void *handle) { SoapParser *parser = (SoapParser *)handle; struct soap *soap; int fd[2]; char *xml = NULL; struct SOAP_ENV__Header *header = NULL; struct SOAP_ENV__Fault *fault = NULL; int tags_num = 0; char *src_tags[32]; char *dst_tags[32]; if (parser == NULL) { return NULL; } soap = parser->soap; header = _soap_header_create(parser->id, parser->hold_requests, parser->session_timeout, parser->supported_cwmp_versions, parser->use_cwmp_version); if (header == NULL) { LOGE(LOG_TAG, "create soap header failed"); return NULL; } pipe(fd); soap_init(soap); soap->socket = -1; soap->sendfd = fd[1]; if (parser->namespaces != NULL) { soap_set_namespaces(soap, parser->namespaces); if (parser->use_cwmp_version != 0) { _soap_namespaces_tags(parser->namespaces, parser->use_cwmp_version, &tags_num, src_tags, dst_tags); } else { _soap_namespaces_tags(parser->namespaces, parser->version, &tags_num, src_tags, dst_tags); } } else { soap_set_namespaces(soap, namespaces); } soap_set_version(soap, 1); soap->header = header; if (soap_begin_send(soap) != 0 || soap_envelope_begin_out(soap) != 0 || soap_putheader(soap) != 0 || soap_body_begin_out(soap) != 0) { LOGE(LOG_TAG, "begin encode failed, error=%d", soap->error); _soap_header_destroy(header); return NULL; } switch (parser->type) { case CWMP_MSG_FAULT: { fault = _soap_fault_create(parser->fault_code, parser->fault_string, parser->fault_body); if (fault == NULL) { LOGE(LOG_TAG, "create soap fault failed"); _soap_header_destroy(header); return NULL; } soap_put_SOAP_ENV__Fault(soap, fault, NULL, NULL); break; } case CWMP_MSG_GET_RPCMETHODS_REQ: soap_put__cwmp__GetRPCMethods(soap, (struct _cwmp__GetRPCMethods *)parser->body, "cwmp:GetRPCMethods", NULL); break; case CWMP_MSG_SET_PARAM_VALUES_REQ: soap_put__cwmp__SetParameterValues(soap, (struct _cwmp__SetParameterValues *)parser->body, "cwmp:SetParameterValues", NULL); break; case CWMP_MSG_GET_PARAM_VALUES_REQ: soap_put__cwmp__GetParameterValues(soap, (struct _cwmp__GetParameterValues *)parser->body, "cwmp:GetParameterValues", NULL); break; case CWMP_MSG_GET_PARAM_NAMES_REQ: soap_put__cwmp__GetParameterNames(soap, (struct _cwmp__GetParameterNames *)parser->body, "cwmp:GetParameterNames", NULL); break; case CWMP_MSG_SET_PARAM_ATTRIBUTES_REQ: soap_put__cwmp__SetParameterAttributes(soap, (struct _cwmp__SetParameterAttributes *)parser->body, "cwmp:SetParameterAttributes", NULL); break; case CWMP_MSG_GET_PARAM_ATTRIBUTES_REQ: soap_put__cwmp__GetParameterAttributes(soap, (struct _cwmp__GetParameterAttributes *)parser->body, "cwmp:GetParameterAttributes", NULL); break; case CWMP_MSG_ADD_OBJECT_REQ: soap_put__cwmp__AddObject(soap, (struct _cwmp__AddObject *)parser->body, "cwmp:AddObject", NULL); break; case CWMP_MSG_DELETE_OBJECT_REQ: soap_put__cwmp__DeleteObject(soap, (struct _cwmp__DeleteObject *)parser->body, "cwmp:DeleteObject", NULL); break; case CWMP_MSG_REBOOT_REQ: soap_put__cwmp__Reboot(soap, (struct _cwmp__Reboot *)parser->body, "cwmp:Reboot", NULL); break; case CWMP_MSG_DOWNLOAD_REQ: soap_put__cwmp__Download(soap, (struct _cwmp__Download *)parser->body, "cwmp:Download", NULL); break; case CWMP_MSG_SCHEDULE_DOWNLOAD_REQ: soap_put__cwmp__ScheduleDownload(soap, (struct _cwmp__ScheduleDownload *)parser->body, "cwmp:ScheduleDownload", NULL); break; case CWMP_MSG_UPLOAD_REQ: soap_put__cwmp__Upload(soap, (struct _cwmp__Upload *)parser->body, "cwmp:Upload", NULL); break; case CWMP_MSG_FACTORY_RESET_REQ: soap_put__cwmp__FactoryReset(soap, (struct _cwmp__FactoryReset *)parser->body, "cwmp:FactoryReset", NULL); break; case CWMP_MSG_GET_QUEUED_TRANSFERS_REQ: soap_put__cwmp__GetQueuedTransfers(soap, (struct _cwmp__GetQueuedTransfers *)parser->body, "cwmp:GetQueuedTransfers", NULL); break; case CWMP_MSG_GET_ALL_QUEUED_TRANSFERS_REQ: soap_put__cwmp__GetAllQueuedTransfers(soap, (struct _cwmp__GetAllQueuedTransfers *)parser->body, "cwmp:GetAllQueuedTransfers", NULL); break; case CWMP_MSG_CANCEL_TRANSFERS_REQ: soap_put__cwmp__CancelTransfer(soap, (struct _cwmp__CancelTransfer *)parser->body, "cwmp:CancelTransfer", NULL); break; case CWMP_MSG_SCHEDULE_INFORM_REQ: soap_put__cwmp__ScheduleInform(soap, (struct _cwmp__ScheduleInform *)parser->body, "cwmp:ScheduleInform", NULL); break; case CWMP_MSG_CHANGE_DUSTATE_REQ: soap_put__cwmp__ChangeDUState(soap, (struct _cwmp__ChangeDUState *)parser->body, "cwmp:ChangeDUState", NULL); break; case CWMP_MSG_GET_RPCMETHODS_RSP: soap_put__cwmp__GetRPCMethodsResponse(soap, (struct _cwmp__GetRPCMethodsResponse *)parser->body, "cwmp:GetRPCMethodsResponse", NULL); break; case CWMP_MSG_INFROM_RSP: soap_put__cwmp__InformResponse(soap, (struct _cwmp__InformResponse *)parser->body, "cwmp:InformResponse", NULL); break; case CWMP_MSG_TRANSFER_COMPLETE_RSP: soap_put__cwmp__TransferCompleteResponse(soap, (struct _cwmp__TransferCompleteResponse *)parser->body, "cwmp:TransferCompleteResponse", NULL); break; case CWMP_MSG_AUTONOMOUS_TRANSFER_COMPLETE_RSP: soap_put__cwmp__AutonomousTransferCompleteResponse(soap, (struct _cwmp__AutonomousTransferCompleteResponse *)parser->body, "cwmp:AutonomousTransferCompleteResponse", NULL); break; case CWMP_MSG_DUSTATE_CHANGE_COMPLETE_RSP: soap_put__cwmp__DUStateChangeCompleteResponse(soap, (struct _cwmp__DUStateChangeCompleteResponse *)parser->body, "cwmp:DUStateChangeCompleteResponse", NULL); break; case CWMP_MSG_AUTONOMOUS_DUSTATE_CHANGE_COMPLETE_RSP: soap_put__cwmp__AutonomousDUStateChangeCompleteResponse(soap, (struct _cwmp__AutonomousDUStateChangeCompleteResponse *)parser->body, "cwmp:AutonomousDUStateChangeCompleteResponse", NULL); break; case CWMP_MSG_REQUEST_DOWNLOAD_RSP: soap_put__cwmp__RequestDownloadResponse(soap, (struct _cwmp__RequestDownloadResponse *)parser->body, "cwmp:RequestDownloadResponse", NULL); break; default : LOGE(LOG_TAG, "unknow type, %s(%d)", CWMP_MSG_TYPE_STRING(parser->type), parser->type); break; } if (soap_body_end_out(soap) != 0 || soap_envelope_end_out(soap) != 0 || soap_end_send(soap) != 0) { LOGE(LOG_TAG, "end encode failed, error=%d", soap->error); _soap_header_destroy(header); return NULL; } close(fd[1]); xml = _slurpfd(fd[0]); if (tags_num > 0) { int i; for (i = 0; i < tags_num; i++) { char s[128]; char d[128]; char *_xml = xml; if (src_tags[i] == NULL || dst_tags[i] == NULL || strlen(src_tags[i]) <= 0 || strlen(dst_tags[i]) <= 0) { continue; } LOGV(LOG_TAG, "replace \"%s\" to \"%s\"", src_tags[i], dst_tags[i]); snprintf(s, 128, "%s:", src_tags[i]); snprintf(d, 128, "%s:", dst_tags[i]); xml = _string_replace(_xml, s, d); if (xml == NULL) { LOGE(LOG_TAG, "replace tag failed."); return _xml; } free(_xml); } } _soap_header_destroy(header); _soap_fault_destroy(fault); return xml; }
/** * body -> xml * @param[in] handle: soap_parser * @param[in] id: cpe id? * @param[in] hold_request: hold request * @param[in] type: SOAP/RPC type * @param[in] body: a kind of struct * @return: xml, the string get from body */ char *soap_parser_encode(void *handle, CpeRpcMsg* msg) { struct soap_parser *parser = (struct soap_parser *)handle; struct soap *soap = parser->soap; int fd[2]; char *xml = NULL; int type = msg->type; pipe(fd); soap_init(soap); soap->socket = -1; soap->sendfd = fd[1]; parser->soap_header = (struct SOAP_ENV__Header *)_soap_header_create(id, hold_requests); soap->header = parser->soap_header; if (soap->header != NULL) { if (soap->header->__ID != NULL) { LOGV(parser->tag, "soap header: ID=%s(%s)", soap->header->__ID->__item, soap->header->__ID->SOAP_ENV__mustUnderstand); } if (soap->header->__HoldRequests != NULL) { LOGV(parser->tag, "soap header: HoldRequests=%d(%s)", soap->header->__HoldRequests->__item, soap->header->__HoldRequests->SOAP_ENV__mustUnderstand); } } soap_begin_send(soap); soap_envelope_begin_out(soap); soap_putheader(soap); soap_body_begin_out(soap); switch (type) { case SOAP_TYPE__ns1__Fault: { if (parser->soap_fault != NULL) { _soap_fault_free(parser->soap_fault); parser->soap_fault = NULL; } parser->soap_fault = _soap_fault_create((struct _ns1__Fault *)body); if (parser->soap_fault != NULL) { soap_put_SOAP_ENV__Fault(soap, parser->soap_fault, NULL, NULL); } break; } case SOAP_TYPE__ns1__GetRPCMethods: soap_put__ns1__GetRPCMethods(soap, (struct _ns1__GetRPCMethods *)body, "ns1:GetRPCMethods", NULL); break; case SOAP_TYPE__ns1__SetParameterValues: soap_put__ns1__SetParameterValues(soap, (struct _ns1__SetParameterValues *)body, "ns1:SetParameterValues", NULL); break; case SOAP_TYPE__ns1__GetParameterValues: soap_put__ns1__GetParameterValues(soap, (struct _ns1__GetParameterValues *)body, "ns1:GetParameterValues", NULL); break; case SOAP_TYPE__ns1__GetParameterNames: soap_put__ns1__GetParameterNames(soap, (struct _ns1__GetParameterNames *)body, "ns1:GetParameterNames", NULL); break; case SOAP_TYPE__ns1__SetParameterAttributes: soap_put__ns1__SetParameterAttributes(soap, (struct _ns1__SetParameterAttributes *)body, "ns1:SetParameterAttributes", NULL); break; case SOAP_TYPE__ns1__GetParameterAttributes: soap_put__ns1__GetParameterAttributes(soap, (struct _ns1__GetParameterAttributes *)body, "ns1:GetParameterAttributes", NULL); break; case SOAP_TYPE__ns1__AddObject: soap_put__ns1__AddObject(soap, (struct _ns1__AddObject *)body, "ns1:AddObject", NULL); break; case SOAP_TYPE__ns1__DeleteObject: soap_put__ns1__DeleteObject(soap, (struct _ns1__DeleteObject *)body, "ns1:DeleteObject", NULL); break; case SOAP_TYPE__ns1__Reboot: soap_put__ns1__Reboot(soap, (struct _ns1__Reboot *)body, "ns1:Reboot", NULL); break; case SOAP_TYPE__ns1__Download: soap_put__ns1__Download(soap, (struct _ns1__Download *)body, "ns1:Download", NULL); break; case SOAP_TYPE__ns1__ScheduleDownload: soap_put__ns1__ScheduleDownload(soap, (struct _ns1__ScheduleDownload *)body, "ns1:ScheduleDownload", NULL); break; case SOAP_TYPE__ns1__Upload: soap_put__ns1__Upload(soap, (struct _ns1__Upload *)body, "ns1:Upload", NULL); break; case SOAP_TYPE__ns1__FactoryReset: soap_put__ns1__FactoryReset(soap, (struct _ns1__FactoryReset *)body, "ns1:FactoryReset", NULL); break; case SOAP_TYPE__ns1__GetQueuedTransfers: soap_put__ns1__GetQueuedTransfers(soap, (struct _ns1__GetQueuedTransfers *)body, "ns1:GetQueuedTransfers", NULL); break; case SOAP_TYPE__ns1__GetAllQueuedTransfers: soap_put__ns1__GetAllQueuedTransfers(soap, (struct _ns1__GetAllQueuedTransfers *)body, "ns1:GetAllQueuedTransfers", NULL); break; case SOAP_TYPE__ns1__CancelTransfer: soap_put__ns1__CancelTransfer(soap, (struct _ns1__CancelTransfer *)body, "ns1:CancelTransfer", NULL); break; case SOAP_TYPE__ns1__ScheduleInform: soap_put__ns1__ScheduleInform(soap, (struct _ns1__ScheduleInform *)body, "ns1:ScheduleInform", NULL); break; case SOAP_TYPE__ns1__ChangeDUState: soap_put__ns1__ChangeDUState(soap, (struct _ns1__ChangeDUState *)body, "ns1:ChangeDUState", NULL); break; case SOAP_TYPE__ns1__GetRPCMethodsResponse: soap_put__ns1__GetRPCMethodsResponse(soap, (struct _ns1__GetRPCMethodsResponse *)body, "ns1:GetRPCMethodsResponse", NULL); break; case SOAP_TYPE__ns1__InformResponse: soap_put__ns1__InformResponse(soap, (struct _ns1__InformResponse *)body, "ns1:InformResponse", NULL); break; case SOAP_TYPE__ns1__TransferCompleteResponse: soap_put__ns1__TransferCompleteResponse(soap, (struct _ns1__TransferCompleteResponse *)body, "ns1:TransferCompleteResponse", NULL); break; case SOAP_TYPE__ns1__AutonomousTransferCompleteResponse: soap_put__ns1__AutonomousTransferCompleteResponse(soap, (struct _ns1__AutonomousTransferCompleteResponse *)body, "ns1:AutonomousTransferCompleteResponse", NULL); break; case SOAP_TYPE__ns1__DUStateChangeCompleteResponse: soap_put__ns1__DUStateChangeCompleteResponse(soap, (struct _ns1__DUStateChangeCompleteResponse *)body, "ns1:DUStateChangeCompleteResponse", NULL); break; case SOAP_TYPE__ns1__AutonomousDUStateChangeCompleteResponse: soap_put__ns1__AutonomousDUStateChangeCompleteResponse(soap, (struct _ns1__AutonomousDUStateChangeCompleteResponse *)body, "ns1:AutonomousDUStateChangeCompleteResponse", NULL); break; case SOAP_TYPE__ns1__RequestDownloadResponse: soap_put__ns1__RequestDownloadResponse(soap, (struct _ns1__RequestDownloadResponse *)body, "ns1:RequestDownloadResponse", NULL); break; default : LOGE(PARSER_TAG, "unknow SOAP_TYPE, %d", type); break; } soap_body_end_out(soap); soap_envelope_end_out(soap); soap_end_send(soap); /*soap_end(soap);*/ close(fd[1]); xml = slurpfd(fd[0]); //soap_free(soap); return xml; }