Accessing complex web service

In one of our applications that stills runs on Railo we consume a very complex webservice which we access using a custom built java wrapper. The technique is the one put forth by Mark Drew in this now relatively old Blog Post.

We are now finally upgrading to Lucee5 and for some reason can not get our java wrapper to work. We have followed the same pattern and copied all the jars out of the lucee-server/bundle folder and the created our java wrapper as per the blog post (which is what we also did for railo). However when we try to call the webservice we are getting an aXis class not found error. I have tried putting the generate jars in the WEB-INF/lib and WEB-INF/lucee folder but it always trips up on loading the axis classes. If I copy in the axis.jar files from railo it gets past that error but then can’t find the next class.

So my question is where do I need to put my jar file so that it finds all the jars that ship with lucee, or what information do I need to supply to get closer to a solution.

Thanks in advance for any pointers.

Are you loading the classes using the Bundle symbolic name or as regular jars?

From what you’re saying it seems like you’re using regular jars, so the files should be on the classpath, e.g. {Tomcat}/lib and not in the bundle directory.

First up thank you very much for your time to assist. I have now tried placing the .jar in various lib folder unfortunately with no luck so far. I believe we are loading them as regular .jars; I think.

To be a little more specific when our .jar is placed into “WEB-INF/lib” the error thrown is:
“Could not initialize class org.tempuri.BasicHttpBinding_DSServicesStub”.

When I move the .jar to “tomcat/lib” the error is:
“java.lang.ClassNotFoundException: org.apache.axis.encoding.Serializer”

Any other insights or better yet is there a change to the process outlined in mark drew article that I linked in my first post for Lucee5?

thanks again for any input.

I am not familiar with Mark’s post there, but perhaps we can get his attention here – @markdrew?

My guess is that that this is the correct place, but you are missing another jar that is required. It is impossible to tell without more information.

Can you post the full error messages with the Java stack trace?

I think there might be another issue here. That the WSDL2Java tool would be using a version of Axis, which I think now Lucee 5 is using Axis2 rather than Axis

So if you are using that tool you would need to use the version of axis that comes with Lucee at a guess. It’s been a real long while though (6+ years?) since I wrote that and I haven’t replicated it with Lucee yet.

I know it has been a while since the last post, but thanks for the pointers Mark.

I finally got the soap call working using your guide.

Good Times!

The missing piece of the puzzle was that Lucee could not find the AXIS dependencies, the cause of which is the way things work with OSGI.

In order to get the jar file generated by following your excellent blog post to work, I had to wrap the jar in an OSGI bundle and include all required dependencies in the manifest file.

I will just leave the following here in case it will help someone else. If there is a better way to do this, please share.

  1. Create a JAR file that wraps all the required soap calls as outlined here:
    http://markdrew.io/accessing-complex-web-services-with-railo
  2. Create a new working folder and copy the generated jar file into this working folder.
  3. In the working folder create a META-INF folder.
  4. Inside the META-INF folder create a MANIFEST.MF file.
  5. The contents of a sample MANIFEST.MF is below. (Adjust name/ version / etc. as required.)
  6. Zip the complete contents of the working folder and rename to .jar.)

The file can then be dropped into lucee.

Within our cfml code we also had to specify the name of the bundle when we use the createObject() function.

Sample MANIFEST.MF

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: My Complex WS Connector
Bundle-SymbolicName: my_connector
Bundle-Version: 1.0.0
Bundle-ClassPath: my_connector.jar
Bundle-Vendor: The A.CM.E. Will-E Coyte
Import-Package: org.apache.axis,org.apache.axis.encoding,org.apache.axis.description,org.apache.axis.client,org.apache.axis.soap,org.apache.axis.constants,org.apache.axis.encoding.ser
Export-Package: com.mypackage.something - PUT A LIST OF PACKAGES THAT SHOULD BE VISIBLE TO LUCEE HERE.
Bundle-RequiredExecutionEnvironment: JavaSE-1.8

Then in the cfml code:

<cfset ws = CreateObject(“java”,“com.mypackage.something”,“my_connector”)>

Hope the above will at least get someone on the right track when trying to do this with some other complex web service.