You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by de...@apache.org on 2005/06/22 08:45:37 UTC
svn commit: r191772 - in
/webservices/axis/trunk/java/modules/samples/src/sample:
amazon/search/ClientUtil.java google/search/AsynchronousClient.java
google/search/ClientUtil.java google/search/GUIHandler.java
Author: deepal
Date: Tue Jun 21 23:45:36 2005
New Revision: 191772
URL: http://svn.apache.org/viewcvs?rev=191772&view=rev
Log:
refactoring
Modified:
webservices/axis/trunk/java/modules/samples/src/sample/amazon/search/ClientUtil.java
webservices/axis/trunk/java/modules/samples/src/sample/google/search/AsynchronousClient.java
webservices/axis/trunk/java/modules/samples/src/sample/google/search/ClientUtil.java
webservices/axis/trunk/java/modules/samples/src/sample/google/search/GUIHandler.java
Modified: webservices/axis/trunk/java/modules/samples/src/sample/amazon/search/ClientUtil.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/sample/amazon/search/ClientUtil.java?rev=191772&r1=191771&r2=191772&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/sample/amazon/search/ClientUtil.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/sample/amazon/search/ClientUtil.java Tue Jun 21 23:45:36 2005
@@ -106,7 +106,7 @@
ConfigurationContextFactory fac = new ConfigurationContextFactory();
ConfigurationContext configContext = null;
try {
- configContext = fac.buildClientEngineContext("Search");
+ configContext = fac.buildClientConfigurationContext("Search");
} catch (DeploymentException e) {
e.printStackTrace();
}
Modified: webservices/axis/trunk/java/modules/samples/src/sample/google/search/AsynchronousClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/sample/google/search/AsynchronousClient.java?rev=191772&r1=191771&r2=191772&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/sample/google/search/AsynchronousClient.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/sample/google/search/AsynchronousClient.java Tue Jun 21 23:45:36 2005
@@ -2,6 +2,10 @@
package sample.google.search;
import org.apache.axis.Constants;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.OMAbstractFactory;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.impl.llom.factory.OMXMLBuilderFactory;
import org.apache.axis.addressing.AddressingConstants;
import org.apache.axis.addressing.EndpointReference;
import org.apache.axis.clientapi.Call;
@@ -11,59 +15,63 @@
import sample.google.common.util.PropertyLoader;
import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLInputFactory;
import java.net.MalformedURLException;
import java.net.URL;
+import java.io.File;
+import java.io.FileInputStream;
/*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2001-2004 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
public class AsynchronousClient {
/**
- * Query parameter
- */
- protected String search = "";
-
- /**
- * Query parameters sent with the last request
- */
- protected String prevSearch = "";
-
- /**
- * Have to increase and set the start index when asking for more results
- */
- protected int StartIndex = 0;
-
- /**
- * License key
- */
- protected String key;
+ * Query parameter
+ */
+ protected String search = "";
- /** maximum results per page */
- protected String maxResults = String.valueOf(2);
+ /**
+ * Query parameters sent with the last request
+ */
+ protected String prevSearch = "";
+
+ /**
+ * Have to increase and set the start index when asking for more results
+ */
+ protected int StartIndex = 0;
+
+ /**
+ * License key
+ */
+ protected String key;
+
+ /** maximum results per page */
+ protected String maxResults = String.valueOf(2);
- private GUIHandler gui;
+ private GUIHandler gui;
public static void main(String[] args) {
- new AsynchronousClient();
+ new AsynchronousClient();
}
public AsynchronousClient() {
@@ -81,13 +89,13 @@
public synchronized void sendMsg() throws AxisFault {
-
search.trim();
prevSearch = search;
Call call = new Call();
URL url = null;
try {
- url = new URL("http", "api.google.com", "/search/beta2");
+ url = new URL("http", "api.google.com", "/search/beta2");
+ // url = new URL("http://127.0.0.1:8080/axis2/services/axisversion/viewVersion");
} catch (MalformedURLException e) {
e.printStackTrace();
System.exit(0);
@@ -100,6 +108,7 @@
call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, false);
QName opName = new QName("urn:GoogleSearch", "doGoogleSearch");
OperationDescription opdesc = new OperationDescription(opName);
+ // OperationDescription opdesc = new OperationDescription(new QName("viewVersion"));
call.invokeNonBlocking(opdesc, requestContext, new ClientCallbackHandler(this.gui));
} catch (AxisFault e1) {
@@ -149,7 +158,7 @@
this.maxResults = maxResults;
}
-
+
}
Modified: webservices/axis/trunk/java/modules/samples/src/sample/google/search/ClientUtil.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/sample/google/search/ClientUtil.java?rev=191772&r1=191771&r2=191772&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/sample/google/search/ClientUtil.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/sample/google/search/ClientUtil.java Tue Jun 21 23:45:36 2005
@@ -74,13 +74,13 @@
operation.addChild(getOMElement(omFactory,defNs,"safeSearch","xsd:boolean","false"));
operation.addChild(getOMElement(omFactory,defNs,"restrict","xsd:string",""));
operation.addChild(getOMElement(omFactory,defNs,"filter","xsd:boolean","true"));
- operation.addChild(getOMElement(omFactory,defNs,"maxResults","xsd:int",asyncClient.getMaxResults()));
+ operation.addChild(getOMElement(omFactory,defNs,"maxResults","xsd:int","10"));
operation.addChild(getOMElement(omFactory,defNs,"start","xsd:int",str_ST_index));
operation.addChild(getOMElement(omFactory,defNs,"q","xsd:string",asyncClient.getSearch()));
operation.addChild(getOMElement(omFactory,defNs,"key","xsd:string",asyncClient.getKey()));
ConfigurationContextFactory fac = new ConfigurationContextFactory();
- ConfigurationContext configContext = fac.buildClientEngineContext("doGoogleSearch");
+ ConfigurationContext configContext = fac.buildClientConfigurationContext("doGoogleSearch");
try {
msgContext = new MessageContext(configContext);
} catch (AxisFault axisFault) {
Modified: webservices/axis/trunk/java/modules/samples/src/sample/google/search/GUIHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/sample/google/search/GUIHandler.java?rev=191772&r1=191771&r2=191772&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/sample/google/search/GUIHandler.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/sample/google/search/GUIHandler.java Tue Jun 21 23:45:36 2005
@@ -102,7 +102,7 @@
}
});
settingsMenu.add(maxResultsMenuItem);
- maxResultsMenuItem.setEnabled(false);
+ maxResultsMenuItem.setEnabled(true);
maxResultsMenuItem.setToolTipText("This feature is currently disabled!");
JMenu helpMenu = new JMenu("Help");