source: axis/FeddCommand.java @ 55de6a9

axis_examplecompt_changesinfo-ops
Last change on this file since 55de6a9 was 55de6a9, checked in by Ted Faber <faber@…>, 13 years ago

Example of using java to talk to fedd

  • Property mode set to 100644
File size: 1.5 KB
Line 
1import edu.isi.www.fedd_types.*;
2import edu.isi.www.fedd_wsdl.*;
3import java.net.URL;
4import net.deterlab.isi.XTrustProvider;
5import net.deterlab.isi.Fedid;
6
7class FeddCommand {
8
9    static class ExperimentLabels {
10        protected String fedid;
11        protected String localname;
12
13        public ExperimentLabels(IDType[] experimentID) {
14            fedid = null;
15            localname = null;
16
17            for (IDType id: experimentID) {
18                if (id.getLocalname() != null) localname = id.getLocalname();
19                if (id.getFedid() != null) {
20                    byte[] rawFedid = id.getFedid();
21
22                    if (rawFedid != null) {
23                        Fedid f = new Fedid(rawFedid);
24
25                        if ( f != null) fedid =  f.toString().substring(6);
26                    }
27                }
28            }
29        }
30        String getFedid() { return fedid; }
31        String getLocalname() { return localname; }
32    }
33
34    public static void setUpSecurity() {
35        /* This magic turns off certificate chain checking. */
36        XTrustProvider.install();
37
38        /* This tells the SSL system where to find client certificate
39         * information. */
40        String keyStore = "./keystore";
41        String keyStorePassword = "importkey";
42
43        System.setProperty("javax.net.ssl.keyStore", keyStore);
44        System.setProperty("javax.net.ssl.keyStorePassword", keyStorePassword);
45    }
46
47    public static FeddPortType getPort(String server) throws 
48            javax.xml.rpc.ServiceException, java.net.MalformedURLException {
49        /*
50         * Boilerplate web services access stuff.
51         */
52        FeddServiceLocator service = new FeddServiceLocator();
53        FeddPortType port = service.getfeddPort(new URL(server));
54
55        return port;
56    }
57}
Note: See TracBrowser for help on using the repository browser.