source: trunk/gsdl3/src/java/org/greenstone/gsdl3/SOAPServerlocalsite.java@ 10322

Last change on this file since 10322 was 10322, checked in by kjdon, 19 years ago

just committing the version generated by the ant target - if it gets regenerated then it wont look modified

  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1/*
2 * SOAPServer.java.in: a template for a new SOAPServer
3 * Copyright (C) 2002 New Zealand Digital Library, http://www.nzdl.org
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20package org.greenstone.gsdl3;
21
22import org.greenstone.gsdl3.core.MessageRouter;
23import org.greenstone.gsdl3.util.GlobalProperties;
24import org.greenstone.gsdl3.util.GSFile;
25import org.greenstone.gsdl3.util.GSXML;
26import org.w3c.dom.Element;
27import java.io.File;
28
29/**
30 * The server side of a SOAP connection
31 *
32 * @author <a href="mailto:[email protected]">Katherine Don</a>
33 * @see <a href="http://www.w3.org/TR/SOAP/">Simple Object Access Protocol (SOAP) 1.1 </a>
34 */
35
36public class SOAPServerlocalsite
37{
38
39 /** The message router we're talking to */
40 protected MessageRouter mr=null;
41 /** the name of the site we are serving */
42 protected String site_name = "localsite";
43
44 /** The no-args constructor */
45 public SOAPServerlocalsite() {
46 String gsdl3_home = GlobalProperties.getGSDL3Home();
47 if (gsdl3_home == null || gsdl3_home.equals("")) {
48 System.err.println("Couldn't access GSDL3Home from GlobalProerties.getGSDL3HOME, can't initialize the SOAP Server.");
49 return;
50 }
51 String site_home = GSFile.siteHome(gsdl3_home, this.site_name);
52
53 File site_file = new File(site_home);
54 if (!site_file.isDirectory()) {
55 System.err.println("The site directory "+site_file.getPath()+" doesn't exist. Can't initialize the SOAP Server.");
56 return;
57 }
58 mr = new MessageRouter();
59 mr.setSiteName(this.site_name);
60 mr.configure();
61 }
62
63
64 public Element [] process (Element [] xml_in) {
65 Element [] result = new Element[xml_in.length];
66 for (int i=0; i<xml_in.length; i++) {
67 Element req = xml_in[i];
68 // get rid of the obligatory namespace that axis needs
69 String tag_name = req.getTagName();
70 String namespace="";
71 if (tag_name.indexOf(':')!= -1) {
72 namespace = tag_name.substring(0, tag_name.indexOf(':'));
73 tag_name = tag_name.substring(tag_name.indexOf(':')+1);
74 }
75 Element new_req = GSXML.duplicateWithNewName(req.getOwnerDocument(), req, tag_name, true);
76 Element r = mr.process(new_req);
77 // add the namespace back on
78 //Element new_res = r;
79 //if (!namespace.equals("")) {
80 // new_res = GSXML.duplicateWithNewName(r.getOwnerDocument(), r, namespace+r.getTagName(), true);
81 //}
82 result[i] = r;
83 }
84 return result;
85 }
86}
87
Note: See TracBrowser for help on using the repository browser.