You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by Frank Zhou <fc...@yahoo.com> on 2008/03/04 18:50:05 UTC
Problem with proper service client set up?
Hi, All,
I am trying to set up a web service client using
AXIS2/c. I was able to compile the source code and
call APIs in my C++ application. However, it seems
that I made some mistakes in setting up the client
properly, so that when I try to send a request, I
always get NULL response. I debugged the code and it
is clear to me that the request has never been sent
out. The problem is that I AXIS2/ tries to find the
operation from the service client I created with a
given operation name, but I never created the
operation. Here is my API call:
string operation = "TestOrder";
axutil_qname_t * qname = axutil_qname_create(_env,
operation.c_str(), "", ");
axiom_node_t * node =
axis2_svc_client_send_receive_with_op_qname(_wsf_service_client,
_env, qname, payload);
The returned node is all null. And the problem seems
to occur in the file svc_client.c at the following
lines:
op = axis2_svc_get_op_with_qname(svc_client->svc, env,
op_qname);
if (!op)
{
return NULL;
}
How do I create the operation and set it properly in
the service client? I thought by calling the APIs the
opreation is automatically created.
Thanks much in advance.
V.
Here is my code snippet in greater detail:
============================
string action = "job=TestOrder";
string operation = "TestOrder";
const axis2_char_t* endpoint_address =
"http://ss-w-01-xxxx:8088/Data/servlet/webservices?ver=2.0";
const axis2_char_t *client_home =
AXIS2_GETENV("CLIENT_HOME");
axis2_svc_client_t *_wsf_service_client =
axis2_svc_client_create(_env, client_home);
axis2_endpoint_ref_t *endpoint_ref =
axis2_endpoint_ref_create(_env, endpoint_address);
/* Setup options */
axis2_options_t * _options =
axis2_options_create(_env);
axis2_options_set_to(_options, _env, endpoint_ref);
axis2_options_set_soap_version(_options, _env,
AXIOM_SOAP11);
axis2_options_set_enable_rest(_options, _env,
AXIS2_FALSE);
axiom_node_t * payload = root_node;
axis2_status_t status = AXIS2_FAILURE;
if (action != "")
{
if (axis2_options_get_soap_version(_options, _env)
== AXIOM_SOAP11)
{
axutil_string_t * soap_action =
axutil_string_create(_env, action.c_str());
status =
axis2_options_set_soap_action(_options, _env,
soap_action);
axutil_string_free(soap_action, _env);
}
else
{
axutil_qname_t * qname =
axutil_qname_create(_env, AXIS2_MODULE_ADDRESSING,
NULL, NULL);
axis2_bool_t engaged =
axis2_svc_is_module_engaged(axis2_svc_client_get_svc(_wsf_service_client,
_env), _env, qname);
axutil_qname_free(qname, _env);
if (engaged)
{
status =
axis2_options_set_action(_options, _env,
action.c_str());
}
}
}
status =
axis2_svc_client_set_options(_wsf_service_client,
_env, _options);
axiom_node_t * node;
axutil_qname_t * qname = axutil_qname_create(_env,
operation.c_str(), "", NULL);
node =
axis2_svc_client_send_receive_with_op_qname(_wsf_service_client,
_env, qname, payload);
axutil_qname_free(qname, _env);
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org
Re: Problem with proper service client set up?
Posted by Senaka Fernando <se...@wso2.com>.
Hi Frank,
Forgot to mention. Dispatching will consider the namespace of the SOAP
body's first element too in its evaluation if it has no alternative in
locating an operation.
Regards,
Senaka
> Hi Frank,
>
> Since you are using SOAP, the Server will dispatch (recognize the
> service/operation) from the request in the following manner.
>
> 1. Using the request URI,
>
> http://my_host:my_port/axis2/services/my_service/my_operation
>
> Your URI must have the format above. my_port can be optional, and http can
> be tcp and vice versa.
>
> 2. Using the SOAP body.
>
> It assumes that the SOAP body's first element bares the operation name.
>
> 3. Using the SOAP action
>
> Tries to find the operation based on the SOAP action provided.
>
> 4. Using WS-Addressing headers
>
> Uses WS-Addressing headers to do the job if WS-Addressing is enabled.
>
>
> If you use REST instead of SOAP, we have a 5th dispatcher to dispatch a
> RESTful request.
>
> Therefore, you'll have to pay attention to these subcomponents of your
> request. The port I hope is the server port to what you refer, is
> identified by the URI. And, we use Document style only, I believe. Devs,
> please correct me if I missed anything here.
>
> Most of it in Axis2/C should be similar to Axis2/Java as they share the
> same architecture. But, some bits and pieces may vary. However, there are
> changes between Axis/Java and Axis2/Java, so there may be some
> differences.
>
> Regards,
> Senaka
>
>> Hi Senaka,
>>
>> I just tried the API
>> axis2_svc_client_send_receive(_wsf_service_client,_env,
>> payload) and it works. So that means I don't have to
>> set the operation for the client call? How does the
>> server know which operation to perform then?
>>
>> I used axis-j for sometime, I remember that to prepare
>> a client call, I have to set few things to the call
>> object, like the opreation name, the port name, and
>> the soap bindling style (document/literal et cetera).
>> In AXIS2/c service APIs, how does a client set up
>> these things?
>>
>> Thanks again!
>> Frank
>>
>>
>> --- Senaka Fernando <se...@wso2.com> wrote:
>>
>>> Hi Frank,
>>>
>>> We do have several working samples that are shipped
>>> with each distribution
>>> and is also available on the svn head.
>>>
>>> Please check inside the samples directory for an
>>> echo sample. I hope that
>>> might solve your issue.
>>>
>>> If not, you simply can call this method.
>>>
>>> node =
>>> axis2_svc_client_send_receive(_wsf_service_client,
>>> _env, payload);
>>>
>>> And, it should work I believe.
>>>
>>> Regards,
>>> Senaka
>>>
>>> > Hi, All,
>>> >
>>> > I am trying to set up a web service client using
>>> > AXIS2/c. I was able to compile the source code and
>>> > call APIs in my C++ application. However, it seems
>>> > that I made some mistakes in setting up the client
>>> > properly, so that when I try to send a request, I
>>> > always get NULL response. I debugged the code and
>>> it
>>> > is clear to me that the request has never been
>>> sent
>>> > out. The problem is that I AXIS2/ tries to find
>>> the
>>> > operation from the service client I created with a
>>> > given operation name, but I never created the
>>> > operation. Here is my API call:
>>> >
>>> > string operation = "TestOrder";
>>> > axutil_qname_t * qname = axutil_qname_create(_env,
>>> > operation.c_str(), "", ");
>>> > axiom_node_t * node =
>>> >
>>>
>> axis2_svc_client_send_receive_with_op_qname(_wsf_service_client,
>>> > _env, qname, payload);
>>> >
>>> > The returned node is all null. And the problem
>>> seems
>>> > to occur in the file svc_client.c at the following
>>> > lines:
>>> >
>>> > op = axis2_svc_get_op_with_qname(svc_client->svc,
>>> env,
>>> > op_qname);
>>> > if (!op)
>>> > {
>>> > return NULL;
>>> > }
>>> >
>>> > How do I create the operation and set it properly
>>> in
>>> > the service client? I thought by calling the APIs
>>> the
>>> > opreation is automatically created.
>>> >
>>> > Thanks much in advance.
>>> > V.
>>> >
>>> > Here is my code snippet in greater detail:
>>> > ============================
>>> > string action = "job=TestOrder";
>>> > string operation = "TestOrder";
>>> > const axis2_char_t* endpoint_address =
>>> >
>>>
>> "http://ss-w-01-xxxx:8088/Data/servlet/webservices?ver=2.0";
>>> > const axis2_char_t *client_home =
>>> > AXIS2_GETENV("CLIENT_HOME");
>>> >
>>> > axis2_svc_client_t *_wsf_service_client =
>>> > axis2_svc_client_create(_env, client_home);
>>> >
>>> > axis2_endpoint_ref_t *endpoint_ref =
>>> > axis2_endpoint_ref_create(_env, endpoint_address);
>>> > /* Setup options */
>>> > axis2_options_t * _options =
>>> > axis2_options_create(_env);
>>> > axis2_options_set_to(_options, _env,
>>> endpoint_ref);
>>> > axis2_options_set_soap_version(_options, _env,
>>> > AXIOM_SOAP11);
>>> > axis2_options_set_enable_rest(_options, _env,
>>> > AXIS2_FALSE);
>>> > axiom_node_t * payload = root_node;
>>> > axis2_status_t status = AXIS2_FAILURE;
>>> >
>>> > if (action != "")
>>> > {
>>> > if (axis2_options_get_soap_version(_options,
>>> _env)
>>> > == AXIOM_SOAP11)
>>> > {
>>> > axutil_string_t * soap_action =
>>> > axutil_string_create(_env, action.c_str());
>>> > status =
>>> > axis2_options_set_soap_action(_options, _env,
>>> > soap_action);
>>> > axutil_string_free(soap_action, _env);
>>> >
>>> > }
>>> > else
>>> > {
>>> > axutil_qname_t * qname =
>>> > axutil_qname_create(_env, AXIS2_MODULE_ADDRESSING,
>>> > NULL, NULL);
>>> > axis2_bool_t engaged =
>>> >
>>> >
>>>
>> axis2_svc_is_module_engaged(axis2_svc_client_get_svc(_wsf_service_client,
>>> > _env), _env, qname);
>>> > axutil_qname_free(qname, _env);
>>> > if (engaged)
>>> > {
>>> > status =
>>> > axis2_options_set_action(_options, _env,
>>> > action.c_str());
>>> >
>>> > }
>>> > }
>>> > }
>>> >
>>> > status =
>>> > axis2_svc_client_set_options(_wsf_service_client,
>>> > _env, _options);
>>> > axiom_node_t * node;
>>> >
>>> > axutil_qname_t * qname = axutil_qname_create(_env,
>>> > operation.c_str(), "", NULL);
>>> > node =
>>> >
>>>
>> axis2_svc_client_send_receive_with_op_qname(_wsf_service_client,
>>> > _env, qname, payload);
>>> > axutil_qname_free(qname, _env);
>>> >
>>> >
>>> >
>>> >
>>> >
>>>
>> ____________________________________________________________________________________
>>> > Be a better friend, newshound, and
>>> > know-it-all with Yahoo! Mobile. Try it now.
>>> >
>>>
>> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>>> >
>>> >
>>> >
>>>
>> ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail:
>>> axis-c-dev-unsubscribe@ws.apache.org
>>> > For additional commands, e-mail:
>>> axis-c-dev-help@ws.apache.org
>>> >
>>> >
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail:
>>> axis-c-dev-unsubscribe@ws.apache.org
>>> For additional commands, e-mail:
>>> axis-c-dev-help@ws.apache.org
>>>
>>>
>>
>>
>>
>> ____________________________________________________________________________________
>> Be a better friend, newshound, and
>> know-it-all with Yahoo! Mobile. Try it now.
>> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-c-dev-help@ws.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-dev-help@ws.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org
Re: Problem with proper service client set up?
Posted by Senaka Fernando <se...@wso2.com>.
Hi Frank,
Since you are using SOAP, the Server will dispatch (recognize the
service/operation) from the request in the following manner.
1. Using the request URI,
http://my_host:my_port/axis2/services/my_service/my_operation
Your URI must have the format above. my_port can be optional, and http can
be tcp and vice versa.
2. Using the SOAP body.
It assumes that the SOAP body's first element bares the operation name.
3. Using the SOAP action
Tries to find the operation based on the SOAP action provided.
4. Using WS-Addressing headers
Uses WS-Addressing headers to do the job if WS-Addressing is enabled.
If you use REST instead of SOAP, we have a 5th dispatcher to dispatch a
RESTful request.
Therefore, you'll have to pay attention to these subcomponents of your
request. The port I hope is the server port to what you refer, is
identified by the URI. And, we use Document style only, I believe. Devs,
please correct me if I missed anything here.
Most of it in Axis2/C should be similar to Axis2/Java as they share the
same architecture. But, some bits and pieces may vary. However, there are
changes between Axis/Java and Axis2/Java, so there may be some
differences.
Regards,
Senaka
> Hi Senaka,
>
> I just tried the API
> axis2_svc_client_send_receive(_wsf_service_client,_env,
> payload) and it works. So that means I don't have to
> set the operation for the client call? How does the
> server know which operation to perform then?
>
> I used axis-j for sometime, I remember that to prepare
> a client call, I have to set few things to the call
> object, like the opreation name, the port name, and
> the soap bindling style (document/literal et cetera).
> In AXIS2/c service APIs, how does a client set up
> these things?
>
> Thanks again!
> Frank
>
>
> --- Senaka Fernando <se...@wso2.com> wrote:
>
>> Hi Frank,
>>
>> We do have several working samples that are shipped
>> with each distribution
>> and is also available on the svn head.
>>
>> Please check inside the samples directory for an
>> echo sample. I hope that
>> might solve your issue.
>>
>> If not, you simply can call this method.
>>
>> node =
>> axis2_svc_client_send_receive(_wsf_service_client,
>> _env, payload);
>>
>> And, it should work I believe.
>>
>> Regards,
>> Senaka
>>
>> > Hi, All,
>> >
>> > I am trying to set up a web service client using
>> > AXIS2/c. I was able to compile the source code and
>> > call APIs in my C++ application. However, it seems
>> > that I made some mistakes in setting up the client
>> > properly, so that when I try to send a request, I
>> > always get NULL response. I debugged the code and
>> it
>> > is clear to me that the request has never been
>> sent
>> > out. The problem is that I AXIS2/ tries to find
>> the
>> > operation from the service client I created with a
>> > given operation name, but I never created the
>> > operation. Here is my API call:
>> >
>> > string operation = "TestOrder";
>> > axutil_qname_t * qname = axutil_qname_create(_env,
>> > operation.c_str(), "", ");
>> > axiom_node_t * node =
>> >
>>
> axis2_svc_client_send_receive_with_op_qname(_wsf_service_client,
>> > _env, qname, payload);
>> >
>> > The returned node is all null. And the problem
>> seems
>> > to occur in the file svc_client.c at the following
>> > lines:
>> >
>> > op = axis2_svc_get_op_with_qname(svc_client->svc,
>> env,
>> > op_qname);
>> > if (!op)
>> > {
>> > return NULL;
>> > }
>> >
>> > How do I create the operation and set it properly
>> in
>> > the service client? I thought by calling the APIs
>> the
>> > opreation is automatically created.
>> >
>> > Thanks much in advance.
>> > V.
>> >
>> > Here is my code snippet in greater detail:
>> > ============================
>> > string action = "job=TestOrder";
>> > string operation = "TestOrder";
>> > const axis2_char_t* endpoint_address =
>> >
>>
> "http://ss-w-01-xxxx:8088/Data/servlet/webservices?ver=2.0";
>> > const axis2_char_t *client_home =
>> > AXIS2_GETENV("CLIENT_HOME");
>> >
>> > axis2_svc_client_t *_wsf_service_client =
>> > axis2_svc_client_create(_env, client_home);
>> >
>> > axis2_endpoint_ref_t *endpoint_ref =
>> > axis2_endpoint_ref_create(_env, endpoint_address);
>> > /* Setup options */
>> > axis2_options_t * _options =
>> > axis2_options_create(_env);
>> > axis2_options_set_to(_options, _env,
>> endpoint_ref);
>> > axis2_options_set_soap_version(_options, _env,
>> > AXIOM_SOAP11);
>> > axis2_options_set_enable_rest(_options, _env,
>> > AXIS2_FALSE);
>> > axiom_node_t * payload = root_node;
>> > axis2_status_t status = AXIS2_FAILURE;
>> >
>> > if (action != "")
>> > {
>> > if (axis2_options_get_soap_version(_options,
>> _env)
>> > == AXIOM_SOAP11)
>> > {
>> > axutil_string_t * soap_action =
>> > axutil_string_create(_env, action.c_str());
>> > status =
>> > axis2_options_set_soap_action(_options, _env,
>> > soap_action);
>> > axutil_string_free(soap_action, _env);
>> >
>> > }
>> > else
>> > {
>> > axutil_qname_t * qname =
>> > axutil_qname_create(_env, AXIS2_MODULE_ADDRESSING,
>> > NULL, NULL);
>> > axis2_bool_t engaged =
>> >
>> >
>>
> axis2_svc_is_module_engaged(axis2_svc_client_get_svc(_wsf_service_client,
>> > _env), _env, qname);
>> > axutil_qname_free(qname, _env);
>> > if (engaged)
>> > {
>> > status =
>> > axis2_options_set_action(_options, _env,
>> > action.c_str());
>> >
>> > }
>> > }
>> > }
>> >
>> > status =
>> > axis2_svc_client_set_options(_wsf_service_client,
>> > _env, _options);
>> > axiom_node_t * node;
>> >
>> > axutil_qname_t * qname = axutil_qname_create(_env,
>> > operation.c_str(), "", NULL);
>> > node =
>> >
>>
> axis2_svc_client_send_receive_with_op_qname(_wsf_service_client,
>> > _env, qname, payload);
>> > axutil_qname_free(qname, _env);
>> >
>> >
>> >
>> >
>> >
>>
> ____________________________________________________________________________________
>> > Be a better friend, newshound, and
>> > know-it-all with Yahoo! Mobile. Try it now.
>> >
>>
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>> >
>> >
>> >
>>
> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail:
>> axis-c-dev-unsubscribe@ws.apache.org
>> > For additional commands, e-mail:
>> axis-c-dev-help@ws.apache.org
>> >
>> >
>>
>>
>>
> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> axis-c-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail:
>> axis-c-dev-help@ws.apache.org
>>
>>
>
>
>
> ____________________________________________________________________________________
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile. Try it now.
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-dev-help@ws.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org
Re: Problem with proper service client set up?
Posted by Samisa Abeysinghe <sa...@wso2.com>.
Frank Zhou wrote:
> Hi Senaka,
>
> I just tried the API
> axis2_svc_client_send_receive(_wsf_service_client,_env,
> payload) and it works. So that means I don't have to
> set the operation for the client call? How does the
> server know which operation to perform then?
>
The information of what method to call is contained withing the message
sent. There are several mechanisms to pick the operations.
- Using the request URI
- Using SOAP action (when using SOAP 1.1)
- Using SOAP body's first element name
- Using the nsamespace of the SOAP body's first element name
- Using WS-A action
> I used axis-j for sometime, I remember that to prepare
> a client call, I have to set few things to the call
> object, like the opreation name, the port name, and
> the soap bindling style (document/literal et cetera).
> In AXIS2/c service APIs, how does a client set up
> these things?
>
The binding style is determined by the service. So ideally you have to
be using service WSDL to implement the client, in which case, you have
to use the WSDL2C tool to code generate.
The generated code will handle the binding stuff for you.
As far as the service client API is concerned, there is no way to govern
the binding style using options. You have to prepare the payload so
match the binding, if you are not using WSDL2C generated code with ADB
data binding.
Thanks,
Samisa...
--
Samisa Abeysinghe
Software Architect; WSO2 Inc.
http://www.wso2.com/ - "Oxygenating the Web Service Platform."
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org
Re: Problem with proper service client set up?
Posted by Frank Zhou <fc...@yahoo.com>.
Hi Senaka,
I just tried the API
axis2_svc_client_send_receive(_wsf_service_client,_env,
payload) and it works. So that means I don't have to
set the operation for the client call? How does the
server know which operation to perform then?
I used axis-j for sometime, I remember that to prepare
a client call, I have to set few things to the call
object, like the opreation name, the port name, and
the soap bindling style (document/literal et cetera).
In AXIS2/c service APIs, how does a client set up
these things?
Thanks again!
Frank
--- Senaka Fernando <se...@wso2.com> wrote:
> Hi Frank,
>
> We do have several working samples that are shipped
> with each distribution
> and is also available on the svn head.
>
> Please check inside the samples directory for an
> echo sample. I hope that
> might solve your issue.
>
> If not, you simply can call this method.
>
> node =
> axis2_svc_client_send_receive(_wsf_service_client,
> _env, payload);
>
> And, it should work I believe.
>
> Regards,
> Senaka
>
> > Hi, All,
> >
> > I am trying to set up a web service client using
> > AXIS2/c. I was able to compile the source code and
> > call APIs in my C++ application. However, it seems
> > that I made some mistakes in setting up the client
> > properly, so that when I try to send a request, I
> > always get NULL response. I debugged the code and
> it
> > is clear to me that the request has never been
> sent
> > out. The problem is that I AXIS2/ tries to find
> the
> > operation from the service client I created with a
> > given operation name, but I never created the
> > operation. Here is my API call:
> >
> > string operation = "TestOrder";
> > axutil_qname_t * qname = axutil_qname_create(_env,
> > operation.c_str(), "", ");
> > axiom_node_t * node =
> >
>
axis2_svc_client_send_receive_with_op_qname(_wsf_service_client,
> > _env, qname, payload);
> >
> > The returned node is all null. And the problem
> seems
> > to occur in the file svc_client.c at the following
> > lines:
> >
> > op = axis2_svc_get_op_with_qname(svc_client->svc,
> env,
> > op_qname);
> > if (!op)
> > {
> > return NULL;
> > }
> >
> > How do I create the operation and set it properly
> in
> > the service client? I thought by calling the APIs
> the
> > opreation is automatically created.
> >
> > Thanks much in advance.
> > V.
> >
> > Here is my code snippet in greater detail:
> > ============================
> > string action = "job=TestOrder";
> > string operation = "TestOrder";
> > const axis2_char_t* endpoint_address =
> >
>
"http://ss-w-01-xxxx:8088/Data/servlet/webservices?ver=2.0";
> > const axis2_char_t *client_home =
> > AXIS2_GETENV("CLIENT_HOME");
> >
> > axis2_svc_client_t *_wsf_service_client =
> > axis2_svc_client_create(_env, client_home);
> >
> > axis2_endpoint_ref_t *endpoint_ref =
> > axis2_endpoint_ref_create(_env, endpoint_address);
> > /* Setup options */
> > axis2_options_t * _options =
> > axis2_options_create(_env);
> > axis2_options_set_to(_options, _env,
> endpoint_ref);
> > axis2_options_set_soap_version(_options, _env,
> > AXIOM_SOAP11);
> > axis2_options_set_enable_rest(_options, _env,
> > AXIS2_FALSE);
> > axiom_node_t * payload = root_node;
> > axis2_status_t status = AXIS2_FAILURE;
> >
> > if (action != "")
> > {
> > if (axis2_options_get_soap_version(_options,
> _env)
> > == AXIOM_SOAP11)
> > {
> > axutil_string_t * soap_action =
> > axutil_string_create(_env, action.c_str());
> > status =
> > axis2_options_set_soap_action(_options, _env,
> > soap_action);
> > axutil_string_free(soap_action, _env);
> >
> > }
> > else
> > {
> > axutil_qname_t * qname =
> > axutil_qname_create(_env, AXIS2_MODULE_ADDRESSING,
> > NULL, NULL);
> > axis2_bool_t engaged =
> >
> >
>
axis2_svc_is_module_engaged(axis2_svc_client_get_svc(_wsf_service_client,
> > _env), _env, qname);
> > axutil_qname_free(qname, _env);
> > if (engaged)
> > {
> > status =
> > axis2_options_set_action(_options, _env,
> > action.c_str());
> >
> > }
> > }
> > }
> >
> > status =
> > axis2_svc_client_set_options(_wsf_service_client,
> > _env, _options);
> > axiom_node_t * node;
> >
> > axutil_qname_t * qname = axutil_qname_create(_env,
> > operation.c_str(), "", NULL);
> > node =
> >
>
axis2_svc_client_send_receive_with_op_qname(_wsf_service_client,
> > _env, qname, payload);
> > axutil_qname_free(qname, _env);
> >
> >
> >
> >
> >
>
____________________________________________________________________________________
> > Be a better friend, newshound, and
> > know-it-all with Yahoo! Mobile. Try it now.
> >
>
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
> >
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> axis-c-dev-unsubscribe@ws.apache.org
> > For additional commands, e-mail:
> axis-c-dev-help@ws.apache.org
> >
> >
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> axis-c-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail:
> axis-c-dev-help@ws.apache.org
>
>
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org
Re: Problem with proper service client set up?
Posted by Senaka Fernando <se...@wso2.com>.
Hi Frank,
We do have several working samples that are shipped with each distribution
and is also available on the svn head.
Please check inside the samples directory for an echo sample. I hope that
might solve your issue.
If not, you simply can call this method.
node = axis2_svc_client_send_receive(_wsf_service_client, _env, payload);
And, it should work I believe.
Regards,
Senaka
> Hi, All,
>
> I am trying to set up a web service client using
> AXIS2/c. I was able to compile the source code and
> call APIs in my C++ application. However, it seems
> that I made some mistakes in setting up the client
> properly, so that when I try to send a request, I
> always get NULL response. I debugged the code and it
> is clear to me that the request has never been sent
> out. The problem is that I AXIS2/ tries to find the
> operation from the service client I created with a
> given operation name, but I never created the
> operation. Here is my API call:
>
> string operation = "TestOrder";
> axutil_qname_t * qname = axutil_qname_create(_env,
> operation.c_str(), "", ");
> axiom_node_t * node =
> axis2_svc_client_send_receive_with_op_qname(_wsf_service_client,
> _env, qname, payload);
>
> The returned node is all null. And the problem seems
> to occur in the file svc_client.c at the following
> lines:
>
> op = axis2_svc_get_op_with_qname(svc_client->svc, env,
> op_qname);
> if (!op)
> {
> return NULL;
> }
>
> How do I create the operation and set it properly in
> the service client? I thought by calling the APIs the
> opreation is automatically created.
>
> Thanks much in advance.
> V.
>
> Here is my code snippet in greater detail:
> ============================
> string action = "job=TestOrder";
> string operation = "TestOrder";
> const axis2_char_t* endpoint_address =
> "http://ss-w-01-xxxx:8088/Data/servlet/webservices?ver=2.0";
> const axis2_char_t *client_home =
> AXIS2_GETENV("CLIENT_HOME");
>
> axis2_svc_client_t *_wsf_service_client =
> axis2_svc_client_create(_env, client_home);
>
> axis2_endpoint_ref_t *endpoint_ref =
> axis2_endpoint_ref_create(_env, endpoint_address);
> /* Setup options */
> axis2_options_t * _options =
> axis2_options_create(_env);
> axis2_options_set_to(_options, _env, endpoint_ref);
> axis2_options_set_soap_version(_options, _env,
> AXIOM_SOAP11);
> axis2_options_set_enable_rest(_options, _env,
> AXIS2_FALSE);
> axiom_node_t * payload = root_node;
> axis2_status_t status = AXIS2_FAILURE;
>
> if (action != "")
> {
> if (axis2_options_get_soap_version(_options, _env)
> == AXIOM_SOAP11)
> {
> axutil_string_t * soap_action =
> axutil_string_create(_env, action.c_str());
> status =
> axis2_options_set_soap_action(_options, _env,
> soap_action);
> axutil_string_free(soap_action, _env);
>
> }
> else
> {
> axutil_qname_t * qname =
> axutil_qname_create(_env, AXIS2_MODULE_ADDRESSING,
> NULL, NULL);
> axis2_bool_t engaged =
>
> axis2_svc_is_module_engaged(axis2_svc_client_get_svc(_wsf_service_client,
> _env), _env, qname);
> axutil_qname_free(qname, _env);
> if (engaged)
> {
> status =
> axis2_options_set_action(_options, _env,
> action.c_str());
>
> }
> }
> }
>
> status =
> axis2_svc_client_set_options(_wsf_service_client,
> _env, _options);
> axiom_node_t * node;
>
> axutil_qname_t * qname = axutil_qname_create(_env,
> operation.c_str(), "", NULL);
> node =
> axis2_svc_client_send_receive_with_op_qname(_wsf_service_client,
> _env, qname, payload);
> axutil_qname_free(qname, _env);
>
>
>
>
> ____________________________________________________________________________________
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile. Try it now.
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-dev-help@ws.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org