해결책을 찾았습니다. 내 자신의 wsdl 파일로 내 서버를 만들려고했습니다.
나는 두 숫자 값을 가져옵니다 JAVA에 서버를 만들어 함께 추가 :
public class Math {
public int addOperator(int num1, int num2){
return (num1+num2);
}
}
다음 이클립스에서에서 WSDL 파일을 만들었습니다. WSDL 파일에서 내가는 C 파일 생성 :
adb_addOperator.c을
adb_addOperatorResponse.c
axis2_extension_mapper.c
axis2_stub_MathService.c
플러스 나는 그들의 헤더가 파일.
MathServiceClient.vcproj 파일
이 프로젝트를 Visual Studio에서 가져 왔습니다. 는 그럼 난 내 프로젝트에이 math.c 파일을 추가 :
#include "axis2_stub_MathService.h"
int main(
int argc,
char *argv)
{
axutil_env_t * env = NULL;
axis2_char_t * operation = NULL;
axis2_char_t * client_home = NULL;
axis2_char_t * endpoint_uri = NULL;
axis2_stub_t * stub = NULL;
adb_addOperatorResponse_t * add_res = NULL;
adb_addOperator_t * add_in = NULL;
int res_val = 0;
endpoint_uri = "http://localhost:8080/AddOperator/services/Math"; //this is the tomcatServer running the MathServer
env = axutil_env_create_all("alltest.log", AXIS2_LOG_LEVEL_TRACE);
/* Set up deploy folder. */
client_home = AXIS2_GETENV("AXIS2C_HOME");
if (!client_home)
client_home = "../../../deploy";
stub = axis2_stub_create_MathService(env, client_home, endpoint_uri);
add_in = adb_addOperator_create(env);
adb_addOperator_set_num1(add_in, env, 14); //initializing num1
adb_addOperator_set_num2(add_in, env, 33); //initializing num2
add_res = axis2_stub_op_MathService_addOperator(stub, env, add_in);
if (!add_res)
{
printf("Error: response NULL\n");
return -1;
}
res_val = adb_addOperatorResponse_get_addOperatorReturn(add_res, env);
printf("Add Result : %d ", res_val);
return 0;
}
프로젝트를 컴파일. cmd를 연 다음 MathService.exe 디렉토리를 열었습니다. 그 다음에 MathService를 실행했습니다. 제대로 작동했습니다.