I’m in a difficult position: We have a 3rd party enterprise system that exposes a Java-based API. However, we are a 100% .Net oriented development team. Essentially, I need to wrap the Java API with something that C# code can call.
Web services would be great, but the only Java application server supported on our infrastructure is WebSphere 6.1. This means the ancient (and deprecated) JAX-RPC web service framework is the only way for us to expose web services. Just getting a simple proof-of-concept working here has been a nightmare (because of Java inexperience, WebSphere being awful, JAX-RPC being clunky, and lots of JAR hell).
The new JAX-WS 2.0 web service framework in JAVA EE 5 looks great– is there any way to run this without an entire Java application server? For example, in .Net’s WCF (Windows Communication Framework), you can host services pretty much anywhere you want (in-process, Windows Service, IIS 6/7 etc).
What is the most lightweight way to wrap this library with some web services?
I ended up finding a solution that was far easier than any of the above. We created some simple classes (like the doPing() method in @Thorbjørn Ravn Andersen’s answer) with the
@javax.jws.WebServiceand@javax.jws.WebMethodannotations, then deployed them using:I was then able to point Visual Studio at
http://localhost:8282/MyService?wsdland generate a client. Easy as pie.We have run a lot of requests through this service over a large span of time and have not noticed any problems. We wrapped this with the Java Service Wrapper so that it comes back up across reboots/JVM crashes, etc. A poor man’s application server.
I hope this might help any other .NET developer looking to interoperate with Java without having to remap your brain to do it.