views:

657

answers:

2

I'm trying to build an axis-based web service with rampart for security, and I've been hoping to deploy a single war to tomcat, rather than installing axis and deploying within axis. (I'm not fixed on that though... this is all very new territory for me, so I could use any feedback that you might have.)

I'm running into a few problems:

  • mvn jetty:run works fine -- I can use the web service, and retrieve wsdl by hitting the url for my services with a ?wsdl tacked on the end (eg: http://localhost:8080/webservice/services/ResultService?wsdl "webservice" is the name of this project), however, mvn jetty:run-war fails, unless I manually copy rampart-1.4.mar and rahas-1.4.mar into the WEB-INF/lib directory manually first. If that isn't done, then jetty:run-war produces a series of exceptions about rampart modules not being available, and hitting the same wsdl url as above returns an empty page. (no content at all, when it should be a good chunk of wsdl) Here are the stacktraces: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=12058#a12058

  • Regardless of the location of the mar files in the generated war, I have never been able to get tomcat to serve the web service properly. It does not issue anything of note to the log (just an INFO that the web application was deployed), and no wsdl is provided for the urls above. http://localhost:8180/infoassist/services/ResultService?wsdl returns nothing. ('infoassist.war' is the name of the generated war, hence the different url than with jetty)

If I query a url that does not end in ?wsdl, then I get an axis exception in the browser. This is probably fine -- it happens even when running the functional jetty:run server, and I don't expect "real" output in a browser yet, since everything I've done so far is just to test soap. It does indicate that axis is in use with Tomcat though, so at least some of the war dependencies are working:

org.apache.axis2.AxisFault: The service cannot be found for the
endpoint reference (EPR) /infoassist/ at
org.apache.axis2.engine.DispatchPhase.checkPostConditions(DispatchPhase.java:65)
at org.apache.axis2.engine.Phase.invoke(Phase.java:334) at
org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:251) at
org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:160) at
org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(RESTUtil.java:135)
at org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil.java:130)
at org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.processURLRequest(AxisServlet.java:838)
at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:262)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:595)

I'm really grasping at straws here -- any help would be greatly appreciated, and of course, I can provide many more details, I just don't know what will be of use.

+1  A: 

Question followed by a suggestion.

Q: Did you generate the WSDL through eclipse? If so did you ensure that it is the right version of Axis?

S: I would drop everything into an EAR, which I believe tomcat supports. An EAR is a directory that can house multiple WARs and JARs

Woot4Moo
There is no static WSDL on the server-side. The client-side uses java2wsdl to get the WSDL, which is then used as input to wsdl2java to create the classes needed for the client. As far as I know, the server-side axis stuff auto-generates WSDL from the service classes at runtime.I'm trying to make an aar right now, and drop that into an axis+rampart install that's in tomcat. I'll give your EAR suggestion a shot if the aar approach doesn't work. Thanks!
rcreswick
+1  A: 

I figured it out, with significant help from various sources:

First,

Follow these instructions:

However, when building the axis war, you must first tweak the build so that axis2-codegen-1.5.jar is not excluded from the archive, per the instructions here:

To use the Rampart code in an Axis2 server installation, you need to create a new axis2.war file, one that includes the added Rampart .jar and .mar files. You can use the Ant build.xml provided in the webapp directory to create axis2.war, provided you make one change: delete the line <exclude name="axis2-codegen*.jar"/> near the end of the file. Then open a console to the Axis2 webapp directory and run ant. After the build.xml runs, you can find the created axis2.war Web application in the Axis2 installation dist directory.

That should be sufficient to see rampart in the list of loaded modules from the axis admin page (which is probably at http://localhost:8080/axis2/axis2-admin/listModules. However, if you're using the binary distributions of these libraries (axis/rampart) you must also take care that you compile your code to a java class spec. that is compatible with 1.5. I wasn't doing this, so I kept encountering java.lang.UnsupportedClassVersionError errors, but nothing made it clear what was actually causing the problem -- I suspected the axis2-codegen-1.5.jar, which was a red-herring--the issues was actually with the bytecode version of my complied classfiles. This also happened when I built the rampart samples from the distribution because they were distributed in source form, and my default compiler is java 1.6.

rcreswick