1 | ws-Discovery |
---|
2 | ------------ |
---|
3 | |
---|
4 | Build Info/Set up |
---|
5 | -------------------- |
---|
6 | NB, completing the build here assumes you have both apache axis2 and ant installed. The AXIS2_HOME environment variable |
---|
7 | should be set to point to the top level directory of the axis2 install. If you are deploying locally to tomcat, you need |
---|
8 | to set CATALINA_HOME to the home dir of the tomcat install. |
---|
9 | |
---|
10 | The build file, \srcgen\buildDiscovery.xml, now includes targets to run the WSDL2Java code generation and do all the setting up |
---|
11 | described in the original instructions below. Options for building include: |
---|
12 | with no parameters, e.g.: |
---|
13 | |
---|
14 | ant -f buildClient.xml jar.client - build the test client jar |
---|
15 | ant -f buildClient.xml jar.server - build the server service jar |
---|
16 | ant -f buildClient.xml deploy.client - build the service jar and deploy it to a local tomcat install |
---|
17 | ant -f buildClient.xml deploy.client - build the service jar and deploy it to a local tomcat install + restart tomcat |
---|
18 | ant -f buildClient.xml generatestubs - generate both client and server side stubs - and generate the XBeans jar using the client-side stubs |
---|
19 | ant -f buildClient.xml - defaults to building the service jar |
---|
20 | |
---|
21 | NB, to get the DiscoveryService.wsdl file to be generated properly, you may have to temporarily rename the jsr |
---|
22 | file, as mentioned below. Also note that the WSDL2JAVA operation generates its own unique version of xmlbeans which is then |
---|
23 | referenced by the generated code - as such you should be careful not to mix the xmlbeans code generated between doing client |
---|
24 | and service jar builds. |
---|
25 | |
---|
26 | Eclipse set up |
---|
27 | ------------------- |
---|
28 | To remove build errors in the code, run the build with the 'generatestubs' target, and eclipse is refreshed to pick the |
---|
29 | generated code. Add all the jars in the resources dir to the build classpath and also add all the jars in the AXIS2_HOME/lib |
---|
30 | dir. |
---|
31 | |
---|
32 | Running tests |
---|
33 | ---------------- |
---|
34 | There are JUnit tests that can be ran to check the basic integrity of the web services. For these to be ran from inside |
---|
35 | eclipse, you'll need to add the generated XBeans-packaged.jar (in build/lib) to the build path. The tests also assume that |
---|
36 | the files test_file.xml and test_file2.xml, in resources, have been ingested to the postgres DB as badc files (i.e. put them |
---|
37 | into the expected harvest directory (currently, /usr/local/jakarta-tomcat/webapps/oai/WEB-INF/harvested_records/badc-nerc-ac-uk-dif) |
---|
38 | and run oai_document_ingester.py badc |
---|
39 | |
---|
40 | Failing tests |
---|
41 | ---------------- |
---|
42 | There are currently 3 tests that fail: |
---|
43 | |
---|
44 | i) validAuthorTermSearch |
---|
45 | - this fails currently since unsure where the author data should be set and retrieved from |
---|
46 | |
---|
47 | ii) nullDateStartRangeSearch |
---|
48 | - Generated code is a little ropey atm; if a start date is not defined, this date range is automatically |
---|
49 | not set - however if it is it will be - i.e. the end date is not consulted when setting up this object |
---|
50 | - this makes it currently impossible to recognise the case where a start date is null and the end date is set |
---|
51 | - NB, would be better to tighten up WSDL definition so that you can/cannot set things up wrongly |
---|
52 | |
---|
53 | iii) basicPresentDIFFormatCompare |
---|
54 | - This naively assumes the original format returned will equal the DIF format returned (since the original was in |
---|
55 | DIF format). Clearly there are discrepancies introduced by the transform. |
---|
56 | |
---|
57 | Trouble Shooting |
---|
58 | ------------------ |
---|
59 | i) The code was ran using the following versions (NB, problems were experienced with other combinations - so if the service is running |
---|
60 | but cannot be reached/throws an exception upon initialisation it is worth trying different versions): |
---|
61 | |
---|
62 | axis2 v1.4 |
---|
63 | java 1.6.0_06 |
---|
64 | tomcat 5.5.26 |
---|
65 | |
---|
66 | ii) Tomcat must be running with the same version of java as the code is build with - otherwise you'll likely get an error along the |
---|
67 | lines of: |
---|
68 | |
---|
69 | java.lang.UnsupportedClassVersionError: Bad version number in .class file |
---|
70 | |
---|
71 | when the webservice is deployed to tomcat. |
---|
72 | |
---|
73 | iii) Be very careful when playing around with the Setsrid sql calls - the following apostrophes must be ' and not ` - NB, eclipse |
---|
74 | may substitute these in which will cause problems which can be difficult to diagnose... |
---|
75 | |
---|
76 | To do |
---|
77 | ------------ |
---|
78 | i) Currently the time searches use only the 'overlaps' function - i.e. the 'temporalOperator' element of the WS is unused. This |
---|
79 | could be implemented to allow similar search types to the spatial operator - i.e. within, overlaps and no overlaps |
---|
80 | |
---|
81 | |
---|
82 | Original, detailed instructions, are as follows (but you shouldn't have to use them!): |
---|
83 | |
---|
84 | Client Side: |
---|
85 | --------------- |
---|
86 | Instructions for building client (DiscoveryService-test-client.jar) |
---|
87 | |
---|
88 | Do all the following in directory "srcgen" |
---|
89 | |
---|
90 | 1) Generate automatic code from wsdl : |
---|
91 | %AXIS2_HOME%\bin\wsdl2java -d xmlbeans -uri ..\wsdl\Discovery.wsdl -o . -p ndg.clients.discovery |
---|
92 | |
---|
93 | Edit file src\ndg\clients\discovery\DiscoveryServiceStub.java, after the line (around #104?) |
---|
94 | _serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext,_service); |
---|
95 | add the line |
---|
96 | _serviceClient.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, false); |
---|
97 | |
---|
98 | 2) Use ant to compile client jar using custom buildfile |
---|
99 | ant -buildfile buildDiscovery.xml jar.client |
---|
100 | |
---|
101 | 3) Use ant to run client |
---|
102 | ant -buildfile buildClient.xml run.client |
---|
103 | |
---|
104 | Server Side: |
---|
105 | --------------- |
---|
106 | Instructions for building & deploying Axis2 web service archive (DiscoveryService.aar) |
---|
107 | |
---|
108 | 1. Run WSDL2Java to generate skeleton code and XMLBeans for data binding |
---|
109 | (In srcgen directory) |
---|
110 | %AXIS2_HOME%\bin\wsdl2java -ss -sd -d xmlbeans -uri ..\wsdl\Discovery.wsdl -o . -p ndg.services.discovery |
---|
111 | |
---|
112 | NB, when running this command, you may get an error along the lines of: |
---|
113 | |
---|
114 | Exception in thread "main" java.lang.NoSuchMethodError: javax.xml.stream.XMLOutputFactory.newInstance(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljavax/xml/stream/XMLOutputFactory; |
---|
115 | at org.apache.axiom.om.util.StAXUtils.getXMLOutputFactory(StAXUtils.java:97) |
---|
116 | |
---|
117 | - this occurs due to a mismatch in libraries between the versions of java and axis being used. A |
---|
118 | quick fix can be to temporarily hide jre/lib/ext/jsr173_1.0_api.jar. NB, without this change, the |
---|
119 | generated DiscoveryService.wsdl file is likely to be empty. |
---|
120 | |
---|
121 | 2. Build server side code (DiscoveryService.aar) |
---|
122 | (In srcgen directory) |
---|
123 | ant -buildfile buildDiscovery.xml jar.server |
---|
124 | (output in build/lib) |
---|
125 | |
---|
126 | 3. Optionally build javadoc documentation |
---|
127 | ant -buildfile buildDiscovery.xml javadoc |
---|
128 | |
---|
129 | 4. Deploy the service |
---|
130 | - Copy DiscoveryService.aar to <tomcat>/webapps/axis/WEB-INF/services (NB, for this step you need to have axis2 |
---|
131 | installed in your tomcat server - just drop an axis2.war file into the webapps directory when the server is running) |
---|
132 | - Reload axis2 context within tomcat manager app, or restart tomcat |
---|
133 | |
---|
134 | |
---|
135 | |
---|
136 | Code to edit for testing is in ..\src\ndg\services\discovery\DiscoveryServiceClient.java |
---|
137 | |
---|
138 | Tested with Sun Java SDK 1.5.08 (problems with 1.6.03) |
---|