Hello,
I have a question regarding how to properly interact with the code
generated by WSDL2C. The problem I am running into occurs when I try to
execute two different web service operations in succession. I am
developing under WinXP. My code looks something like the following:
01 env = axutil_env_create_all( "myLogFile.log",
02 AXIS2_LOG_LEVEL_TRACE);
03
04 stub = axis2_stub_AvnEsbService_create( env,
05
AXIS2_GETENV("AXIS2C_HOME"),
06
"http://mytestserver:8080/MyService");
07
08 axis2_stub_MyServer_FirstOperation_start( stub,
09 env,
10 opBodyNode,
11 opCustomHeaderNode1,
12 opCustomHeaderNode2,
13 opCustomHeaderNode3
14
onFirstOperationResponseCb,
15
onFirstOperationErrorCb);
16
17 axis2_stub_MyServer_SecondOperation_start( stub,
18 env,
19 opBodyNode,
20 opCustomHeaderNode1,
21 opCustomHeaderNode2,
22 opCustomHeaderNode3
23
onSecondOperationResponseCb,
24
onSecondOperationErrorCb);
The area in the WSDL2C-generated code where things seem a bit sinister
is within the call to "axis2_stub_MyServer_SecondOperation_start" on
line 60:
25 void axis2_stub_MyServer_SecondOperation_start(
26 const axis2_stub_t *stub,
27 const axutil_env_t *env,
28 axiom_node_t* opBodyNode,
29 axiom_node_t* opCustomHeaderNode1,
30 axiom_node_t* opCustomHeadernode2,
31 axiom_node_t* opCustomHeaderNode3,
32 axis2_status_t ( AXIS2_CALL *on_complete ) (struct
axis2_callback *, const axutil_env_t *) ,
33 axis2_status_t ( AXIS2_CALL *on_error ) (struct axis2_callback
*, const axutil_env_t *, int ) )
34 {
35
36 axis2_callback_t *callback = NULL;
37
38 axis2_svc_client_t *svc_client = NULL;
39 axis2_options_t *options = NULL;
40
41 const axis2_char_t *soap_action = NULL;
42 axiom_node_t *payload = NULL;
43
44
45 axutil_string_t *soap_act = NULL;
46 axis2_status_t status;
47
48 payload = opBodyNode;
49
50 options = axis2_stub_get_options( stub, env);
51 if ( NULL == options )
52 {
53 AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "options is null
in stub: Error code:"
54 " %d :: %s", env->error->error_number,
55 AXIS2_ERROR_GET_MESSAGE(env->error));
56 return;
57 }
58 svc_client = axis2_stub_get_svc_client (stub, env );
59 soap_action =axis2_options_get_action ( options, env );
60 if ( NULL == soap_action )
61 {
62 soap_action =
"http://www.mydeployedserver.com/services/SecondOperation";
63
64 soap_act = axutil_string_create(env,
"http://www.mydeployedserver.com/services/SecondOperation");
65 axis2_options_set_soap_action(options, env, soap_act);
66
67 axis2_options_set_action( options, env, soap_action );
68 }
69
70 axis2_options_set_soap_version(options, env, AXIOM_SOAP11 );
71
72 /***************************************************/
73 /* START NON-AUTOGEN CODE - add our custom headers */
74 /***************************************************/
75
76 status =
axis2_svc_client_add_header(svc_client,env,opCustomHeaderNode1);
77 assert(AXIS2_SUCCESS == status);
78
79 status =
axis2_svc_client_add_header(svc_client,env,opCustomHeaderNode2);
80 assert(AXIS2_SUCCESS == status);
81
82 status =
axis2_svc_client_add_header(svc_client,env,opCustomHeaderNode3);
83 assert(AXIS2_SUCCESS == status);
84
85 /************************/
86 /* END NON_AUTOGEN CODE */
87 /************************/
88
89 callback = axis2_callback_create(env);
90 /* Set our on_complete fucntion pointer to the callback object
*/
91 axis2_callback_set_on_complete(callback, on_complete);
92 /* Set our on_error function pointer to the callback object */
93 axis2_callback_set_on_error(callback, on_error);
94
95 /* Send request */
96 axis2_svc_client_send_receive_non_blocking(svc_client, env,
payload, callback);
97 }
On line 60, "soap_action" is not NULL (which it was for the call to
"FirstOperation"), and it contains the value from the previous call to
"FirstOperation", ie
"http://www.mydeployedserver.com/services/FirstOperation", which of
course make sense, but I get an access violation later in the function
(from within the call stack of
"axis2_svc_client_send_receive_non_blocking"). My question is, is there
some kind of 'housekeeping' I need to do in between calls to different
operations? I have tried setting "soap_action" to NULL using
"axis2_stub_get_options" and "axis2_options_set_action" after the call
to "axis2_stub_MyServer_FirstOperation_start", but this seems to cause
similar problems.
Cheers,
Cliff
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]