You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by zack Hasit <za...@gmail.com> on 2013/02/19 02:44:32 UTC

Axis 2C embedded server

Hi, I am planning to use Axis 2C. Could someone please help answer this.

1. Is the standalone http server (simple http server) good for production
situation? I ask because it maybe for for testing purposes only. Any
performance concerns with it ?

2. Is Axis being maintained actively ? I ask because there hasn't been a
new release since 2009 ?

3. I need to break request and response in two separate functions. Is that
possible. In samples I see echo implementation where one method implements
service and returns the node to send response. I don't want to send
response on return but at a later time after I do do some other processing
aynchronously. Is there any sample for that ?

Please let me know if there is another place to ask this.

Thanks

Want Axis 2C embedded http server to return text/html

Posted by Thomas Gentsch <tg...@e-tge.de>.
Hi all,

still experimenting, but I wanted to use the simple HTTP server to run a
service that produces direct HTML, so I can call that service directly
from a web browser.

I tried to do this using REST, however any other way is fine too, just
that I want to have simple URLs in the browser.

I used the hello_svc example but had to make a few essential changes
(see below) - now I wanted to check whether there are either better
ideas or input in case my solution is not such a good idea (either by
concept or technically).

Many thx in advance!!
  tge

Steps (this is with Axis2c 1.6.0):
1) have the simple http server set up and running
2) build and deploy the hello service from docs/docs
3) Use a web browser and access 
  http://localhost:9090/axis2/services/hello/greet?name=tge
(I found that somewhere on the web)
This does not work at all, no matter what parameters I supply, I always
get:
  "The requested URL was not found on this server."
After reviewing other examples, I saw that the services.xml must contain
a section like this:
 <operation name="greetFunc">
  <parameter name="RESTMethod">GET</parameter>
  <parameter name="RESTLocation">greet</parameter>
 </operation>
With this and the URL above it still does not work though

4) After finally putting in some debug output in axis2_hello_greet(), I
saw that the passed in OM nodes are structured like this:
  <greetFunc><name>tge</name><name>tge</name></greetFunc>
i.e. ALWAYS there is a two-level node structure whereas the hello_svc
expects the text directly at the top-level node.
So I put into axis2_hello_greet() this:
=====
if (client_greeting_node &&
    axiom_node_get_node_type(client_greeting_node, env) ==
AXIOM_ELEMENT)
{
  client_greeting_node =
axiom_node_get_first_child(client_greeting_node, env);
}
=====
Side-question: Why does the <name> tag exist twice? Probably a bug ...

5) Now I get a response in the web browser but it says that the XML does
not contain formatting.
Then I built a OM structure in axis2_hello_greet() that resembles
primitive HTML like that:
<html><head><title>Trallala</title></head><body>Hello
Client!</body></html>

6) Still I get that result in the browser but browser still complains
about missing formatting. I found that this is because Content-Type is
"text/xml" and the challenge was to get that changed to
"text/html" (after succeeding, it works). I read a lot through the code
and discovered in http_sender.c this:
===
content_type_property = (axutil_property_t *)
                axis2_msg_ctx_get_property (msg_ctx, env,
 AXIS2_USER_DEFINED_HTTP_HEADER_CONTENT_TYPE);
[...]
===
So I set that in hello_invoke():
===
hello_invoke(
    axis2_svc_skeleton_t * svc_skeleton,
    const axutil_env_t * env,
    axiom_node_t * node,
    axis2_msg_ctx_t * msg_ctx)
{
/* TGE 
  return axis2_hello_greet(env, node);
*/
  axiom_node_t * resp = axis2_hello_greet(env, node);

  axutil_property_t * prop = axutil_property_create(env);
  if(prop)
  {
    axutil_hash_t * hash = (axutil_hash_t *) axutil_hash_make(env);
    if(hash)
    {
      axutil_hash_set(hash, AXIS2_HTTP_HEADER_CONTENT_TYPE,
AXIS2_HASH_KEY_STRING,
                      axutil_strdup(env,
AXIS2_HTTP_HEADER_ACCEPT_TEXT_HTML));
      axutil_property_set_value(prop, env, hash);
      axis2_msg_ctx_set_property(msg_ctx, env,
AXIS2_USER_DEFINED_HTTP_HEADER_CONTENT_TYPE, prop);
    }
  }

  return resp;
===

7) Still no success. After some debugging I found that the code in
http_sender.c is actually not used by the HTTP server when responding,
but rather axis2_http_transport_sender_invoke() in
http_transport_sender.c. Here finally the content-type gets set
hardcoded to either "text/xml" or "application/soap+xml".
Now I added the code from above (with
AXIS2_USER_DEFINED_HTTP_HEADER_CONTENT_TYPE) to
axis2_http_transport_sender_invoke() and finally it worked as expected.

================================================

Now, the questions:

a) Is there an easier/nicer way? I used REST because I found the example
about calling the service using that fairly simple URL in the browser,
but maybe there is another way? On the server side can change my service
as I like
b) If there is no better way, are there any design objections?
c) If no, I'd submit the changed http_transport_sender.c as patch

Many thx + regards,
  tge


---------------------------------------------------------------------
To unsubscribe, e-mail: c-user-unsubscribe@axis.apache.org
For additional commands, e-mail: c-user-help@axis.apache.org


AW: Axis 2C embedded server

Posted by Stadelmann Josef <jo...@axa-winterthur.ch>.
In this case just download the axis2/C kit and build axis2C, then use a
debugger and debug the axis2c_engine.

Very interesting when it starts up; go once through and you will
understand axis much better. i.e. see when things

take place and how they come into effect.

Look for a directory IDES and find various VC VC6 VC9 Projects prepared
as well as a Makefile project for your OS.

 

But just be made aware, also it is documented on many places; the simple
servers axis2/J and axis2/C are not for production!

 

Josef

 

 

 

Von: zack Hasit [mailto:zackhasit@gmail.com] 
Gesendet: Donnerstag, 21. Februar 2013 01:48
An: Apache AXIS C User List
Betreff: Re: Axis 2C embedded server

 

Hi,

   How can I get more information on Inbuilt HTTP server called simple
axis server. I am trying to find out about its architecture. I need to
understand how threads are created and deleted (does it have a thread
pool with max and min threads which are instantiated at start-up ?) and
if its scalable. Word "simple" is making me think there could be
limitations for its use in production scenario ?

Thanks

 

On Wed, Feb 20, 2013 at 10:41 AM, Stadelmann Josef
<jo...@axa-winterthur.ch> wrote:

It is possible using addressing and the proper addressing header
information and configuration records both at client and at server.

 

i.e. in the header you need to tell the service which client is calling
(request-id) and about the listener/port to contact as well as the
call-back-routine to be called.

 

The server once finished needs to know to which request-id this
response-id belongs to; but that is not all. it needs to know
clinet-host:port and client-call-back-routine processing the response.

 

It is not so simple; hence I encourage you to go through the various
echo examples AND OTHERS, client and server side, unless you understand
the asynchronous technology field. Keep in mind you might have an
asynchronous working transport AND you may have an asynchronous working
client/server. This is not the same.

 

your client might send a request, the server receives it, and allows the
thread to return before it starts working

 

your client may hand over a request to the transport and continue, the
transport sends the request, the server accepts it and allows the thread
to return, the transport at the client side is happy and maybe signals
that o the client. Later on the server does the same with the response
in reverse direction.

 

This are two scenarios with many wrinkle and challenge to master.

 

basically, the service, when it has the result ready after some time,
needs to know the host:port numbers and a call-back-routine in the
client to contact; 

and there is a need to know for the infrastructure axis2-engine to which
request this response belongs to, given your client has multiple
outstanding request belonging to request sent some time ago.

 

Again: starts simple, keep subsystems small, test it, and integrate when
all subsystems works.

 

Unless you master your asynchronously working axis2 client talking to
your asynchronous working web service, you don't need more than one
later 2 pc's, and yes: long lasting sessions might be another issue to
look at.

 

Josef

 

 

Von: zack Hasit [mailto:zackhasit@gmail.com] 
Gesendet: Dienstag, 19. Februar 2013 18:23
An: Apache AXIS C User List
Betreff: Re: Axis 2C embedded server

 

Hi,

I looked at "echo_non_blocking_dual.c". It is a client implementation to
call the service. I was looking for server side. Ill try to explain the
scenario....

When the echo service gets called following function gets called on
server side : axis2_echo_echo. In this function the node "axiom_node_t
*ret_node" is returned. What I really want to do is that I want to
modify axis2_echo_echo to send the text message (with additional header
info) to another server (lets call this server SERVER-A) using activeMQ
and then go and service next echo request from client and forget about
this one for now.

Meanwhile I'll spawn another thread  (in my application) to read
responses from SERVER-A asynchronously (via activeMQ). Since responses
would be out of order ill identify them based on headerinfo and ill know
where this response needs to be sent to. I want to then send this to
correct client.

Please let me know if this is possible.

 

On Tue, Feb 19, 2013 at 4:47 AM, Stadelmann Josef
<jo...@axa-winterthur.ch> wrote:

seek this file in your axis2/c kit "echo_non_blocking_dual.c"

not under samples but user guide clients ... J

 

And Axis2/C is at version 1.6.0, and the trunk sources have entries from
January 2013, so there is work going on.

i.e.
http://svn.apache.org/repos/asf/axis/axis2/c/core/trunk/src/core/transpo
rt/http is brand new.

 

Josef

 

Von: zack Hasit [mailto:zackhasit@gmail.com] 
Gesendet: Dienstag, 19. Februar 2013 02:45
An: c-user@axis.apache.org
Betreff: Axis 2C embedded server

 

 

Hi, I am planning to use Axis 2C. Could someone please help answer this.

1. Is the standalone http server (simple http server) good for
production situation? I ask because it maybe for for testing purposes
only. Any performance concerns with it ?

2. Is Axis being maintained actively ? I ask because there hasn't been a
new release since 2009 ?

3. I need to break request and response in two separate functions. Is
that possible. In samples I see echo implementation where one method
implements service and returns the node to send response. I don't want
to send response on return but at a later time after I do do some other
processing aynchronously. Is there any sample for that ?

Please let me know if there is another place to ask this.

 

Thanks

 

 

 


Re: Axis 2C embedded server

Posted by zack Hasit <za...@gmail.com>.
Hi,

   How can I get more information on Inbuilt HTTP server called simple axis
server. I am trying to find out about its architecture. I need to
understand how threads are created and deleted (does it have a thread pool
with max and min threads which are instantiated at start-up ?) and if its
scalable. Word "simple" is making me think there could be limitations for
its use in production scenario ?

Thanks


On Wed, Feb 20, 2013 at 10:41 AM, Stadelmann Josef <
josef.stadelmann@axa-winterthur.ch> wrote:

> It is possible using addressing and the proper addressing header
> information and configuration records both at client and at server.****
>
> ** **
>
> i.e. in the header you need to tell the service which client is calling
> (request-id) and about the listener/port to contact as well as the
> call-back-routine to be called.****
>
> ** **
>
> The server once finished needs to know to which request-id this
> response-id belongs to; but that is not all. it needs to know
> clinet-host:port and client-call-back-routine processing the response.****
>
> ** **
>
> It is not so simple; hence I encourage you to go through the various echo
> examples AND OTHERS, client and server side, unless you understand the
> asynchronous technology field. Keep in mind you might have an asynchronous
> working transport AND you may have an asynchronous working client/server.
> This is not the same.****
>
> ** **
>
> your client might send a request, the server receives it, and allows the
> thread to return before it starts working****
>
> ** **
>
> your client may hand over a request to the transport and continue, the
> transport sends the request, the server accepts it and allows the thread to
> return, the transport at the client side is happy and maybe signals that o
> the client. Later on the server does the same with the response in reverse
> direction.****
>
> ** **
>
> This are two scenarios with many wrinkle and challenge to master.****
>
> ** **
>
> basically, the service, when it has the result ready after some time,
> needs to know the host:port numbers and a call-back-routine in the client
> to contact; ****
>
> and there is a need to know for the infrastructure axis2-engine to which
> request this response belongs to, given your client has multiple
> outstanding request belonging to request sent some time ago.****
>
> ** **
>
> Again: starts simple, keep subsystems small, test it, and integrate when
> all subsystems works.****
>
> ** **
>
> Unless you master your asynchronously working axis2 client talking to your
> asynchronous working web service, you don’t need more than one later 2
> pc's, and yes: long lasting sessions might be another issue to look at.***
> *
>
> ** **
>
> Josef****
>
> ** **
>
> ** **
>
> *Von:* zack Hasit [mailto:zackhasit@gmail.com]
> *Gesendet:* Dienstag, 19. Februar 2013 18:23
> *An:* Apache AXIS C User List
> *Betreff:* Re: Axis 2C embedded server****
>
> ** **
>
> Hi,
>
> ****
>
> I looked at "echo_non_blocking_dual.c". It is a client implementation to
> call the service. I was looking for server side. Ill try to explain the
> scenario....****
>
> When the echo service gets called following function gets called on server
> side : axis2_echo_echo. In this function the node "axiom_node_t *ret_node"
> is returned. What I really want to do is that I want to modify
> axis2_echo_echo to send the text message (with additional header info) to
> another server (lets call this server SERVER-A) using activeMQ and then go
> and service next echo request from client and forget about this one for now.
> ****
>
> Meanwhile I'll spawn another thread  (in my application) to read responses
> from SERVER-A asynchronously (via activeMQ). Since responses would be out
> of order ill identify them based on headerinfo and ill know where this
> response needs to be sent to. I want to then send this to correct client.*
> ***
>
> Please let me know if this is possible.****
>
> ** **
>
> On Tue, Feb 19, 2013 at 4:47 AM, Stadelmann Josef <
> josef.stadelmann@axa-winterthur.ch> wrote:****
>
> seek this file in your axis2/c kit "echo_non_blocking_dual.c"****
>
> not under samples but user guide clients … J****
>
>  ****
>
> And Axis2/C is at version 1.6.0, and the trunk sources have entries from
> January 2013, so there is work going on.****
>
> i.e.
> http://svn.apache.org/repos/asf/axis/axis2/c/core/trunk/src/core/transport/httpis brand new.
> ****
>
>  ****
>
> Josef****
>
>  ****
>
> *Von:* zack Hasit [mailto:zackhasit@gmail.com]
> *Gesendet:* Dienstag, 19. Februar 2013 02:45
> *An:* c-user@axis.apache.org
> *Betreff:* Axis 2C embedded server****
>
>  ****
>
>  ****
>
> Hi, I am planning to use Axis 2C. Could someone please help answer this.**
> **
>
> 1. Is the standalone http server (simple http server) good for production
> situation? I ask because it maybe for for testing purposes only. Any
> performance concerns with it ?****
>
> 2. Is Axis being maintained actively ? I ask because there hasn't been a
> new release since 2009 ?****
>
> 3. I need to break request and response in two separate functions. Is that
> possible. In samples I see echo implementation where one method implements
> service and returns the node to send response. I don't want to send
> response on return but at a later time after I do do some other processing
> aynchronously. Is there any sample for that ?****
>
> Please let me know if there is another place to ask this.****
>
>  ****
>
> Thanks****
>
>  ****
>
> ** **
>

AW: Axis 2C embedded server

Posted by Stadelmann Josef <jo...@axa-winterthur.ch>.
It is possible using addressing and the proper addressing header
information and configuration records both at client and at server.

 

i.e. in the header you need to tell the service which client is calling
(request-id) and about the listener/port to contact as well as the
call-back-routine to be called.

 

The server once finished needs to know to which request-id this
response-id belongs to; but that is not all. it needs to know
clinet-host:port and client-call-back-routine processing the response.

 

It is not so simple; hence I encourage you to go through the various
echo examples AND OTHERS, client and server side, unless you understand
the asynchronous technology field. Keep in mind you might have an
asynchronous working transport AND you may have an asynchronous working
client/server. This is not the same.

 

your client might send a request, the server receives it, and allows the
thread to return before it starts working

 

your client may hand over a request to the transport and continue, the
transport sends the request, the server accepts it and allows the thread
to return, the transport at the client side is happy and maybe signals
that o the client. Later on the server does the same with the response
in reverse direction.

 

This are two scenarios with many wrinkle and challenge to master.

 

basically, the service, when it has the result ready after some time,
needs to know the host:port numbers and a call-back-routine in the
client to contact; 

and there is a need to know for the infrastructure axis2-engine to which
request this response belongs to, given your client has multiple
outstanding request belonging to request sent some time ago.

 

Again: starts simple, keep subsystems small, test it, and integrate when
all subsystems works.

 

Unless you master your asynchronously working axis2 client talking to
your asynchronous working web service, you don't need more than one
later 2 pc's, and yes: long lasting sessions might be another issue to
look at.

 

Josef

 

 

Von: zack Hasit [mailto:zackhasit@gmail.com] 
Gesendet: Dienstag, 19. Februar 2013 18:23
An: Apache AXIS C User List
Betreff: Re: Axis 2C embedded server

 

Hi,



I looked at "echo_non_blocking_dual.c". It is a client implementation to
call the service. I was looking for server side. Ill try to explain the
scenario....

When the echo service gets called following function gets called on
server side : axis2_echo_echo. In this function the node "axiom_node_t
*ret_node" is returned. What I really want to do is that I want to
modify axis2_echo_echo to send the text message (with additional header
info) to another server (lets call this server SERVER-A) using activeMQ
and then go and service next echo request from client and forget about
this one for now.

Meanwhile I'll spawn another thread  (in my application) to read
responses from SERVER-A asynchronously (via activeMQ). Since responses
would be out of order ill identify them based on headerinfo and ill know
where this response needs to be sent to. I want to then send this to
correct client.

Please let me know if this is possible.

 

On Tue, Feb 19, 2013 at 4:47 AM, Stadelmann Josef
<jo...@axa-winterthur.ch> wrote:

seek this file in your axis2/c kit "echo_non_blocking_dual.c"

not under samples but user guide clients ... J

 

And Axis2/C is at version 1.6.0, and the trunk sources have entries from
January 2013, so there is work going on.

i.e.
http://svn.apache.org/repos/asf/axis/axis2/c/core/trunk/src/core/transpo
rt/http is brand new.

 

Josef

 

Von: zack Hasit [mailto:zackhasit@gmail.com] 
Gesendet: Dienstag, 19. Februar 2013 02:45
An: c-user@axis.apache.org
Betreff: Axis 2C embedded server

 

 

Hi, I am planning to use Axis 2C. Could someone please help answer this.

1. Is the standalone http server (simple http server) good for
production situation? I ask because it maybe for for testing purposes
only. Any performance concerns with it ?

2. Is Axis being maintained actively ? I ask because there hasn't been a
new release since 2009 ?

3. I need to break request and response in two separate functions. Is
that possible. In samples I see echo implementation where one method
implements service and returns the node to send response. I don't want
to send response on return but at a later time after I do do some other
processing aynchronously. Is there any sample for that ?

Please let me know if there is another place to ask this.

 

Thanks

 

 


Re: Axis 2C embedded server

Posted by zack Hasit <za...@gmail.com>.
Hi,


I looked at "echo_non_blocking_dual.c". It is a client implementation to
call the service. I was looking for server side. Ill try to explain the
scenario....

When the echo service gets called following function gets called on server
side : axis2_echo_echo. In this function the node "axiom_node_t *ret_node"
is returned. What I really want to do is that I want to modify
axis2_echo_echo to send the text message (with additional header info) to
another server (lets call this server SERVER-A) using activeMQ and then go
and service next echo request from client and forget about this one for now.

Meanwhile I'll spawn another thread  (in my application) to read responses
from SERVER-A asynchronously (via activeMQ). Since responses would be out
of order ill identify them based on headerinfo and ill know where this
response needs to be sent to. I want to then send this to correct client.

Please let me know if this is possible.


On Tue, Feb 19, 2013 at 4:47 AM, Stadelmann Josef <
josef.stadelmann@axa-winterthur.ch> wrote:

> seek this file in your axis2/c kit "echo_non_blocking_dual.c"****
>
> not under samples but user guide clients … J****
>
> ** **
>
> And Axis2/C is at version 1.6.0, and the trunk sources have entries from
> January 2013, so there is work going on.****
>
> i.e.
> http://svn.apache.org/repos/asf/axis/axis2/c/core/trunk/src/core/transport/httpis brand new.
> ****
>
> ** **
>
> Josef****
>
> ** **
>
> *Von:* zack Hasit [mailto:zackhasit@gmail.com]
> *Gesendet:* Dienstag, 19. Februar 2013 02:45
> *An:* c-user@axis.apache.org
> *Betreff:* Axis 2C embedded server****
>
> ** **
>
> ** **
>
> Hi, I am planning to use Axis 2C. Could someone please help answer this.**
> **
>
> 1. Is the standalone http server (simple http server) good for production
> situation? I ask because it maybe for for testing purposes only. Any
> performance concerns with it ?****
>
> 2. Is Axis being maintained actively ? I ask because there hasn't been a
> new release since 2009 ?****
>
> 3. I need to break request and response in two separate functions. Is that
> possible. In samples I see echo implementation where one method implements
> service and returns the node to send response. I don't want to send
> response on return but at a later time after I do do some other processing
> aynchronously. Is there any sample for that ?****
>
> Please let me know if there is another place to ask this.****
>
> ** **
>
> Thanks****
>
> ** **
>

AW: Axis 2C embedded server

Posted by Stadelmann Josef <jo...@axa-winterthur.ch>.
seek this file in your axis2/c kit "echo_non_blocking_dual.c"

not under samples but user guide clients ... J

 

And Axis2/C is at version 1.6.0, and the trunk sources have entries from
January 2013, so there is work going on.

i.e.
http://svn.apache.org/repos/asf/axis/axis2/c/core/trunk/src/core/transpo
rt/http is brand new.

 

Josef

 

Von: zack Hasit [mailto:zackhasit@gmail.com] 
Gesendet: Dienstag, 19. Februar 2013 02:45
An: c-user@axis.apache.org
Betreff: Axis 2C embedded server

 

 

Hi, I am planning to use Axis 2C. Could someone please help answer this.

1. Is the standalone http server (simple http server) good for
production situation? I ask because it maybe for for testing purposes
only. Any performance concerns with it ?

2. Is Axis being maintained actively ? I ask because there hasn't been a
new release since 2009 ?

3. I need to break request and response in two separate functions. Is
that possible. In samples I see echo implementation where one method
implements service and returns the node to send response. I don't want
to send response on return but at a later time after I do do some other
processing aynchronously. Is there any sample for that ?

Please let me know if there is another place to ask this.

 

Thanks