001: /*
002: * The contents of this file are subject to the
003: * Mozilla Public License Version 1.1 (the "License");
004: * you may not use this file except in compliance with the License.
005: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006: *
007: * Software distributed under the License is distributed on an "AS IS"
008: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
009: * See the License for the specific language governing rights and
010: * limitations under the License.
011: *
012: * The Initial Developer of the Original Code is Simulacra Media Ltd.
013: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014: *
015: * All Rights Reserved.
016: *
017: * Contributor(s):
018: */
019:
020: package org.openharmonise.him.publish;
021:
022: import java.net.*;
023:
024: import javax.xml.namespace.*;
025: import javax.xml.rpc.*;
026:
027: import org.apache.axis.client.Call;
028: import org.apache.axis.client.Service;
029:
030: /**
031: * Client to utilise org.openharmonise.dav.server.webservice.PublishService
032: * webservice.
033: * @author matt treanor
034: * @version $Revision: 1.2 $
035: *
036: */
037: public class PublishServiceClient {
038: public static final String PUBLISH_WEBSERVICE_NAMESPACE_URI = "http://webservice.server.openharmonise.org";
039:
040: /**
041: *
042: */
043: public PublishServiceClient() {
044: super ();
045: // TODO Auto-generated constructor stub
046: }
047:
048: public static String getPublishXML(URL endpoint, String sXml)
049: throws java.rmi.RemoteException, ServiceException {
050:
051: Service service = new Service();
052: Call call = (Call) service.createCall();
053:
054: call.setTargetEndpointAddress(endpoint);
055: call.setOperationName(new QName(
056: PUBLISH_WEBSERVICE_NAMESPACE_URI, "publish"));
057:
058: call.addParameter("sXml", org.apache.axis.Constants.XSD_STRING,
059: javax.xml.rpc.ParameterMode.IN);
060:
061: call.setReturnType(org.apache.axis.Constants.XSD_STRING);
062: call.setReturnClass(String.class);
063:
064: String ret = (String) call.invoke(new Object[] { sXml });
065:
066: return ret;
067: }
068:
069: public static void exportContent(URL endpoint,
070: String sEmailAddress, boolean bShowContent,
071: boolean bShowMetadata) throws java.rmi.RemoteException,
072: ServiceException {
073:
074: Service service = new Service();
075: Call call = (Call) service.createCall();
076:
077: call.setTargetEndpointAddress(endpoint);
078: call.setOperationName(new QName(
079: PUBLISH_WEBSERVICE_NAMESPACE_URI, "publishContent"));
080:
081: call.addParameter("sEmailAddress",
082: org.apache.axis.Constants.XSD_STRING,
083: javax.xml.rpc.ParameterMode.IN);
084:
085: call.addParameter("bShowContent",
086: org.apache.axis.Constants.XSD_BOOLEAN,
087: javax.xml.rpc.ParameterMode.IN);
088:
089: call.addParameter("bShowMetadata",
090: org.apache.axis.Constants.XSD_BOOLEAN,
091: javax.xml.rpc.ParameterMode.IN);
092:
093: call.setReturnType(org.apache.axis.Constants.XSD_STRING);
094: call.setReturnClass(String.class);
095:
096: call
097: .invoke(new Object[] { sEmailAddress,
098: new Boolean(bShowContent),
099: new Boolean(bShowMetadata) });
100:
101: }
102: }
|