예제 #1
0
int calcProxy::add(double a, double b, double &result)
{	struct soap *soap = this;
	struct ns2__add soap_tmp_ns2__add;
	struct ns2__addResponse *soap_tmp_ns2__addResponse;
	const char *soap_action = NULL;
	if (!soap_endpoint)
		soap_endpoint = "http://websrv.cs.fsu.edu/~engelen/calcserver.cgi";
	soap_action = "";
	soap->encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/";
	soap_tmp_ns2__add.a = a;
	soap_tmp_ns2__add.b = b;
	soap_begin(soap);
	soap_serializeheader(soap);
	soap_serialize_ns2__add(soap, &soap_tmp_ns2__add);
	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_ns2__add(soap, &soap_tmp_ns2__add, "ns2:add", 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_ns2__add(soap, &soap_tmp_ns2__add, "ns2:add", 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_double(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_tmp_ns2__addResponse = soap_get_ns2__addResponse(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);
	result = soap_tmp_ns2__addResponse->result;
	return soap_closesock(soap);
}
예제 #2
0
파일: soapClient.c 프로젝트: Jeansfirm/test
SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns2__add(struct soap *soap, const char *soap_endpoint, const char *soap_action, int num1, int num2, int *sum)
{	struct ns2__add soap_tmp_ns2__add;
	struct ns2__addResponse *soap_tmp_ns2__addResponse;
	soap->encodingStyle = NULL;
	soap_tmp_ns2__add.num1 = num1;
	soap_tmp_ns2__add.num2 = num2;
	soap_begin(soap);
	soap_serializeheader(soap);
	soap_serialize_ns2__add(soap, &soap_tmp_ns2__add);
	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_ns2__add(soap, &soap_tmp_ns2__add, "ns2:add", "")
		 || 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_ns2__add(soap, &soap_tmp_ns2__add, "ns2:add", "")
	 || soap_body_end_out(soap)
	 || soap_envelope_end_out(soap)
	 || soap_end_send(soap))
		return soap_closesock(soap);
	soap_default_int(soap, sum);
	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_ns2__addResponse = soap_get_ns2__addResponse(soap, NULL, "ns2:addResponse", "");
	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);
	if (sum && soap_tmp_ns2__addResponse->sum)
		*sum = *soap_tmp_ns2__addResponse->sum;
	return soap_closesock(soap);
}