SOAP
SO-S-23 Publishing Java class as SOAP service
Publishing Java classes as Web Services
Example
- This example demonstrates how to call Java VM methods from Virtuoso/PL and expose them as SOAP services.
- It's based on the java class demo_server.java.
- Also provided is a demonstration of how the JAVA Reflect API can be used to automatically generate PL wrappers.
- Click on the Run link or point your browser to: http://[host]:[port]/services/services.vsmx
Source code detail
- javavm_xml.pl - This file contains a Virtuoso/PL procedure which
produces a XML description of the java classes.
jvm_ref_describe_class (in class_name varchar, in inherited integer := 0)
First argument is the absolute JAVA class name (example: java_server or java.util.Calendar). Second argument controls whether to create entries for the inherited constructors/ methods/ attributes of the class, or only for the ones defined in it (java.lang.Class.getDeclaredMethods() vs. java.lang.Class.getMethods()). - javavm_pl.xsl - Is an XSLT stylesheet that produces the Virtuoso/PL wrappers based on the XML file from jvm_ref_describe_class. The stylesheet has a parameter "module" = "1" | "0" (default "1") which controls whether it to generate code for a Virtuoso/PL module, or a set of procedures. For each field it generates Get../Set.. methods (or only Get.. if the field is read-only). It also generates wrappers for each class method. For the non-static fields/methods it instantiates a java object every time the method is invoked.
- java_pl_wrapper.sql - This file is generated using the above files and then the java_properties procedure is added.
Important: This demo needs Virtuoso server with Java hosting option. Otherwise demo will not run properly.
| View the source | Action |
|---|---|
| 1. java_pl_wrapper.sql | Set the initial state |
| 2. /services/services.vsmx | Run |
| 3. java_server.java | |
| 4. javavm_pl.xsl | |
| 5. javavm_xml.sql |
OpenLink Home
Technical Support