xsl-list
[Top] [All Lists]

RE: [xsl] Accessing External Java Library

2007-11-02 10:07:00
Right, so it's an instance-level method and therefore the call needs to
supply an extra parameter, which is the object instance. 

I would expect to see something like:

<xsl:variable name="instance" select="PGP:new()"/>
<xsl:variable name="encryptData" 
  select="PGP:encrypt($instance, $passphrase, $datain, $keyring,
$filename)"/>


Michael Kay
http://www.saxonica.com/
 

-----Original Message-----
From: Carl Bourne [mailto:cbourne(_at_)intellect(_dot_)co(_dot_)uk] 
Sent: 02 November 2007 16:23
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Accessing External Java Library

Hi Michael,

The Java signature method for the method we are calling is:

encrypt(string, string, string, string)

which is declared as the following in the iPGP java class:

public native int encrypt(String passphraseoruid, String 
datain, String pgpkeyring, String outputfilename);

Regards,


Carl Bourne
Intellect
DDI: +44 1491 842502
M: +44 7770 284294




-----Original Message-----
From: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com]
Sent: 02 November 2007 15:37
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Accessing External Java Library

Well, this is what it says:

Trying method encrypt: name matches
Method is not static
Method has 4 arguments; expecting 3 

And you haven't showed us the Java method signature, so I 
can't advise any further.

Michael Kay
http://www.saxonica.com/

 

-----Original Message-----
From: Carl Bourne [mailto:cbourne(_at_)intellect(_dot_)co(_dot_)uk]
Sent: 02 November 2007 15:00
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Accessing External Java Library

Hi Michael,

I think I'm now creating an instance of the class correctly but I'm 
still getting some errors relating to a missing function when using 
non static methods.

Output:

C:\Documents and Settings\cbourne\My Documents\PGPJava>java -cp 
.;C:\javapgp\iPG P.jar net.sf.saxon.Transform -TJ pgp.xml pgp.xslt 
Loading iPGP.iPGP Looking for method new in Java class 
class iPGP.iPGP 
Number of actual arguments = 4 Looking for a constructor Found a 
constructor with 4 arguments Found a constructor with 0 arguments 
Loading iPGP.iPGP Looking for method encrypt in Java class class 
iPGP.iPGP Number of actual arguments = 4 Trying method 
getArmor: name 
does not match Trying method setArmor: name does not match Trying 
method
getConventional: name does not match Trying method
setConventional: name does not match Trying method
getInputIsText: name does not match Trying method
setInputIsText: name does not match Trying method
getOutputIsText: name does not match Trying method
setOutputIsText: name does not match Trying method
getUseKeyID: name does not match Trying method setUseKeyID: 
name does not match Trying method getOutputFilename: name does not 
match Trying method setOutputFilename: name does not match Trying 
method getASCIIOutput: name does not match Trying method 
getPGPSDKErrorMessage: name does not match Trying method 
encrypt: name 
matches Method is not static Method has 4 arguments; expecting 3 
Trying method
encryptAndSign: name does not match Trying method
decryptAndVerify: name does not match Trying method hashCode: 
name does not match Trying method getClass: name does not 
match Trying 
method wait: name does not match Trying method
wait: name does not match Trying method wait: name does not match 
Trying method equals: name does not match Trying method
toString: name does not match Trying method notify: name does not 
match Trying method notifyAll: name does not match No 
method or field 
matching encrypt with 4 parameters found in class iPGP.iPGP 
Error at 
xsl:variable on line 21 of 
file:/C:/Documents%20and%20Settings/cbourne/
My%20Documents/PGPJava/pgp.xslt:
  XPST0003: XPath syntax error at char 54 on line 21 in {... 
$datain, $keyring,
$filena...}:
    Cannot find a matching 4-argument function named
{java:iPGP.iPGP}encrypt()
Failed to compile stylesheet. 1 error detected.

XSLT:

<?xml version="1.0" ?>
<xsl:stylesheet version="2.0" 
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
      xmlns:PGP="java:iPGP.iPGP"
      exclude-result-prefixes="PGP">
      

<xsl:template match="dataelements">

<xsl:param name="passphrase">mypswd</xsl:param>
 <xsl:param name="keyring"></xsl:param>  <xsl:param 
name="filename"></xsl:param>

<xsl:value-of select="PGP:new(true(), true(), true(), true())" /> 
<!--<xsl:value-of select="PGP:setArmor(true())"
/> <xsl:value-of select="PGP:setConventional(true())" /> 
<xsl:value-of 
select="PGP:setInputIsText(true())" /> <xsl:value-of 
select="PGP:setOutputIsText(true())"/>
-->   
   <xsl:variable name="datain" select="data"/>
   <xsl:variable name="encryptData" 
select="PGP:encrypt($passphrase, $datain, $keyring, $filename)"/>
   <xsl:value-of select="$encryptData"/> </xsl:template> 
</xsl:stylesheet>

XML:

<dataelements>
    <dataelement>
        <data>New York</data>
    </dataelement>
    <dataelement>
        <data>Boston</data>
     </dataelement>
     <dataelement>
        <data>Denver</data>
     </dataelement>
</dataelements>






Carl Bourne
Intellect
DDI: +44 1491 842502
M: +44 7770 284294





-----Original Message-----
From: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com]
Sent: 01 November 2007 17:10
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Accessing External Java Library

Once again, the messages give you the information, and once again, 
it's in the checklist that I gave you earlier:

C:\Documents and Settings\cbourne\My Documents\PGPJava>java -cp 
.;C:\javapgp\iPG P.jar net.sf.saxon.Transform -TJ pgp.xml 
pgp.xslt 
Loading iPGP.iPGP Looking for method setArmor in Java class class 
iPGP.iPGP Number of actual arguments = 1 Trying method
getArmor: name
does not match Trying method
setArmor: name matches Method is not static

If you're calling a non-static method then you need to supply an 
object instance as the first argument. The documentation tells you 
how.

Michael Kay
http://www.saxonica.com/



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--