Win a copy of Modern frontends with htmx this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Automated SOAP Proxy JAR files

Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My Application
- - - - - - - - - - - - - - - - - - - -
I work on a large web site which has back-end webservices accessible via a SOAP interface. Currently to generate a client, I use Axis to generate the client .java files (using the WSDL as input) and I compile them into a JAR file. In a client application one would create the request bean objects to send into the WebServicesGateway, and then process the response beans accordingly. Note that at any one time we would normally have 2 to 3 different versions of the WSDL depending on how many releases we have in development.

My Objective
- - - - - - - - - - - - - - - - - - - - -
Currently i find myself having to create these client JAR files a lot, and uploading them into my java test client (a web app) for my automated test scripts (i developed this tool which can generically test any JAR file).

What I'd like to be able to do is to update by java test client to be able to automate the JAR file creation - so that instead of being handed a JAR file to test (and then showing the generated forms), it will be handed the WSDL file.

I know there are some testing tools out there (even some that are free) which take a WSDL file, and then present you with a generic test client to test the interface. However, I would like to keep with the same theme of using an autogenerated JAR file (by either Axis or Websphere) to communicate to the SOAP layer.

Possible Solution
- - - - - - - - - - - - - - - - - - - -
I figured I could put the Axis.jar file (and other required jar files) into the classpath of my web application, then invoke the Wsdl2Java class to generate the .java files - then somehow compile the .java files into .class files and compress into a JAR file. I could then create a URLClassLoader to enclose this generated JAR file to display the test client.

My Problem
- - - - - - - - - - - - - - - - - -
Currently this involves compiling .java files, but aside from using the Runtime.exec() method to execute the javac.exe to compile the .java files, i don't know of any other way to compile java files. I have 2 issues with using Runtime.exec()

1) My web page could be deployed in any one of several Operating systems (windows/unix/linux) and web servers (Tomcat/websphere) and thus the precise location of a compatible 'javac.exe' may be unknown.

2) According to my 'Best practices' mandates, I'm not (strictly speaking) allowed to invoke a java process on the Operating systems in the shared hosting environments which the tool will be deployed to.

My Question
- - - - - - - - - - - - - - - - - - - -
1) Is this a stupid/crazy idea - and maybe there's something much better that I could do which would accomplish the same thing?

2) Does anyone know how I can compile .java files into .class files from inside a Java program without directly invoking javac.exe via Runtime.exec()?
The harder you work, the luckier you get. This tiny ad brings luck - just not good luck or bad luck.
a bit of art, as a gift, that will fit in a stocking
    Bookmark Topic Watch Topic
  • New Topic