Title: Standalone axis

Close to what I was doing. All I am doing in the class is configuring the runtime, then using the JMSListener class as my “server” (it uses the thread pool from Doug Lea’s lib to handle incoming requests). You do not actually need to create the service yourself. The Axis runtime will do that for you. It helps to look at the code for JMSListener…it explains a lot. Regardless of whether you use it standalone or inside of an HTTP server, it is basically the same thing happening since the JMSListener and JMSSender classes handle all the transport in and out in either case.

 

Remember, you have to have a certain directory structure for Axis 2 (which I just copy from the axis2.war), like

 

config

n       axis2.xml

repository

n       modules

-- modules.listing

-- *.mar files

n       services

-- services.listing

-- *.aar

 

So I deploy my actual .aar service file under the /services folder after doing the code generation, modifying the generated code, then using the generated Ant build.xml file to create the .aar and other artifacts. You should also place the standard addressing.mar under modules, and any other modules you are using.

 

Of course, I am assuming that you have already made the appropriate modifications to your axis2.xml and services.xml (in your .aar) to enable JMS transport. I commented out all of the HTTP-specific configuration in axis2.xml because I did not need it in this case. See the Axis 1.1 docs for JMS transport for a fuller explanation; also see my comments below and in the previous post in the link.

 

This is a very simple implementation (not sure how it scales on the Axis service side, but a good JMS server setup will scale well on the messaging end). It works well, though, for what we use it for…

 

public class JMSServer {
 
   public static void main(String[] args) {
      //initialize the Log4J logging—-I just put it in my config folder (you can put it elsewhere…)
      PropertyConfigurator.configure("./conf/log4j.properties");
      try {
 
        //The first arg to the method is the root repository location
        //which contains the /modules and /services subfolders
        //The second arg is the location of the global config file, axis2.xml
        ConfigurationContext context = ConfigurationContextFactory
               .createConfigurationContextFromFileSystem("./repository", "./conf/axis2.xml");
 
        //gets the JMS configuration, as I specified in the previous post
        TransportInDescription trIn = context.getAxisConfiguration()
                .getTransportIn(new QName(Constants.TRANSPORT_JMS));
                        
        final TransportListener listener = trIn.getReceiver();
        
        //Add a shutdown hook, so that when you stop the java process, it
        //will shutdown your listener gracefully                
        Runtime.getRuntime().addShutdownHook(
               new Thread(new Runnable() {
                    public void run() {
                       try {
                           listener.stop();
                       } catch (AxisFault e) {
                           e.printStackTrace();
                       }
                     }
                }));
        
        //initialize the listener with the context and transport-in description                
        listener.init(context, trIn);
         //starts the transport listening for incoming JMS messages
        listener.start();
 
      } catch (Exception e) {
          e.printStackTrace();
      }
    }   //end main()
}

 

 

Brennan Spies

Sr. Programmer Analyst

Shared Application Services

 

-----Original Message-----
From: Kang, Kamaljeet K. [mailto:[EMAIL PROTECTED]
Sent:
Tuesday, November 14, 2006 11:51 AM
To: Spies, Brennan
Subject: RE: Standalone axis

 

Thanks again Brennan. I am sorry but I still do not see the example in JMS. I am trying the following, let me know if it will work

 

    // Start the listener and pass the configuration from axis2.xml

                 JMSListener jmsListener = new JMSListener();
                 ConfigurationContextFactory builder = new ConfigurationContextFactory();
                 ConfigurationContext confContext = builder.createConfigurationContextFromFileSystem("d:\\websvc\\mtosi\\conf", "axis2.xml");
                 jmsListener.init(confContext, confContext.getAxisConfiguration().getTransportIn(
                            new QName(Constants.TRANSPORT_JMS)));
                 jmsListener.start();
               
      // Create a service and add it to the context.

      // ????????? Not sure how to create a service and pass the configuration from 'service.xml'

                 AxisService service = Utils.createSimpleService(serviceName, TestJMS.class.getName(), operationName);

                 confContext.getAxisConfiguration().addService(service);

 

thanks

 

Kamal

 


From: Spies, Brennan [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 14, 2006 1:39 PM
To: Kang, Kamaljeet K.
Subject: RE: Standalone axis

Kamal,

 

If you look at the documentation for the newly released 1.1 version of Axis 2.0, they show you how to set it up in the section on JMS transport. There they assume that you are embedding it in an HTTP server. In my case I am actually using it as a standalone Java application.

 

 

Brennan Spies

Sr. Programmer Analyst

Shared Application Services

 

-----Original Message-----
From: Kang, Kamaljeet K. [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 14, 2006 10:35 AM
To: Spies, Brennan
Subject: RE: Standalone axis

 

Brennan,

 

Thanks a lot for replying.

 

Actually, I want to embed AxisEngine (with JMS transport) within my server application and to keep things very simple I want to hard code all the configurations defined in axis2.xml and services.xml. I had been going through Axis doc for some time but still not sure about it. I will appreciate if you can give me some guidelines or skeleton code for the server side.

 

thanks

 

Kamal

 


From: Spies, Brennan [mailto:[EMAIL PROTECTED]
Sent: Friday, November 10, 2006 5:31 PM
To: [email protected]
Subject: RE: Standalone axis

I have an example of a very simple standalone JMSServer class here: http://www.mail-archive.com/[email protected]/msg20494.html

 

 

-----Original Message-----
From: Kang, Kamaljeet K. [mailto:[EMAIL PROTECTED]
Sent: Friday, November 10, 2006 2:28 PM
To: [email protected]
Subject: Standalone axis

 

Hi,

I just want to setup webservice with JMS as transport and I do not want to install Tomcat or other application server. Can somebody please show me how to do this?

 

Also, can somebody tell me if there is any documentation of 'savan'.

 

kamal

============================================================
The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader
of this message is not the intended recipient, or an employee
or agent responsible for delivering this message to the
intended recipient, you are hereby notified that any reproduction,
dissemination or distribution of this communication is strictly
prohibited. If you have received this communication in error,
please notify us immediately by replying to the message and
deleting it from your computer. Thank you. Tellabs
============================================================
============================================================
The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader
of this message is not the intended recipient, or an employee
or agent responsible for delivering this message to the
intended recipient, you are hereby notified that any reproduction,
dissemination or distribution of this communication is strictly
prohibited. If you have received this communication in error,
please notify us immediately by replying to the message and
deleting it from your computer. Thank you. Tellabs
============================================================
============================================================
The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader
of this message is not the intended recipient, or an employee
or agent responsible for delivering this message to the
intended recipient, you are hereby notified that any reproduction,
dissemination or distribution of this communication is strictly
prohibited. If you have received this communication in error,
please notify us immediately by replying to the message and
deleting it from your computer. Thank you. Tellabs
============================================================

Reply via email to