source: TI01-discovery/trunk/ws-Discovery2/readme.txt @ 3945

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI01-discovery/trunk/ws-Discovery2/readme.txt@3945
Revision 3945, 4.5 KB checked in by cbyrom, 12 years ago (diff)
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.  Also, you may need to copy jdom.jar into your java jre/ext/lib dir
7to get the compile working.
8
9The build file, \srcgen\buildDiscovery.xml, now includes targets to run the WSDL2Java code generation and do all the setting up
10described in the original instructions below.  Options for building include:
11with no parameters, e.g.:
12
13ant -f buildClient.xml jar.client - build the test client jar
14ant -f buildClient.xml jar.server - build the server service jar
15ant -f buildClient.xml deploy.client - build the service jar and deploy it to a local tomcat install
16ant -f buildClient.xml deploy.client - build the service jar and deploy it to a local tomcat install + restart tomcat
17ant -f buildClient.xml - defaults to building the service jar
18
19NB, to get the DiscoveryService.wsdl file to be generated properly, you will likely have to temporarily rename the jsr
20file, as mentioned below.  Also note that the WSDL2JAVA operation generates its own unique version of xmlbeans which is then
21referenced by the generated code - as such you should be careful not to mix the xmlbeans code generated between doing client
22and service jar builds.
23
24Trouble Shooting
25------------------
26i) The code was ran using the following versions (NB, problems were experienced with other combinations - so if the service is running
27but cannot be reached/throws an exception upon initialisation it is worth trying different versions):
28
29axis2 v1.4
30java 1.6.0_06
31tomcat 5.5.26
32
33ii) 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
34lines of:
35
36java.lang.UnsupportedClassVersionError: Bad version number in .class file
37
38when the webservice is deployed to tomcat.
39
40
41Original, detailed instructions, are as follows (but you shouldn't have to use them!):
42
43Client Side:
44---------------
45Instructions for building client (DiscoveryService-test-client.jar)
46
47Do all the following in directory "srcgen"
48
491) Generate automatic code from wsdl :
50%AXIS2_HOME%\bin\wsdl2java -d xmlbeans -uri ..\wsdl\Discovery.wsdl -o . -p ndg.clients.discovery
51
52Edit file src\ndg\clients\discovery\DiscoveryServiceStub.java, after the line (around #104?)
53        _serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext,_service);
54add the line
55        _serviceClient.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, false);
56
572) Use ant to compile client jar using custom buildfile
58ant -buildfile buildDiscovery.xml jar.client
59
603) Use ant to run client
61ant -buildfile buildClient.xml run.client
62
63Server Side:
64---------------
65Instructions for building & deploying Axis2 web service archive (DiscoveryService.aar)
66
671. Run WSDL2Java to generate skeleton code and XMLBeans for data binding
68(In srcgen directory)
69%AXIS2_HOME%\bin\wsdl2java -ss -sd -d xmlbeans -uri ..\wsdl\Discovery.wsdl -o . -p ndg.services.discovery
70
71NB, when running this command, you may get an error along the lines of:
72
73Exception in thread "main" java.lang.NoSuchMethodError: javax.xml.stream.XMLOutputFactory.newInstance(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljavax/xml/stream/XMLOutputFactory;
74        at org.apache.axiom.om.util.StAXUtils.getXMLOutputFactory(StAXUtils.java:97)
75
76- this occurs due to a mismatch in libraries between the versions of java and axis being used.  A
77quick fix can be to temporarily hide jre/lib/ext/jsr173_1.0_api.jar.  NB, without this change, the
78generated DiscoveryService.wsdl file is likely to be empty.
79
802. Build server side code (DiscoveryService.aar)
81(In srcgen directory)
82ant -buildfile buildDiscovery.xml jar.server
83(output in build/lib)
84
853. Optionally build javadoc documentation
86ant -buildfile buildDiscovery.xml javadoc
87
884. Deploy the service
89 - Copy DiscoveryService.aar to <tomcat>/webapps/axis/WEB-INF/services (NB, for this step you need to have axis2
90 installed in your tomcat server - just drop an axis2.war file into the webapps directory when the server is running)
91 - Reload axis2 context within tomcat manager app, or restart tomcat
92
93
94
95Code to edit for testing is in ..\src\ndg\services\discovery\DiscoveryServiceClient.java
96
97Tested with Sun Java SDK 1.5.08 (problems with 1.6.03)
Note: See TracBrowser for help on using the repository browser.