KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mx4j > examples > tools > remote > soap > Server


1 /*
2  * Copyright (C) The MX4J Contributors.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the MX4J License version 1.0.
6  * See the terms of the MX4J License in the documentation provided with this software.
7  */

8
9 package mx4j.examples.tools.remote.soap;
10
11 import javax.management.MBeanServer JavaDoc;
12 import javax.management.MBeanServerFactory JavaDoc;
13 import javax.management.remote.JMXConnectorServer JavaDoc;
14 import javax.management.remote.JMXConnectorServerFactory JavaDoc;
15 import javax.management.remote.JMXServiceURL JavaDoc;
16
17 /**
18  * This example shows how to setup a JSR 160 connector server that uses SOAP as
19  * communication protocol with the client.
20  * MX4J's implementation of the SOAP provider requires Axis 1.1, that in turn requires
21  * a servlet container to run. The default servlet container used is Jetty 4.2.x.
22  * Incoming connections from a client will be accepted by Jetty, handed to the
23  * Axis servlet that interpretes the SOAP invocation, and passed to MX4J's
24  * connector server implementation, and finally routed the MBeanServer.
25  * Remote notifications are delivered transparently.
26  * To run this example, you need the following jars:
27  * <ul>
28  * <li>MX4J 2.x</li>
29  * <ul>
30  * <li>mx4j.jar</li>
31  * <li>mx4j-remote.jar</li>
32  * <li>mx4j-tools.jar</li>
33  * <li>mx4j-examples.jar</li>
34  * </ul>
35  * <li>Jetty 4.2.x</li>
36  * <ul>
37  * <li>org.mortbay.jetty.jar</li>
38  * <li>servlet.jar</li>
39  * </ul>
40  * <li>Axis 1.1</li>
41  * <ul>
42  * <li>axis.jar</li>
43  * <li>jaxrpc.jar</li>
44  * <li>commons-logging.jar</li>
45  * <li>commons-discovery.jar</li>
46  * <li>saaj.jar</li>
47  * <li>wsdl4j.jar</li>
48  * </ul>
49  * </ul>
50  *
51  * @version : $Revision: 1.6 $
52  */

53 public class Server
54 {
55    public static void main(String JavaDoc[] args) throws Exception JavaDoc
56    {
57       // The MBeanServer
58
MBeanServer JavaDoc server = MBeanServerFactory.createMBeanServer();
59
60       // Pass null as the host name to tell JMXServiceURL to default to InetAddress.getLocalHost().getHostName()
61
JMXServiceURL JavaDoc url = new JMXServiceURL JavaDoc("soap", null, 8080, "/jmxconnector");
62
63       // Create and start the connector server
64
// Jetty will listen on port 8080
65
JMXConnectorServer JavaDoc connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(url, null, server);
66       connectorServer.start();
67
68       System.out.println("Server up and running " + connectorServer);
69    }
70 }
71
Popular Tags