Integrate/embed java applet to openerp - java

I need to integrate into my Openerp application a third party developed java applet to sign documents electronicaly. I tried to implement the following solution but it didn't work for me:
https://stackoverflow.com/questions/24204467/applet-java-integration-with-openerp-odoo
I have the following java applet embeded into my xml view:
<openerp>
<data>
<record id="view_firma_form" model="ir.ui.view">
<field name="name">firma.form</field>
<field name="model">x_firma</field>
<field name="priority" eval="8" />
<field name="arch" type="xml">
<form string="Firma" version="7.0">
<sheet>
<![CDATA[
<html>
<body>
<object id="signApplet" width="600" height="400" archive="ini4j-0.5.2-1.0.jar, icepdf-core-4.3.2-1.0.jar, icepdf-viewer-4.3.2-1.0.jar, AgesicFirmaApplet-AgesicFirmaApplet-2.5.jar, bcprov-jdk15-1.46-1.0.jar, commons-codec-1.2-1.0.jar, bcmail-jdk15-1.46-1.0.jar,log4j-1.2.14-1.0.jar,swing-layout-1.0.3-1.0.jar,commons-io-2.1-1.0.jar,bcprov-jdk15-1.46-1.0.jar,MITyCLibAPI-1.0.4-1.0.jar,MITyCLibCert-1.0.4-1.0.jar,MITyCLibXADES-1.0.4-1.0.jar,MITyCLibTSA-1.0.4-1.0.jar,jss-4.2.5-1.2.jar,commons-logging-1.1-1.0.jar, UserAgentUtils-1.2.4-1.0.jar,itextpdf-5.2.0-1.0.jar,bctsp-jdk15-1.46-1.0.jar,xmlsec-1.4.2-ADSI-1.0-1.0.jar">
<param name="type" value="application/x-java-applet;jpi-version=1.5.0"/>
<param name="java_arguments" value="-Xmx128m"/>
<param name="classloader_cache" value="false"/>
<param name="codebase" value="http://server/appletFirmaAgesic">
<param name="code" value="uy.gub.agesic.firma.cliente.applet.SignApplet"/>
</object>
</body>
</html>
]]>
</sheet>
</form>
</field>
</record>
When I try to execute that (it was installed with no problems), it throws the following error:
Uncaught Error: Invalid XML: <form string="Firma" version="7.0"><sheet>
Is there any way to do that or do I have to take another type of implementation.
Thanks

Related

Running an applet - Blocked by Security

Basically, what I am trying to do is run an applet.
I made applet, tested it (offline, from Eclipse), exported .jar file and posted on dropbox.com. Then I made simple hmtl which should run that applet.
However I can't get pass the Java security (keep getting "Application Blocked by Java Security" error), even after adding dropbox to "Exception Site List" in Java Control Panel.
<!DOCTYPE html>
<html>
<head>
<title>
My Title v3.0
</title>
</head>
<body>
<object width="480" height="360" data="MyNumber.jar" type="application/x-java-applet">
<param name="codebase" value="https://www.dropbox.com/s/mz6y145mwdtge7r/MyNumber.jar?dl=0" />
<param name="code" value="mynumber.online.MyNumberOnline />
<param name="width" value="480" />
<param name="height" value="360" />
<param name="archive" value="MyNumber.jar" />
</object>
</body>
</html>
Is there a way to get past this?
You have to sign this applet with a certificate as the dialog says "identified by a certificate".

generate dynamic page in HTML from xml

I have several different XML files. I want to display them in HTML format using JSP file.
The structure of these files can be different. They may have different depth and tag's names.
I've read about XSLT but I found only examples with manually created xsl. (I can't do that because i will have many different xml files).
How can i produce my html?
EDIT:
Example of form:
<form name="Company">
<field name="name" required="true" type="inputText"/>
<field name="registrationDate" required="true" type="date"/>
<field name="isActive" required="false" type="boolean"/>
<field name="unregistrationDate" type="date"/>
<field name="type" type="comboBox">
<values>
<value>type1</value>
<value>type3</value>
<value>type3</value>
</values>
<defaultSelected>type2</defaultSelected>
</field>
</form>

JUpload combine with codeigniter

does anyone tried JUpload java applet with codeigniter?
this is my views
<h1 align="center">JUpload PHP Sample Page</h1>
<div align="center">
<APPLET
CODE="wjhk.jupload2.JUploadApplet"
NAME="JUpload"
ARCHIVE="../../../../jar/wjhk.jupload.jar"
WIDTH="640"
HEIGHT="300"
MAYSCRIPT="true"
ALT="The java pugin must be installed.">
<param name="postURL" value="ftp://username:password#host:21/testupload" />
<param name="ftpCreateDirectoryStructure" value="true" />
<param name="showLogWindow" value="onError">
<param name="afterUploadURL" value="javascript:alert('Upload done');">
<param name="debugLevel" value="99">
<param name="showStatusBar" value="True">
<param name="maxFileSize" value="25000000">
<param name="maxChunkSize" value="25000000">
<param name="httpUploadParameterType" value="iteration">
<param name="nbFilesPerRequest" value="100">
<param name="stringUploadSuccess" value="SUCCESS">
<param name="stringUploadWarning" value="WARNING">
<param name="stringUploadError" value="ERROR">
Java 1.5 or higher plugin required.
</APPLET>
</div>
but I have no luck to post my ftp, the error says:
java.lang.SecurityException: java.lang.SecurityException in JUploadPanelImpl.doStartUpload()
before I try with codeigniter, I try with pure PHP and it worked. Please help me how to combine this JUpload with codeigniter
Thank you
First of all, check for bad credentials (username,password).
If that's not the cause then my guess would be that your server doesn't allow remote access to ftp.
Configure your server for proper access.

launching java applet

As far as I can see from the documentation, <applet> is deprecated, and the <object> tag is the preferred method for launching an applet now. But I can't find decent documentation, or even a tutorial on how to use the object tag to launch an applet.
I did see the following question which shows how in javascript but I would prefer to use a tag
launch applet from web page
I need to know how to specify the java engine, how to specify a jar file, where it's stored, and how to specify the class that is executed.
Here's what i have at the moment (but does not work)
<object
classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width="800" height="600" data="pi.jar">
<param name="code" value="PiLauncher.class"/>
</object>
the claim was in the Oracle 1.5 docs that this classid specifies "the current java engine" but this is completely opaque to me. They also had examples requesting a specific version.
Even if this is true, how do I:
specify the jar file
specify the class (is this correct above)
specify the directory where the code is (is codebase still valid?)
First of all, the syntax is not the same for firefox and IE:
Firefox:
<object classid="clsid:CAFEEFAC-0017-0000-0000-ABCDEFFEDCBA" id="appletId" name="appletName" width="400" height="300">
<param name="code" value="com.myPackage.Applet" />
<param name="codebase" value="../resources/applet/"/>
<param name="ARCHIVE" value="myApplet.jar" />
<param name="cache_archive" value="myApplet.jar" />
<param name="type" value="application/x-java-applet" />
<param name="cache_option" value="plugin" />
<param name="mayscript" value="true" />
// you can set optional parameters here
</object>
IE:
<object width="400" height="300" classid="java:com.myPackage.Applet.class" codebase="../resources/applet/" name="appletName" id="appletId">
<param name="archive" value="myApplet.jar" />
<param name="type" value="application/x-java-applet" />
<param name="cache_option" value="plugin" />
<param name="mayscript" value="true" />
// you can set optional parameters here
</object>
Here is a good link: http://docs.oracle.com/javase/1.5.0/docs/guide/plugin/developer_guide/using_tags.html#object

How to call JS functions from Java Applet?

Well, this is my trouble:
I have an applet that controlls a magnetic stripe reader and I need to call a JS function when the MSR reads a card to catch the data and submit in a form.
The problem is the applet cannot call JS functions when it is called from a remote PC o server, but locally all the code works fine.
I supposed that is a issue of privileges on the browser.
This is my HTML code:
<html>
<head>
<title>Applet Prueba</title>
<script src="jquery-1.7.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("#AppletPrueba")[0].apOpenPrinter();
$("#AppletPrueba")[0].apActivaMSR();
});
function print()
{
$("#AppletPrueba")[0].apPrintCreditInfo();
}
function setTxtBox(texto)
{
$("#txtBox").val(texto);
}
</script>
</head>
<body>
<object id = "AppletPrueba"
classid = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width = "1"
height = "1">
<param name="code" value="applet.AppletJPos.class"/>
<param name="archive" value="SAppletJPos.jar,Sjpos11021.jar,Sjpos191.jar,SNCRJavaPOS39.jar,SNCRJavaPOSClasses.jar,Sxerces.jar"/>
<param name="scriptable" value="true"/>
<param name="mayscript" value="true"/>
<param name="param0" value="1"/>
<param name="param1" value="Tienda"/>
<param name="param2" value="XXX"/>
<param name="param3" value="RUBEN C. FLORES GARNETT"/>
<param name="param4" value="09 de Marzo de 2012"/>
<param name="param5" value="0.00"/>
<param name="param6" value="0.00"/>
<param name="param7" value="0.00"/>
<param name="param8" value="0.00"/>
<param name="param9" value="0.00"/>
<param name="param10" value="0.00"/>
<param name="param11" value="0"/>
<param name="param12" value="0.00"/>
<param name="param13" value="0.00"/>
<param name="param14" value="0.00"/>
<param name="param15" value="0.00"/>
<param name="param16" value="0.00"/>
<param name="param17" value="0.00"/>
<param name="param18" value="0.00"/>
<param name="param19" value="0.00"/>
<param name="param20" value="0.00"/>
<param name="param21" value="0.00"/>
<param name="param22" value="0.00"/>
<param name="param23" value="0.00"/>
<param name="param24" value="1"/>
</object>
<input type="button" value="Imprime Ticket" onclick="print()" />
<br/>
<input type="text" value="" id="txtBox" />
</body>
And that is the way the applet call the JS function:
AppletContext appletCtxt = getAppletContext();
...
appletCtxt.showDocument(new URL("javascript: setTxtBox('" + editedCardId[0] + "')"));
I really hope somebody can help me.
(I'm sorry if my english is bad :P)
The Oracle tutorial on the matter would probably be useful.
Invoking JavaScript Code From an Applet
The netscape.javascript.JSObject class enables Java applets to
retrieve a reference to JavaScript objects and interact with the web
page.

Categories

Resources