Posts

ORVE WS (Dynamic) (9) Persisting retrieved records and other control information (1). H2 DB proposal

Image
0. Introduction As ORVE WS will have a daily usage, it is important to have a control, so  it is required to: Persist all retrieved records. Have a logging system for failures. Know the last date the records were requested with success. Persist the which "ids" where not successfully retrieved. So we need a simple database management system for this purpose as this is not a critical system. It can be helped by a property file. A DBMS candidate for this is H2. Hibernate JPA is a good system to access this DBMS using Java. 1.Installing and testing H2 It can be downloaded from the H2 page , and unzipped into a folder. Open a console and go to the "bin" subfolder and run java -jar h2*.jar but if we want that anybody can access our database this command should be executed java -jar h2*.jar -webAllowOthers -tcpAllowOthers A new tab is opened in Firefox If the "Test Connection" button is pressed then the "Test succ...

ORVE WS (Dynamic) (8) Organizing class structure

0. Introduction We have got a bunch of classes. It's time to organize our code. One option is creating a class with static methods. The functionality of this class can be Get a client Get ids in several ways Get a record in several ways. 1. Implementation of the class The name of the class may be "ORVEUtils" and this can be the code proposals 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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 ...

ORVE WS (Dynamic) (7) Testing obtenerRegistro operation

0. Introduction When a record (registro) is introduced in the online ORVE application, 2 identifiers are created for the same record, one as a sending record and another one as a reception record. ORVE WS cannot be used to input records to the application, but to retrieve the records that are sent or received by the administration the user has permission to access. Usually, all the records that are sent to our administration should be internally registered, but not all the records that we send to other administration should be registered internally. In a future post, a method to register to a local application will be analyzed. In order to get a record, an id is needed. 1. Retrieving the ids  In a previous post , we have implemented static and dynamic clients to get the ids of the records that fulfil some conditions. 2. Invoking the obtenerRegistro operation Let's create a simple class to retrieve a record. It is important to notice that part of the res...

ORVE WS (Dynamic) (6) Sicres3.0 format (2). Binding files

Image
0. Introduction There are some things I do not like from the previous class generation. XML tags are not exactly copied to attribute names. Underscores are deleted. The class is too big There are static classes defined in the same file 1. Using binding files In the last post , when generating java classes, Eclipse asked us for binding files. With binding files, we could vary the class generation process to get a more customized output. 2. Not omitting underscores in attributes. In StackOverflow it is explained how to get underscores not deleted while generating classes from an xsd file. Here is a simple binding file for this purpose. 1 2 3 4 5 6 7 8 9 10 11 12 13 <jaxb:bindings xmlns:jaxb= "http://java.sun.com/xml/ns/jaxb" xmlns:xs= "http://www.w3.org/2001/XMLSchema" version= "2.1" > <jaxb:globalBindings localScoping= "toplevel" /> <jaxb:bindings schemaLocation= "sicr...

ORVE WS (Dynamic) (5) Sicres3.0 format(1). Translating schema XSD to Java classes

Image
0. Introduction The Spanish Government has focused in electronic administration. The interoperability is one of the tenets. Sicres version 3.0 is a standard for interchange of records. 1. Schema xsd There is a XML schema  definition(xsd file) of this format that can be consulted in this link . As it is a quite big schema, it will not be included here. 2. Creating Java classes from the xsd file If you have a recent version on Eclipse for Java EE then you can generate the classes from the schema. For this purpose, a folder named " xsd " has been created for this purpose in the " src/main/resources " folder. The downloaded file has been copied into this folder and renamed to " sicres30.xsd " In Eclipse, right-click on this file - Generate - JAXB classes And select a project and a package. But it also asks for binding files . Binding files can be very usefull in order to customize the generated classes. For now, let's ignore this files...