Posts

WS Dynamic Client with https and user and password. SOAPUI util

Image
Let's create a client that should be authenticated with https protocol. 1. The URL of the WSDL It is https://192.XXX.XXX.XXX:8443/gexflow/ws/RegistroV3?wsdl 2. Creating the classes with Apache cxf It is interesting creating the classes with wsdl2java shell as it can be seen in an elder post . So you can use these classes for several purposes and analyzing cxf interpretation of the WSDL. 3. Bypassing server authentication. NOT WORKING!!! skip this step! If your server has a problematic certificate, (expired, not valid...) you can use a static method in the service class... but you cannot fool the cxf security (in new versions) as cxf redirects to a new DefaultHostServerVerifier . In older versions, this trick can work. 1 2 3 4 5 6 7 8 static { javax . net . ssl . HttpsURLConnection . setDefaultHostnameVerifier ( new javax . net . ssl . HostnameVerifier () { @Override public boolean verify ( String hostname , javax . net . ssl . SSLSession sslSession ) { ...

ORVE WS PROBLEMS FROM JAVA 13

Image
0. Introduction Some days after installing Java 13, the ORVE WS client did not work! The error was: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target 1.Why? The server ssweb.minhap.es has a certificate whose CA root is  GeoTrust TSL RSA CA G1 . This certificate is not in Java 13 "cacerts", although it is in Java 1.8 "cacerts". That's why Apache "cxf" rejects creating a client to this service as it does not rely on the server. 2. Solving the problem 1. Download the CA certificate from Geotrust and add it to the java cert store. You can do it for instance : keytool -import -trustcacerts -alias geotrustorve -keystore /usr/lib/jvm/jdk-13.0.1/lib/security/cacerts -file /home/dowload/GeoTrust_TLS_RSA_CA_G1.crt where: geotrustorve is the alias  /usr/lib/jvm/jdk-13.0.1/lib/security/cacerts ...

ENI (5) Autofirma issues

Please read this post (although it is in Spanish) Informatica Dantesca Autofirma .

ENI (4) Fastexml compatibility issues

0. Introduction Fasterxml is very easy to use for managing XML, but there are some issues that are not compatible with JAXB. Here are some examples of how to solve this handicaps 1. @XmlElementRef, @XmlMixed ... Here is an example of the generated KeyInfoType class 1 2 3 4 5 6 7 8 9 10 11 12 13 14 public class KeyInfoType { @XmlElementRefs ({ @XmlElementRef ( name = "KeyName" , namespace = "http://www.w3.org/2000/09/xmldsig#" , type = JAXBElement . class , required = false ), @XmlElementRef ( name = "KeyValue" , namespace = "http://www.w3.org/2000/09/xmldsig#" , type = JAXBElement . class , required = false ), @XmlElementRef ( name = "RetrievalMethod" , namespace = "http://www.w3.org/2000/09/xmldsig#" , type = JAXBElement . class , required = false ), @XmlElementRef ( name = "X509Data" , namespace = "http://www.w3.org/2000/...

OBSOLETE!!!: ENI (3) Generating java classes from multiple schemas

Image
0. Introduction ( NOTE This is obsolete. see  https://dantesquews.blogspot.com/2019/07/eni-1-eni-document-or-spanish.html ) The purpose of this post is to convert a XAdES internally detached signed document to an ENI document. The signed document contains content and signature, but ENI document has also metadata. But the schema of a XAdES document is not the same as the ENI. I am using Gexflow from Teralco, and the metadata are stored in a database. So it is necessary a conversion. Several schemas are needed: documentoEni.xsd contenidoDocumentoEni.xsd metadatosDocumentoEni.xsd firmasEni.xsd xmldsig-core-schema.xsd XAdES.xsd 1. Configuring the maven project Here is the pom.xml file with the needed resource s: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 6...

ENI (2) ENI Document, is it operational? Verifying documents and "expedients". Afirma and TipoFirmasElectronicas

Image
0. Introduction 1. Our XML validator 2. Main problems 3. Adapting Afirma to TipoFirmasElectyronicas 4. Oficial validators 0. Introduction Spanish Government has made some small steps to solve the situation. But it is not enough.  For instance, there are no available schema validators for signatures provided by the program " AutoFirma ". I have spent a lot of time trying to create ENI "expedients" and documents.  1. Our own XML validator  You should avoid using Jackson XML. Use JAXB instead . This small program validates the XML to the schemas ======================================== package openadmin . utils . jaxb ; import javax . xml . XMLConstants ; import javax . xml . transform . stream . StreamSource ; import javax . xml . validation . Schema ; import javax . xml . validation . SchemaFactory ; import javax . xml . validation . Validator ; import java . io . ByteArrayInputStream ; import java . io . File ; import java . io . FileOutputStream ...