source: TI01-discovery/branches/ws-Discovery2-upgrade/readme.txt @ 3958

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI01-discovery/branches/ws-Discovery2-upgrade/readme.txt@3963
Revision 3958, 4.9 KB checked in by cbyrom, 11 years ago (diff)

Update docs with setting up instructions for eclipse
and test running instructions.

Line 
1ws-Discovery
2------------
3
4NB, completing the build here assumes you have both apache axis2 and ant installed.  The AXIS2_HOME environment variable
5should be set to point to the top level directory of the axis2 install.  If you are deploying locally to tomcat, you need
6to set CATALINA_HOME to the home dir of the tomcat install.
7
8The build file, \srcgen\buildDiscovery.xml, now includes targets to run the WSDL2Java code generation and do all the setting up
9described in the original instructions below.  Options for building include:
10with no parameters, e.g.:
11
12ant -f buildClient.xml jar.client - build the test client jar
13ant -f buildClient.xml jar.server - build the server service jar
14ant -f buildClient.xml deploy.client - build the service jar and deploy it to a local tomcat install
15ant -f buildClient.xml deploy.client - build the service jar and deploy it to a local tomcat install + restart tomcat
16ant -f buildClient.xml - defaults to building the service jar
17
18NB, to get the DiscoveryService.wsdl file to be generated properly, you may have to temporarily rename the jsr
19file, as mentioned below.  Also note that the WSDL2JAVA operation generates its own unique version of xmlbeans which is then
20referenced by the generated code - as such you should be careful not to mix the xmlbeans code generated between doing client
21and service jar builds.
22
23Eclipse set up
24-------------------
25To remove build errors in the code, ensure that the client build is ran, and eclipse is refreshed to pick the
26generated code.  Add all the jars in the resources dir to the build classpath and also add all the jars in the AXIS2_HOME/lib
27dir.
28
29Running tests
30----------------
31There are a few JUnit tests that can be ran to check the basic integrity of the web service.  From these to be ran from inside
32eclipse, you'll need to add the generated XBeans-packaged.jar (in build/lib) to the build path.
33
34Trouble Shooting
35------------------
36i) The code was ran using the following versions (NB, problems were experienced with other combinations - so if the service is running
37but cannot be reached/throws an exception upon initialisation it is worth trying different versions):
38
39axis2 v1.4
40java 1.6.0_06
41tomcat 5.5.26
42
43ii) 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
44lines of:
45
46java.lang.UnsupportedClassVersionError: Bad version number in .class file
47
48when the webservice is deployed to tomcat.
49
50
51Original, detailed instructions, are as follows (but you shouldn't have to use them!):
52
53Client Side:
54---------------
55Instructions for building client (DiscoveryService-test-client.jar)
56
57Do all the following in directory "srcgen"
58
591) Generate automatic code from wsdl :
60%AXIS2_HOME%\bin\wsdl2java -d xmlbeans -uri ..\wsdl\Discovery.wsdl -o . -p ndg.clients.discovery
61
62Edit file src\ndg\clients\discovery\DiscoveryServiceStub.java, after the line (around #104?)
63        _serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext,_service);
64add the line
65        _serviceClient.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, false);
66
672) Use ant to compile client jar using custom buildfile
68ant -buildfile buildDiscovery.xml jar.client
69
703) Use ant to run client
71ant -buildfile buildClient.xml run.client
72
73Server Side:
74---------------
75Instructions for building & deploying Axis2 web service archive (DiscoveryService.aar)
76
771. Run WSDL2Java to generate skeleton code and XMLBeans for data binding
78(In srcgen directory)
79%AXIS2_HOME%\bin\wsdl2java -ss -sd -d xmlbeans -uri ..\wsdl\Discovery.wsdl -o . -p ndg.services.discovery
80
81NB, when running this command, you may get an error along the lines of:
82
83Exception in thread "main" java.lang.NoSuchMethodError: javax.xml.stream.XMLOutputFactory.newInstance(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljavax/xml/stream/XMLOutputFactory;
84        at org.apache.axiom.om.util.StAXUtils.getXMLOutputFactory(StAXUtils.java:97)
85
86- this occurs due to a mismatch in libraries between the versions of java and axis being used.  A
87quick fix can be to temporarily hide jre/lib/ext/jsr173_1.0_api.jar.  NB, without this change, the
88generated DiscoveryService.wsdl file is likely to be empty.
89
902. Build server side code (DiscoveryService.aar)
91(In srcgen directory)
92ant -buildfile buildDiscovery.xml jar.server
93(output in build/lib)
94
953. Optionally build javadoc documentation
96ant -buildfile buildDiscovery.xml javadoc
97
984. Deploy the service
99 - Copy DiscoveryService.aar to <tomcat>/webapps/axis/WEB-INF/services (NB, for this step you need to have axis2
100 installed in your tomcat server - just drop an axis2.war file into the webapps directory when the server is running)
101 - Reload axis2 context within tomcat manager app, or restart tomcat
102
103
104
105Code to edit for testing is in ..\src\ndg\services\discovery\DiscoveryServiceClient.java
106
107Tested with Sun Java SDK 1.5.08 (problems with 1.6.03)
Note: See TracBrowser for help on using the repository browser.