01: /*
02: * The contents of this file are subject to the
03: * Mozilla Public License Version 1.1 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
06: *
07: * Software distributed under the License is distributed on an "AS IS"
08: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
09: * See the License for the specific language governing rights and
10: * limitations under the License.
11: *
12: * The Initial Developer of the Original Code is Simulacra Media Ltd.
13: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
14: *
15: * All Rights Reserved.
16: *
17: * Contributor(s):
18: */
19: package org.openharmonise.him.reports;
20:
21: import java.net.*;
22:
23: import org.apache.axis.client.Call;
24: import org.apache.axis.client.Service;
25:
26: import javax.xml.namespace.QName;
27: import javax.xml.rpc.ServiceException;
28:
29: /**
30: * Client interface for the Report service
31: *
32: * @author Fidel Viegas
33: * @version $Revision: 1.1 $
34: *
35: */
36: public class ReportServiceClient {
37: public static final String SIMULACRA_WEBSERVICE_NAMESPACE_URI = "http://webservices.simulacra.thebritishmuseum.ac.uk";
38:
39: /**
40: *
41: */
42: public ReportServiceClient() {
43: super ();
44: }
45:
46: /**
47: * Makes SOAP request to execute a report query.
48: *
49: * @param endpoint (e.g. http://localhost:8080/webdav/services/ReportService)
50: * @param sPath The Webdav path to the query
51: * @param sUserName The user making the request
52: * @param sPassword The password of the user making the request
53: * @return
54: * @throws java.rmi.RemoteException
55: * @throws ServiceException
56: */
57: public static String executeQuery(URL endpoint, String sPath,
58: String sUserName, String sPassword)
59: throws java.rmi.RemoteException, ServiceException {
60:
61: Service service = new Service();
62: Call call = (Call) service.createCall();
63:
64: call.setTargetEndpointAddress(endpoint);
65: call.setOperationName(new QName(
66: SIMULACRA_WEBSERVICE_NAMESPACE_URI, "executeQuery"));
67:
68: call.addParameter("sPath",
69: org.apache.axis.Constants.XSD_STRING,
70: javax.xml.rpc.ParameterMode.IN);
71: call.addParameter("sUserName",
72: org.apache.axis.Constants.XSD_STRING,
73: javax.xml.rpc.ParameterMode.IN);
74:
75: call.addParameter("sPassword",
76: org.apache.axis.Constants.XSD_STRING,
77: javax.xml.rpc.ParameterMode.IN);
78:
79: call.setReturnType(org.apache.axis.Constants.XSD_STRING);
80: call.setReturnClass(String.class);
81:
82: String ret = (String) call.invoke(new Object[] { sPath,
83: sUserName, sPassword });
84:
85: return ret;
86: }
87: }
|