KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openharmonise > him > publish > PublishServiceClient


1 /*
2  * The contents of this file are subject to the
3  * Mozilla Public License Version 1.1 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at http://www.mozilla.org/MPL/
6  *
7  * Software distributed under the License is distributed on an "AS IS"
8  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
9  * 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
20 package org.openharmonise.him.publish;
21
22 import java.net.*;
23
24 import javax.xml.namespace.*;
25 import javax.xml.rpc.*;
26
27 import org.apache.axis.client.Call;
28 import org.apache.axis.client.Service;
29
30 /**
31  * Client to utilise org.openharmonise.dav.server.webservice.PublishService
32  * webservice.
33  * @author matt treanor
34  * @version $Revision: 1.2 $
35  *
36  */

37 public class PublishServiceClient {
38     public static final String JavaDoc PUBLISH_WEBSERVICE_NAMESPACE_URI = "http://webservice.server.openharmonise.org";
39     /**
40      *
41      */

42     public PublishServiceClient() {
43         super();
44         // TODO Auto-generated constructor stub
45
}
46     public static String JavaDoc getPublishXML(
47                                     URL endpoint,
48                                     String JavaDoc sXml)
49       throws java.rmi.RemoteException JavaDoc, ServiceException {
50
51       Service service = new Service();
52       Call call = (Call) service.createCall();
53
54       call.setTargetEndpointAddress(endpoint);
55       call.setOperationName(
56         new QName(PUBLISH_WEBSERVICE_NAMESPACE_URI, "publish"));
57
58       call.addParameter(
59         "sXml",
60         org.apache.axis.Constants.XSD_STRING,
61         javax.xml.rpc.ParameterMode.IN);
62
63       call.setReturnType(org.apache.axis.Constants.XSD_STRING);
64       call.setReturnClass(String JavaDoc.class);
65
66       String JavaDoc ret =
67         (String JavaDoc) call.invoke(
68           new Object JavaDoc[] {
69             sXml});
70
71       return ret;
72     }
73     public static void exportContent(
74                     URL endpoint,
75                     String JavaDoc sEmailAddress,
76                     boolean bShowContent,
77                     boolean bShowMetadata)
78         throws java.rmi.RemoteException JavaDoc, ServiceException {
79         
80         Service service = new Service();
81         Call call = (Call) service.createCall();
82         
83         call.setTargetEndpointAddress(endpoint);
84         call.setOperationName(
85         new QName(PUBLISH_WEBSERVICE_NAMESPACE_URI, "publishContent"));
86         
87         call.addParameter(
88         "sEmailAddress",
89         org.apache.axis.Constants.XSD_STRING,
90         javax.xml.rpc.ParameterMode.IN);
91         
92         call.addParameter(
93                 "bShowContent",
94                 org.apache.axis.Constants.XSD_BOOLEAN,
95                 javax.xml.rpc.ParameterMode.IN);
96         
97         call.addParameter(
98                 "bShowMetadata",
99                 org.apache.axis.Constants.XSD_BOOLEAN,
100                 javax.xml.rpc.ParameterMode.IN);
101         
102         call.setReturnType(org.apache.axis.Constants.XSD_STRING);
103         call.setReturnClass(String JavaDoc.class);
104         
105         call.invoke(
106         new Object JavaDoc[] {
107                 sEmailAddress, new Boolean JavaDoc(bShowContent), new Boolean JavaDoc(bShowMetadata)});
108
109     }
110 }
111
112
Popular Tags