Q: How do I Embed SimpleHTTPServer in My Application and Deploy a POJO?
|
Date: Mon, 8th May, 2006
Level:
Reads: 19125 Comments: 19 |
Login or register to post comments |
|
|
|
Davanum Srinivas
WSO2 Inc. |
| |
|
A: Without much ado, here's the EmbeddedAxis2Server that shows how to add a SimpleHTTPServer in your application and deploys a web service from a plain ol' java class samples.Echo (also shown below). All you need to do is get the binary jars from Axis 1.0 Final distribution, compile the 2 classes below and voila! you have an embedded Axis2 server.
Once you have it running, you can view the runtime generated wsdl at http://localhost:8080/axis2/services/Echo?wsdl or the schema at http://localhost:8080/axis2/services/Echo?xsd Enjoy! EmbeddedAxis2Server.java
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.rpc.receivers.RPCMessageReceiver;
import org.apache.axis2.transport.http.SimpleHTTPServer;
import samples.Echo;
public class EmbeddedAxis2Server {
public static void main(String[] args) throws Exception {
ConfigurationContext context = ConfigurationContextFactory.
createConfigurationContextFromFileSystem(null, null);
AxisService service =
AxisService.createService(Echo.class.getName(), context.getAxisConfiguration(),
RPCMessageReceiver.class, "", "http://samples");
context.getAxisConfiguration().addService(service);
SimpleHTTPServer server = new SimpleHTTPServer(context, 8080);
server.start();
}
}
Echo.java package samples;
public class Echo {
public String echo(String in) {
return in;
}
}
Applies To:
Apache Axis2/Java 1.0 and above
Toronto Web Designer
cheaphandbags
Chanel handbag, you gucci
Problem in running this program
NICE
Re:
thanks giving
Deploy a POJO?
Thanks for a nice share you
There is a SimpleHTTPServer
Good post overall. Enjoyed
Keep up the good work.
First of all thanks a lot
Technology News
AxisService.createService: bad signature
The service cannot be found for the endpoint reference (EPR)
Axis2 with Jetty embedded server and POJO deployment
web design new york
Data Backup Chicago