コード例 #1
0
ファイル: soapClient.cpp プロジェクト: hongxiaolong/ABET
SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns__echoString(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *str, char **res)
{	struct ns__echoString soap_tmp_ns__echoString;
	struct ns__echoStringResponse *soap_tmp_ns__echoStringResponse;
	if (!soap_endpoint)
		soap_endpoint = "soap.udp://localhost:10000";
	soap->encodingStyle = NULL;
	soap_tmp_ns__echoString.str = str;
	soap_begin(soap);
	soap_serializeheader(soap);
	soap_serialize_ns__echoString(soap, &soap_tmp_ns__echoString);
	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__echoString(soap, &soap_tmp_ns__echoString, "ns:echoString", 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__echoString(soap, &soap_tmp_ns__echoString, "ns:echoString", NULL)
	 || soap_body_end_out(soap)
	 || soap_envelope_end_out(soap)
	 || soap_end_send(soap))
		return soap_closesock(soap);
	if (!res)
		return soap_closesock(soap);
	*res = NULL;
	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_ns__echoStringResponse = soap_get_ns__echoStringResponse(soap, NULL, "ns:echoStringResponse", "");
	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 (res && soap_tmp_ns__echoStringResponse->res)
		*res = *soap_tmp_ns__echoStringResponse->res;
	return soap_closesock(soap);
}
コード例 #2
0
ファイル: soapClient.cpp プロジェクト: DemofiloVizuete/gSOAP
SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns__echoString(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *inputString, char *&_return)
{	struct ns__echoString soap_tmp_ns__echoString;
	struct ns__echoStringResponse *soap_tmp_ns__echoStringResponse;
	soap->encodingStyle = "";
	soap_tmp_ns__echoString.inputString = inputString;
	soap_begin(soap);
	soap_serializeheader(soap);
	soap_serialize_ns__echoString(soap, &soap_tmp_ns__echoString);
	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__echoString(soap, &soap_tmp_ns__echoString, "ns:echoString", 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__echoString(soap, &soap_tmp_ns__echoString, "ns:echoString", 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__echoStringResponse = soap_get_ns__echoStringResponse(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__echoStringResponse->_return;
	return soap_closesock(soap);
}