Subject: RE: [xsl] Accessing External Java Library From: "Carl Bourne" <cbourne@xxxxxxxxxxxxxxx> Date: Fri, 2 Nov 2007 16:23:27 -0000 |
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@xxxxxxxxxxxx] Sent: 02 November 2007 15:37 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx 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@xxxxxxxxxxxxxxx] > Sent: 02 November 2007 15:00 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > 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@xxxxxxxxxxxx] > Sent: 01 November 2007 17:10 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > 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/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Accessing External Java L, Michael Kay | Thread | RE: [xsl] Accessing External Java L, Michael Kay |
[xsl] Re: Merging multiple document, Mark Peters | Date | RE: [xsl] Accessing External Java L, Michael Kay |
Month |