Hi Milinda,
Yes, you're right about that functions, there is something wrong with them.
I found out something. In Microsoft Visual Studio I build the project like
Win32 application, and building this way the sample echo service from
Axis2/C and dll created is ok, meaning that I can connect to that with a
Java client using Axis2/Java.
I tried also this with my generated SayHelloService service.
But unfortunately has compile errors which I don't understand:
error C2491: 'axis2_get_instance' : definition of dllimport function not
allowed
error C2491: 'axis2_remove_instance' : definition of dllimport function not
allowed
The generated axis2_get_instance and axis2_remove_instance functions look
like the following:
AXIS2_EXTERN int AXIS2_CALL
axis2_get_instance(struct axis2_svc_skeleton **inst,
const axis2_env_t *env)
{
...
}
AXIS2_EXTERN int AXIS2_CALL
axis2_remove_instance(axis2_svc_skeleton_t *inst,
const axis2_env_t *env)
{
...
}
I don't understand the AXIS2_EXTERN and AXIS2_CALL what are those...
The axis2_get_instance and axis2_remove_instance functions from sample echo
service from AXIS2/C look different:
AXIS2_EXPORT int
axis2_get_instance(axis2_svc_skeleton_t **inst,
const axis2_env_t *env) {
...
}
AXIS2_EXPORT int
axis2_remove_instance(axis2_svc_skeleton_t *inst,
const axis2_env_t *env) {
...
}
I've attached the generated files to this mail.
Could you check them?
Thank you.
Zoli
/**
* axis2_skel_SayHelloService.c
*
* This file was auto-generated from WSDL for
"SayHelloService|http://service.demo" service
* by the Apache Axis2/C version: #axisVersion# #today#
* axis2_skel_SayHelloService Axis2/C skeleton for the axisService
*/
#include "axis2_skel_SayHelloService.h"
/**
* auto generated function definition signature
* for "sayHello|" operation.
*/
axiom_node_t* axis2_skel_SayHelloService_sayHello (const axis2_env_t
*env )
{
/* TODO fill this with the necessary business logic */
return NULL;
}
/**
* axis2_skel_SayHelloService.h
*
* This file was auto-generated from WSDL for
"SayHelloService|http://service.demo" service
* by the Apache Axis2/C version: #axisVersion# #today#
* axis2_skel_SayHelloService Axis2/C skeleton for the axisService- Header
file
*/
#include <axis2_svc_skeleton.h>
#include <axis2_log_default.h>
#include <axis2_error_default.h>
#include <axiom_text.h>
#include <axiom_node.h>
#include <axiom_element.h>
#include <stdio.h>
/**
* auto generated function declaration
* for "sayHello|" operation.
*/
axiom_node_t* axis2_skel_SayHelloService_sayHello (const axis2_env_t
*env );
/**
* axis2_svc_skel_SayHelloService.c
*
* This file was auto-generated from WSDL for
"SayHelloService|http://service.demo" service
* by the Apache Axis2 version: #axisVersion# #today#
* axis2_svc_skel_SayHelloService
*/
#include "axis2_skel_SayHelloService.h"
#include <axis2_svc_skeleton.h>
#include <axis2_array_list.h>
#include <stdio.h>
/**
* functions prototypes
*/
/* On fault, handle the fault */
axiom_node_t* AXIS2_CALL
axis2_svc_skel_SayHelloService_on_fault(axis2_svc_skeleton_t
*svc_skeleton,
const axis2_env_t *env, axiom_node_t *node);
/* Free the service */
int AXIS2_CALL
axis2_svc_skel_SayHelloService_free(axis2_svc_skeleton_t *svc_skeleton,
const axis2_env_t *env);
/* This method invokes the right service method */
axiom_node_t* AXIS2_CALL
axis2_svc_skel_SayHelloService_invoke(axis2_svc_skeleton_t
*svc_skeleton,
const axis2_env_t *env,
axiom_node_t *node,
axis2_msg_ctx_t *msg_ctx);
/* Initializing the environment */
int AXIS2_CALL
axis2_svc_skel_SayHelloService_init(axis2_svc_skeleton_t *svc_skeleton,
const axis2_env_t *env);
/* Create the service */
axis2_svc_skeleton_t* AXIS2_CALL
axis2_svc_skel_SayHelloService_create(const axis2_env_t *env);
/**
* Implementations for the functions
*/
axis2_svc_skeleton_t* AXIS2_CALL
axis2_svc_skel_SayHelloService_create(const axis2_env_t *env)
{
axis2_svc_skeleton_t *svc_skeleton = NULL;
svc_skeleton = AXIS2_MALLOC(env->allocator,
sizeof(axis2_svc_skeleton_t));
svc_skeleton->ops = AXIS2_MALLOC(
env->allocator, sizeof(axis2_svc_skeleton_ops_t));
svc_skeleton->func_array = NULL;
svc_skeleton->ops->free = axis2_svc_skel_SayHelloService_free;
svc_skeleton->ops->init = axis2_svc_skel_SayHelloService_init;
svc_skeleton->ops->invoke = axis2_svc_skel_SayHelloService_invoke;
svc_skeleton->ops->on_fault =
axis2_svc_skel_SayHelloService_on_fault;
return svc_skeleton;
}
int AXIS2_CALL
axis2_svc_skel_SayHelloService_init(axis2_svc_skeleton_t *svc_skeleton,
const axis2_env_t *env)
{
svc_skeleton->func_array = axis2_array_list_create(env, 10);
AXIS2_ARRAY_LIST_ADD(svc_skeleton->func_array, env, "sayHello");
/* Any initialization stuff of axis2_skel_SayHelloService goes here
*/
return AXIS2_SUCCESS;
}
int AXIS2_CALL
axis2_svc_skel_SayHelloService_free(axis2_svc_skeleton_t *svc_skeleton,
const axis2_env_t *env)
{
if(svc_skeleton->func_array)
{
AXIS2_ARRAY_LIST_FREE(svc_skeleton->func_array, env);
svc_skeleton->func_array = NULL;
}
if(svc_skeleton->ops)
{
AXIS2_FREE(env->allocator, svc_skeleton->ops);
svc_skeleton->ops = NULL;
}
if(svc_skeleton)
{
AXIS2_FREE(env->allocator, svc_skeleton);
svc_skeleton = NULL;
}
return AXIS2_SUCCESS;
}
/*
* This method invokes the right service method
*/
axiom_node_t* AXIS2_CALL
axis2_svc_skel_SayHelloService_invoke(axis2_svc_skeleton_t
*svc_skeleton,
const axis2_env_t *env,
axiom_node_t *content_node,
axis2_msg_ctx_t *msg_ctx)
{
/* depending on the function name invoke the
* corresponding method
*/
axiom_element_t *element = NULL;
axiom_node_t *ret_node = NULL;
axiom_node_t* ret_val1;
if (content_node)
{
if (AXIOM_NODE_GET_NODE_TYPE(content_node, env) == AXIOM_ELEMENT)
{
element = (axiom_element_t
*)AXIOM_NODE_GET_DATA_ELEMENT(content_node, env);
if (element)
{
axis2_char_t *op_name = AXIOM_ELEMENT_GET_LOCALNAME(element,
env);
if (op_name)
{
if ( AXIS2_STRCMP(op_name, "sayHello") == 0 )
{
}
}
}
}
}
printf("axis2_svc_skel_SayHelloService service ERROR: invalid OM
parameters in request\n");
return content_node;
}
axiom_node_t* AXIS2_CALL
axis2_svc_skel_SayHelloService_on_fault(axis2_svc_skeleton_t *svc_skeleton,
const axis2_env_t *env, axiom_node_t *node)
{
axiom_node_t *error_node = NULL;
axiom_element_t *error_ele = NULL;
error_ele = axiom_element_create(env, node, "fault", NULL,
&error_node);
AXIOM_ELEMENT_SET_TEXT(error_ele, env,
"SayHelloService|http://service.demo failed",
error_node);
return error_node;
}
/**
* Following block distinguish the exposed part of the dll.
*/
AXIS2_EXTERN int AXIS2_CALL
axis2_get_instance(struct axis2_svc_skeleton **inst,
const axis2_env_t *env)
{
*inst = axis2_svc_skel_SayHelloService_create(env);
if(!(*inst))
{
return AXIS2_FAILURE;
}
return AXIS2_SUCCESS;
}
AXIS2_EXTERN int AXIS2_CALL
axis2_remove_instance(axis2_svc_skeleton_t *inst,
const axis2_env_t *env)
{
axis2_status_t status = AXIS2_FAILURE;
if (inst)
{
status = AXIS2_SVC_SKELETON_FREE(inst, env);
}
return status;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]