Hi,
I am trying to write a very simple client (my first axis2c test) for a
calculator web service which is available out there. The code I have
written is very similar to the simplest tutorial I have found in the
AXIS2C documentation.
When I invoke a operation of this service, I get the following response:
Received OM : <soap:Fault
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
><Code><Value>soap:Client</Value></Code><Reason><Text>Server found
request conte
nt type to be 'multipart/related;
boundary=MIMEBoundary6d70feb7-0ba6-4aba-b4c2-4
0d46b0f8e08; type=&quot;application/xop+xml&quot;;
start=&quot;&
lt;[EMAIL PROTECTED]&gt;&quot;;
start-in
fo=&quot;text/xml&quot;; charset=&quot;UTF-8&quot;', but
expecte
d 'text/xml'.</Text></Reason><detail></detail></soap:Fault>
I have read the documentation but I have not found a way to change the
content type of the http request to be "text/xml".
Could you please tell me how can I specify http_transport options?
Many thanks in advance,
jms.
P.S.: Bellow you can see the sample code I've written:
void axis_direct_test()
{
const axis2_char_t *address = NULL;
axis2_endpoint_ref_t* endpoint_ref = NULL;
axis2_options_t *options = NULL;
const axis2_env_t *env = NULL;
const axis2_char_t *client_home = NULL;
axis2_svc_client_t* svc_client = NULL;
axiom_node_t *payload = NULL;
axiom_node_t *ret_node = NULL;
env = axis2_env_create_all("wsclient.log", AXIS2_LOG_LEVEL_TRACE);
address = "http://www.dneonline.com/calculator.asmx";
/* Create EPR with given address */
endpoint_ref = axis2_endpoint_ref_create(env, address);
/* Setup options */
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_ACTION(options, env,
"http://tempuri.org/Add");
client_home = AXIS2_GETENV("AXIS2C_HOME");
if (!client_home)
client_home = "c:/axis";
/* Create service client */
svc_client = axis2_svc_client_create(env, client_home);
if (!svc_client)
{
printf("Error creating service client\n");
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Stub invoke FAILED:
Error code:"
" %d :: %s", env->error->error_number,
AXIS2_ERROR_GET_MESSAGE(env->error));
}
/* Set service client options */
AXIS2_SVC_CLIENT_SET_OPTIONS(svc_client, env, options);
/* Engage addressing module */
AXIS2_SVC_CLIENT_ENGAGE_MODULE(svc_client, env,
AXIS2_MODULE_ADDRESSING);
/* Build the SOAP request message payload using OM API.*/
payload = build_om_payload_for_calculator_svc(env);
/* Send request */
ret_node = AXIS2_SVC_CLIENT_SEND_RECEIVE(svc_client, env, payload);
axis2_char_t *om_str = NULL;
om_str = AXIOM_NODE_TO_STRING(ret_node, env);
if (om_str)
printf("\nReceived OM : %s\n", om_str);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]