Ejemplo n.º 1
0
SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns__echoDecimal(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *inputDecimal, char *&_return)
{	struct ns__echoDecimal soap_tmp_ns__echoDecimal;
	struct ns__echoDecimalResponse *soap_tmp_ns__echoDecimalResponse;
	soap->encodingStyle = "";
	soap_tmp_ns__echoDecimal.inputDecimal = inputDecimal;
	soap_begin(soap);
	soap_serializeheader(soap);
	soap_serialize_ns__echoDecimal(soap, &soap_tmp_ns__echoDecimal);
	if (soap_begin_count(soap))
		return soap->error;
	if (soap->mode & SOAP_IO_LENGTH)
	{	if (soap_envelope_begin_out(soap)
		 || soap_putheader(soap)
		 || soap_body_begin_out(soap)
		 || soap_put_ns__echoDecimal(soap, &soap_tmp_ns__echoDecimal, "ns:echoDecimal", NULL)
		 || soap_body_end_out(soap)
		 || soap_envelope_end_out(soap))
			 return soap->error;
	}
	if (soap_end_count(soap))
		return soap->error;
	if (soap_connect(soap, soap_endpoint, soap_action)
	 || soap_envelope_begin_out(soap)
	 || soap_putheader(soap)
	 || soap_body_begin_out(soap)
	 || soap_put_ns__echoDecimal(soap, &soap_tmp_ns__echoDecimal, "ns:echoDecimal", NULL)
	 || soap_body_end_out(soap)
	 || soap_envelope_end_out(soap)
	 || soap_end_send(soap))
		return soap_closesock(soap);
	_return = NULL;
	if (soap_begin_recv(soap)
	 || soap_envelope_begin_in(soap)
	 || soap_recv_header(soap)
	 || soap_body_begin_in(soap))
		return soap_closesock(soap);
	if (soap_recv_fault(soap, 1))
		return soap->error;
	soap_tmp_ns__echoDecimalResponse = soap_get_ns__echoDecimalResponse(soap, NULL, "", "");
	if (soap->error)
		return soap_recv_fault(soap, 0);
	if (soap_body_end_in(soap)
	 || soap_envelope_end_in(soap)
	 || soap_end_recv(soap))
		return soap_closesock(soap);
	_return = soap_tmp_ns__echoDecimalResponse->_return;
	return soap_closesock(soap);
}
Ejemplo n.º 2
0
SOAP_FMAC5 int SOAP_FMAC6 soap_call_ims__getLastMessage(struct soap *soap, const char *soap_endpoint, const char *soap_action, struct _Struct_1 *myMessage)
{	struct ims__getLastMessage soap_tmp_ims__getLastMessage;
	struct ims__getLastMessageResponse *soap_tmp_ims__getLastMessageResponse;
	soap->encodingStyle = NULL;
	soap_begin(soap);
	soap_serializeheader(soap);
	soap_serialize_ims__getLastMessage(soap, &soap_tmp_ims__getLastMessage);
	if (soap_begin_count(soap))
		return soap->error;
	if (soap->mode & SOAP_IO_LENGTH)
	{	if (soap_envelope_begin_out(soap)
		 || soap_putheader(soap)
		 || soap_body_begin_out(soap)
		 || soap_put_ims__getLastMessage(soap, &soap_tmp_ims__getLastMessage, "ims:getLastMessage", NULL)
		 || soap_body_end_out(soap)
		 || soap_envelope_end_out(soap))
			 return soap->error;
	}
	if (soap_end_count(soap))
		return soap->error;
	if (soap_connect(soap, soap_endpoint, soap_action)
	 || soap_envelope_begin_out(soap)
	 || soap_putheader(soap)
	 || soap_body_begin_out(soap)
	 || soap_put_ims__getLastMessage(soap, &soap_tmp_ims__getLastMessage, "ims:getLastMessage", NULL)
	 || soap_body_end_out(soap)
	 || soap_envelope_end_out(soap)
	 || soap_end_send(soap))
		return soap_closesock(soap);
	if (!myMessage)
		return soap_closesock(soap);
	soap_default_Message(soap, myMessage);
	if (soap_begin_recv(soap)
	 || soap_envelope_begin_in(soap)
	 || soap_recv_header(soap)
	 || soap_body_begin_in(soap))
		return soap_closesock(soap);
	soap_tmp_ims__getLastMessageResponse = soap_get_ims__getLastMessageResponse(soap, NULL, "ims:getLastMessageResponse", "");
	if (soap->error)
		return soap_recv_fault(soap, 0);
	if (soap_body_end_in(soap)
	 || soap_envelope_end_in(soap)
	 || soap_end_recv(soap))
		return soap_closesock(soap);
	if (myMessage && soap_tmp_ims__getLastMessageResponse->myMessage)
		*myMessage = *soap_tmp_ims__getLastMessageResponse->myMessage;
	return soap_closesock(soap);
}
Ejemplo n.º 3
0
SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns__echoStruct(struct soap *soap, const char *soap_endpoint, const char *soap_action, struct s__SOAPStruct _inputStruct, struct ns__echoStructResponse &result)
{	struct ns__echoStruct soap_tmp_ns__echoStruct;
	soap->encodingStyle = "";
	soap_tmp_ns__echoStruct._inputStruct = _inputStruct;
	soap_begin(soap);
	soap_serializeheader(soap);
	soap_serialize_ns__echoStruct(soap, &soap_tmp_ns__echoStruct);
	if (soap_begin_count(soap))
		return soap->error;
	if (soap->mode & SOAP_IO_LENGTH)
	{	if (soap_envelope_begin_out(soap)
		 || soap_putheader(soap)
		 || soap_body_begin_out(soap)
		 || soap_put_ns__echoStruct(soap, &soap_tmp_ns__echoStruct, "ns:echoStruct", NULL)
		 || soap_body_end_out(soap)
		 || soap_envelope_end_out(soap))
			 return soap->error;
	}
	if (soap_end_count(soap))
		return soap->error;
	if (soap_connect(soap, soap_endpoint, soap_action)
	 || soap_envelope_begin_out(soap)
	 || soap_putheader(soap)
	 || soap_body_begin_out(soap)
	 || soap_put_ns__echoStruct(soap, &soap_tmp_ns__echoStruct, "ns:echoStruct", NULL)
	 || soap_body_end_out(soap)
	 || soap_envelope_end_out(soap)
	 || soap_end_send(soap))
		return soap_closesock(soap);
	if (!&result)
		return soap_closesock(soap);
	soap_default_ns__echoStructResponse(soap, &result);
	if (soap_begin_recv(soap)
	 || soap_envelope_begin_in(soap)
	 || soap_recv_header(soap)
	 || soap_body_begin_in(soap))
		return soap_closesock(soap);
	if (soap_recv_fault(soap, 1))
		return soap->error;
	soap_get_ns__echoStructResponse(soap, &result, "", "");
	if (soap->error)
		return soap_recv_fault(soap, 0);
	if (soap_body_end_in(soap)
	 || soap_envelope_end_in(soap)
	 || soap_end_recv(soap))
		return soap_closesock(soap);
	return soap_closesock(soap);
}
Ejemplo n.º 4
0
SOAP_FMAC5 int SOAP_FMAC6 soap_call_oph__ophExecuteMain(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *ophExecuteMainRequest, struct oph__ophResponse *ophExecuteMainResponse)
{	struct oph__ophExecuteMain soap_tmp_oph__ophExecuteMain;
	if (soap_action == NULL)
		soap_action = "";
	soap_tmp_oph__ophExecuteMain.ophExecuteMainRequest = ophExecuteMainRequest;
	soap_begin(soap);
	soap->encodingStyle = NULL;
	soap_serializeheader(soap);
	soap_serialize_oph__ophExecuteMain(soap, &soap_tmp_oph__ophExecuteMain);
	if (soap_begin_count(soap))
		return soap->error;
	if (soap->mode & SOAP_IO_LENGTH)
	{	if (soap_envelope_begin_out(soap)
		 || soap_putheader(soap)
		 || soap_body_begin_out(soap)
		 || soap_put_oph__ophExecuteMain(soap, &soap_tmp_oph__ophExecuteMain, "oph:ophExecuteMain", NULL)
		 || soap_body_end_out(soap)
		 || soap_envelope_end_out(soap))
			 return soap->error;
	}
	if (soap_end_count(soap))
		return soap->error;
	if (soap_connect(soap, soap_url(soap, soap_endpoint, NULL), soap_action)
	 || soap_envelope_begin_out(soap)
	 || soap_putheader(soap)
	 || soap_body_begin_out(soap)
	 || soap_put_oph__ophExecuteMain(soap, &soap_tmp_oph__ophExecuteMain, "oph:ophExecuteMain", NULL)
	 || soap_body_end_out(soap)
	 || soap_envelope_end_out(soap)
	 || soap_end_send(soap))
		return soap_closesock(soap);
	if (!ophExecuteMainResponse)
		return soap_closesock(soap);
	soap_default_oph__ophResponse(soap, ophExecuteMainResponse);
	if (soap_begin_recv(soap)
	 || soap_envelope_begin_in(soap)
	 || soap_recv_header(soap)
	 || soap_body_begin_in(soap))
		return soap_closesock(soap);
	soap_get_oph__ophResponse(soap, ophExecuteMainResponse, "oph:ophResponse", NULL);
	if (soap->error)
		return soap_recv_fault(soap, 0);
	if (soap_body_end_in(soap)
	 || soap_envelope_end_in(soap)
	 || soap_end_recv(soap))
		return soap_closesock(soap);
	return soap_closesock(soap);
}
Ejemplo n.º 5
0
int agentProxy::setCameraURI(struct camera__uri *_info, struct camera__info &_infoResponse)
{   struct soap *soap = this;
    struct agent__setCameraURI soap_tmp_agent__setCameraURI;
    const char *soap_action = NULL;
    soap->encodingStyle = NULL;
    soap_tmp_agent__setCameraURI._info = _info;
    soap_begin(soap);
    soap_serializeheader(soap);
    soap_serialize_agent__setCameraURI(soap, &soap_tmp_agent__setCameraURI);
    if (soap_begin_count(soap))
        return soap->error;
    if (soap->mode & SOAP_IO_LENGTH)
    {   if (soap_envelope_begin_out(soap)
                || soap_putheader(soap)
                || soap_body_begin_out(soap)
                || soap_put_agent__setCameraURI(soap, &soap_tmp_agent__setCameraURI, "agent:setCameraURI", NULL)
                || soap_body_end_out(soap)
                || soap_envelope_end_out(soap))
            return soap->error;
    }
    if (soap_end_count(soap))
        return soap->error;
    if (soap_connect(soap, soap_endpoint, soap_action)
            || soap_envelope_begin_out(soap)
            || soap_putheader(soap)
            || soap_body_begin_out(soap)
            || soap_put_agent__setCameraURI(soap, &soap_tmp_agent__setCameraURI, "agent:setCameraURI", NULL)
            || soap_body_end_out(soap)
            || soap_envelope_end_out(soap)
            || soap_end_send(soap))
        return soap_closesock(soap);
    if (!&_infoResponse)
        return soap_closesock(soap);
    soap_default_camera__info(soap, &_infoResponse);
    if (soap_begin_recv(soap)
            || soap_envelope_begin_in(soap)
            || soap_recv_header(soap)
            || soap_body_begin_in(soap))
        return soap_closesock(soap);
    soap_get_camera__info(soap, &_infoResponse, "camera:info", "");
    if (soap->error)
        return soap_recv_fault(soap, 0);
    if (soap_body_end_in(soap)
            || soap_envelope_end_in(soap)
            || soap_end_recv(soap))
        return soap_closesock(soap);
    return soap_closesock(soap);
}
Ejemplo n.º 6
0
SOAP_FMAC5 int SOAP_FMAC6 soap_call___s0__Read(struct soap* soap,
    const char* soap_endpoint, const char* soap_action, _s0__Read* s0__Read,
    _s0__ReadResponse* s0__ReadResponse)
{
  struct __s0__Read soap_tmp___s0__Read;
  if (!soap_action)
    soap_action = "http://opcfoundation.org/webservices/XMLDA/1.0/Read";
  soap->encodingStyle = NULL;
  soap_tmp___s0__Read.s0__Read = s0__Read;
  soap_begin(soap);
  soap_serializeheader(soap);
  soap_serialize___s0__Read(soap, &soap_tmp___s0__Read);
  if (soap_begin_count(soap))
    return soap->error;
  if (soap->mode & SOAP_IO_LENGTH) {
    if (soap_envelope_begin_out(soap) || soap_putheader(soap)
        || soap_body_begin_out(soap)
        || soap_put___s0__Read(soap, &soap_tmp___s0__Read, "-s0:Read", "")
        || soap_body_end_out(soap) || soap_envelope_end_out(soap))
      return soap->error;
  }
  if (soap_end_count(soap))
    return soap->error;
  if (soap_connect(soap, soap_endpoint, soap_action)
      || soap_envelope_begin_out(soap) || soap_putheader(soap)
      || soap_body_begin_out(soap)
      || soap_put___s0__Read(soap, &soap_tmp___s0__Read, "-s0:Read", "")
      || soap_body_end_out(soap) || soap_envelope_end_out(soap)
      || soap_end_send(soap))
    return soap_closesock(soap);
  if (!s0__ReadResponse)
    return soap_closesock(soap);
  s0__ReadResponse->soap_default(soap);
  if (soap_begin_recv(soap) || soap_envelope_begin_in(soap)
      || soap_recv_header(soap) || soap_body_begin_in(soap))
    return soap_closesock(soap);
  s0__ReadResponse->soap_get(soap, "s0:ReadResponse", "");
  if (soap->error) {
    if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2)
      return soap_recv_fault(soap);
    return soap_closesock(soap);
  }
  if (soap_body_end_in(soap) || soap_envelope_end_in(soap)
      || soap_end_recv(soap))
    return soap_closesock(soap);
  return soap_closesock(soap);
}
Ejemplo n.º 7
0
SOAP_FMAC5 int SOAP_FMAC6 soap_recv_d__Probe(struct soap *soap, struct d__Probe *_param_1)
{
	soap_default_d__Probe(soap, _param_1);
	soap_begin(soap);
	if (soap_begin_recv(soap)
	 || soap_envelope_begin_in(soap)
	 || soap_recv_header(soap)
	 || soap_body_begin_in(soap))
		return soap_closesock(soap);
	soap_get_d__Probe(soap, _param_1, "d:Probe", NULL);
	if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2)
		soap->error = SOAP_NO_METHOD;
	if (soap->error
	 || soap_body_end_in(soap)
	 || soap_envelope_end_in(soap)
	 || soap_end_recv(soap))
		return soap_closesock(soap);
	return soap_closesock(soap);
}
Ejemplo n.º 8
0
int dpws_discoveryProxy::recv_ResolveMatches(struct __wsd__ResolveMatches& tmp)
{
	struct soap *soap = this;
	struct __wsd__ResolveMatches *_param_6 = &tmp;
	soap_default___wsd__ResolveMatches(soap, _param_6);
	soap_begin(soap);
	if (soap_begin_recv(soap)
	 || soap_envelope_begin_in(soap)
	 || soap_recv_header(soap)
	 || soap_body_begin_in(soap))
		return soap_closesock(soap);
	soap_get___wsd__ResolveMatches(soap, _param_6, "-wsd:ResolveMatches", NULL);
	if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2)
		soap->error = SOAP_NO_METHOD;
	if (soap->error
	 || soap_body_end_in(soap)
	 || soap_envelope_end_in(soap)
	 || soap_end_recv(soap))
		return soap_closesock(soap);
	return soap_closesock(soap);
}
int WSDualHttpBinding_USCOREICalculatorDuplexProxy::recv_Equation(struct __tempuri__Equation& tmp)
{	struct soap *soap = this->soap;

	struct __tempuri__Equation *_param_7 = &tmp;
	soap_default___tempuri__Equation(soap, _param_7);
	soap_begin(soap);
	if (soap_begin_recv(soap)
	 || soap_envelope_begin_in(soap)
	 || soap_recv_header(soap)
	 || soap_body_begin_in(soap))
		return soap_closesock(soap);
	soap_get___tempuri__Equation(soap, _param_7, "-tempuri:Equation", NULL);
	if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2)
		soap->error = SOAP_OK;
	if (soap->error
	 || soap_body_end_in(soap)
	 || soap_envelope_end_in(soap)
	 || soap_end_recv(soap))
		return soap_closesock(soap);
	return soap_closesock(soap);
}
int PullPointSubscriptionBindingProxy::recv_Notify_(struct __tev__Notify_& tmp)
{	struct soap *soap = this->soap;

	struct __tev__Notify_ *_param_15 = &tmp;
	soap_default___tev__Notify_(soap, _param_15);
	soap_begin(soap);
	if (soap_begin_recv(soap)
	 || soap_envelope_begin_in(soap)
	 || soap_recv_header(soap)
	 || soap_body_begin_in(soap))
		return soap_closesock(soap);
	soap_get___tev__Notify_(soap, _param_15, "-tev:Notify", NULL);
	if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2)
		soap->error = SOAP_OK;
	if (soap->error
	 || soap_body_end_in(soap)
	 || soap_envelope_end_in(soap)
	 || soap_end_recv(soap))
		return soap_closesock(soap);
	return soap_closesock(soap);
}
Ejemplo n.º 11
0
int wsddProxy::recv_Resolve(struct __wsdd__Resolve& tmp)
{	struct soap *soap = this;

	struct __wsdd__Resolve *_param_6 = &tmp;
	soap_default___wsdd__Resolve(soap, _param_6);
	soap_begin(soap);
	if (soap_begin_recv(soap)
	 || soap_envelope_begin_in(soap)
	 || soap_recv_header(soap)
	 || soap_body_begin_in(soap))
		return soap_closesock(soap);
	soap_get___wsdd__Resolve(soap, _param_6, "-wsdd:Resolve", NULL);
	if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2)
		soap->error = SOAP_OK;
	if (soap->error
	 || soap_body_end_in(soap)
	 || soap_envelope_end_in(soap)
	 || soap_end_recv(soap))
		return soap_closesock(soap);
	return soap_closesock(soap);
}
Ejemplo n.º 12
0
int soap_parser_decode(void *handle, const char *xml)
{
    SoapParser *parser = (SoapParser *)handle;
    struct soap *soap;
    int fd[2];

    if (parser == NULL) {
        return -1;
    }
    if (xml == NULL) {
        LOGE(LOG_TAG, "input xml is empty");
        return -1;
    }

    soap = parser->soap;
    pipe(fd);

    /*soap_init(soap);*/
    soap_init1(soap, SOAP_XML_IGNORENS);
    soap_set_namespaces(soap, namespaces);

    soap->socket = -1;
    soap->recvfd = fd[0];
    write(fd[1], xml, strlen(xml));
    close(fd[1]);

    if (soap_begin_recv(soap) != 0
        || soap_envelope_begin_in(soap) != 0) {
        LOGE(LOG_TAG, "begin decode failed, error=%d", soap->error);
        return -1;
    }

    if (soap_recv_header(soap) != 0) {
        LOGE(LOG_TAG, "decode soap header failed, %d", soap->error);
        return -1;
    }
    _soap_header_parse(soap->header,
                       &(parser->id),
                       &(parser->hold_requests),
                       &(parser->session_timeout),
                       &(parser->supported_cwmp_versions),
                       &(parser->use_cwmp_version));

    if (soap_body_begin_in(soap) != 0) {
        LOGE(LOG_TAG, "decode soap body failed, %d", soap->error);
        return -1;
    }

    parser->_namespaces = _soap_namespaces_parse(soap);
    parser->namespaces = parser->_namespaces;
    parser->version = _soap_version_parse(xml, parser->namespaces);
    if (parser->version == CWMP_VERSION_1_2) {
        if (parser->supported_cwmp_versions != 0 && parser->use_cwmp_version != 0) {
            parser->version = CWMP_VERSION_1_4;
        } else if (parser->session_timeout > 0) {
            parser->version = CWMP_VERSION_1_3;
        }
    }

    if (soap_recv_fault(soap, 1) != 0) {
        parser->type = CWMP_MSG_FAULT;
        _soap_fault_dump(soap->fault);
        if (soap->fault != NULL
            && soap->fault->detail != NULL
            && soap->fault->detail->__type == SOAP_TYPE__cwmp__Fault) {
            struct _cwmp__Fault *cwmp_fault;
            cwmp_fault = (struct _cwmp__Fault *)soap->fault->detail->fault;
            if (cwmp_fault != NULL) {
                if (cwmp_fault->FaultCode != NULL) {
                    parser->fault_code = atoi(cwmp_fault->FaultCode);
                }
                parser->fault_string = cwmp_fault->FaultString;
                parser->fault_body = cwmp_fault;
                parser->body = cwmp_fault;
            }
        }
        return 0;
    }

    int gsoap_type;
    parser->body = soap_getelement(soap, &gsoap_type);
    parser->type = _get_cwmp_type(gsoap_type);
    if (soap->error) {
        LOGE(LOG_TAG, "get cwmp body failed, error=%d", soap->error);
        return -1;
    }

    if (soap_body_end_in(soap)
        || soap_envelope_end_in(soap)
        || soap_end_recv(soap)) {
        LOGE(LOG_TAG, "end decode failed, %d", soap->error);
        return -1;
    }
    close(fd[0]);

    return 0;
}
Ejemplo n.º 13
0
/**
 * xml -> body
 * @param[in] handle: parser
 * @param[in] xml: the xml to be decoded
 * @param[out] id: cpe's id? I don't know
 * @param[out] hold_request: hold
 * @param[out] type: SOAP/RPC type
 * @param[out] body: the result get from xml
 */
int soap_parser_decode(void *handle, const char *xml,
                       int *id, int *hold_requests, int *type, void **body)
{
    struct soap_parser *parser = (struct soap_parser *)handle;
    struct soap *soap = parser->soap;
    int fd[2];

    if (xml == NULL) {
        return -1;
    }

    /*LOGD(parser->tag, xml);*/

    pipe(fd);

    *id = 0;
    *hold_requests = 0;
    *type = 0;
    *body = NULL;

    soap_init(soap);
    soap->socket = -1;
    soap->recvfd = fd[0];
    write(fd[1], xml, strlen(xml));
    close(fd[1]);

    if (soap_begin_recv(soap)
        || soap_envelope_begin_in(soap)
        || soap_recv_header(soap)
        || soap_body_begin_in(soap)) {
        return -1;
    }

    if (soap->header != NULL) {
        if (soap->header->__HoldRequests != NULL) {
            *hold_requests = soap->header->__HoldRequests->__item;
        }
        if (soap->header->__ID != NULL) {
            if (soap->header->__ID->__item != NULL) {
                *id = atoi(soap->header->__ID->__item);
            }
        }
    }

    if (soap_recv_fault(soap, 1)) {
        LOGE(parser->tag, "FaultCode=%s, FaultString=%s",
             soap->fault->faultcode, soap->fault->faultstring);
        *type = SOAP_TYPE__ns1__Fault;
        if (soap->fault != NULL && soap->fault->detail != NULL) {
            *body = soap->fault->detail->__any;
        }
        return 0;
    }

    *body = soap_getelement(soap, type);
    if (soap->error) {
        return -1;
    }

    if (soap_body_end_in(soap)
        || soap_envelope_end_in(soap)
        || soap_end_recv(soap)) {
        return -1;
    }
    ////soap_end(soap);
    //soap_free(soap);
    close(fd[0]);

    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=%s(%s)",
                 soap->header->__HoldRequests->__item,
                 soap->header->__HoldRequests->SOAP_ENV__mustUnderstand);
        }
    }
    return 0;
}