0

I am having problem while using code for adding digital signature to pdf file. Here is the link of the code http://developer.arx.com/quick-start/sapi-web-services/#tab=t-helloworld . There are some classes in the code which are needed to import in before running, but the package of these classes isn't available in java version 1.6, I am using IBM lotus notes which supports upto java version 1.6. Please help me out.

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
mushir2007
  • 25
  • 5

1 Answers1

1

The java classes in the code sample were indeed generated with Java version 1.7. All you need is to generate new classes compatible with your own environment. Here you can find an explanation on how to do it using the wsimport JDK utility.

Almog G.
  • 817
  • 7
  • 11
  • I have tried generating classes using wsimport. The problem I have faced is, it generates classes for "com.arx.sapiws.spml._1" and "oasis.names.tc.spml" instead of "com.arx.sapiws.dss._1" and "oasis.names.tc.dss" which is used in code. – mushir2007 Jun 03 '14 at 10:58
  • Notice that the SDK contains two WSDL files: SAPIWS-DSS.wsdl- for signature and validation related functions; SAPIWS-SPML.wsdl- for user management related functions. It seems that you generated the SPML classes, do the same with the DSS WSDL file to generate the DSS classes. – Almog G. Jun 03 '14 at 17:49
  • I have tried the same procedure for SAPIWS-DSS.wsdl file, I have got some errors on prompt. 1> warning: src-resolve: Cannot resolve the name 's1:SignRequest' to a(n) 'element declaration' component. 2> warning: src-resolve: Cannot resolve the name 'xml:lang' to a(n) 'attribute decl aration' component. 3> warning: s4s-elt-invalid-content.1: The content of 'InternationalStringType' is invalid. Element 'attribute' is invalid, misplaced, or occurs too often. 4> warning: src-resolve: Cannot resolve the name 's2:NameIdentifierType' to a(n) 't ype definition' component. Am I missing something? – mushir2007 Jun 04 '14 at 06:43
  • Those are all warnings, and in that case wsimport should still generate the classes. Besides those warnings, is there any error that you didn't mention? – Almog G. Jun 04 '14 at 12:50
  • I am getting these warnings and the classes are not generating for "SAPIWS-DSS.wsdl". I am writing "wsimport -keep -extension " in the java/bin folder. Am I missing something which I should include? – mushir2007 Jun 05 '14 at 04:50
  • Thanks for your reply, I am tempted. I have tried the procedure given in the comment above but unfortunately it isn't working. All I need is the classes, so do you know any other source from where I could download the jar file or its corresponding classes. – mushir2007 Jun 05 '14 at 05:27
  • Here you go - https://app.box.com/s/md0uckuazsdl7fc280sx (DSS Jars for Java v1.6) – Almog G. Jun 05 '14 at 22:21
  • Thanks for your reply, all the classes are working now, but I got stuck in code part. I got stuck in the "DSS" class. The line of code is "DSS client = new DSS(new URL(wsdlUrl));" whereas the DSS method of our defined class takes 2 parameters DSS(url,qname), so it throws error on 1 parameter DSS(url). I have tried default value of "qname" shown in class "QName("http://arx.com/SAPIWS/DSS/1.0/", "DSS")", but it throws error "java.security.AccessControlException: Access denied (java.lang.RuntimePermission setContextClassLoader)". I got stuck here, Am I missing something? – mushir2007 Jun 10 '14 at 10:27
  • I have made changes in java.policy < permission java.lang.RuntimePermission "setContextClassLoader"> but unfortunately it won't work. I've also added "System.getSecurityManager().checkPermission(new RuntimePermission("setContextClassLoader"));" in the code. It too don't work. The "arx.com/SAPIWS/DSS/1.0/" link redirects to "arx.com". So I think it might be the cause for "AccessControlException". – mushir2007 Jun 10 '14 at 10:39
  • After changing the DSS() parameters, I am getting "java.security.AccessControlException: Access denied (java.lang.RuntimePermission setContextClassLoader)" error, Do you have any idea of this error? Should I change some properties or parameters? – mushir2007 Jun 10 '14 at 12:06
  • The line- "DSS client = new DSS(new URL(wsdlUrl));" should be changed with this one- "DSS client = new DSS(new URL(wsdlUrl), new QName("http://arx.com/SAPIWS/DSS/1.0/", "DSS"));". Is that what you did? – Almog G. Jun 11 '14 at 08:08
  • Yes, I have changed the line to "DSS client = new DSS(new URL(wsdlUrl), new QName("arx.com/SAPIWS/DSS/1.0/";, "DSS"));". The link "arx.com/SAPIWS/DSS/1.0/" redirects to "arx.com". It is also not working while providing the local path ie "new QName("file:/C:/Users//com/arx/sapiws/dss/_1/","DSS")". – mushir2007 Jun 11 '14 at 11:16
  • Try to replace the JCE policy files (at ${java.home}/lib/security/) with these- http://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html – Almog G. Jun 11 '14 at 13:07
  • Hi, As suggested I have made the changes in JCE policy files, it still throws the same error message "java.security.AccessControlException: Access denied (java.lang.RuntimePermission setContextClassLoader)". One more thing I have noticed, while opening the link "arx.com/SAPIWS/DSS/1.0/" manually on web browser, it redirects to "arx.com". Is this acceptable or it might be a problem? – mushir2007 Jun 12 '14 at 05:58
  • Hi, Do you have any idea regarding this issue I have mentioned in my last comment, as I am still struggling with this issue. – mushir2007 Jun 17 '14 at 06:04
  • It would best if I could see your code. Can you add it as a new question and share a code snippet? – Almog G. Jun 17 '14 at 16:03
  • Hi, I have posted the question along with the code here http://stackoverflow.com/questions/24299584/how-to-run-cosign-signature-soap-api-in-ibm-lotus-notes, I haven't posted my actual credentials of CoSign in my code. – mushir2007 Jun 19 '14 at 05:50
  • Hi, The "AccessControlException" is resolved now. Can you have a look into my another question http://stackoverflow.com/questions/24484147/how-to-change-the-coordinates-of-signature-in-cosign-signature-soap-api-and-plac – mushir2007 Jul 04 '14 at 05:18