axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chinth...@apache.org
Subject svn commit: r418772 - in /webservices/axis2/trunk/java/modules: core/src/org/apache/axis2/addressing/ core/src/org/apache/axis2/client/ core/src/org/apache/axis2/client/async/ samples/src/sample/yahooservices/RESTSearch/
Date Mon, 03 Jul 2006 14:06:27 GMT
Author: chinthaka
Date: Mon Jul  3 07:06:26 2006
New Revision: 418772

URL: http://svn.apache.org/viewvc?rev=418772&view=rev
Log:
- Yahoo search REST example was wrong and fixed that.
- improved some of the classes a bit

Removed:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/RESTCall.java
Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/EndpointReference.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/async/AsyncResult.java
    webservices/axis2/trunk/java/modules/samples/src/sample/yahooservices/RESTSearch/RESTSearchClient.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/EndpointReference.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/EndpointReference.java?rev=418772&r1=418771&r2=418772&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/EndpointReference.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/EndpointReference.java
Mon Jul  3 07:06:26 2006
@@ -24,7 +24,6 @@
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.description.AxisOperation;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -49,9 +48,9 @@
     
     /**
      * <EndpointReference>
-     * <Address>xs:anyURI</Address>
-     * <ReferenceParameters>xs:any*</ReferenceParameters>
-     * <MetaData>xs:any*</MetaData>
+     *    <Address>xs:anyURI</Address>
+     *    <ReferenceParameters>xs:any*</ReferenceParameters>
+     *    <MetaData>xs:any*</MetaData>
      * <!-- In addition to this, EPR can contain any number of OMElements -->
      * </EndpointReference>
      */

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/async/AsyncResult.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/async/AsyncResult.java?rev=418772&r1=418771&r2=418772&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/async/AsyncResult.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/async/AsyncResult.java
Mon Jul  3 07:06:26 2006
@@ -31,11 +31,16 @@
      */
     private MessageContext result;
 
+    /**
+     *
+     * @param result - resulting message context
+     */
     public AsyncResult(MessageContext result) {
         this.result = result;
     }
 
     /**
+     * This will return the message context of the resulting message context
      * @return SOAPEnvelope
      */
     public SOAPEnvelope getResponseEnvelope() {

Modified: webservices/axis2/trunk/java/modules/samples/src/sample/yahooservices/RESTSearch/RESTSearchClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/samples/src/sample/yahooservices/RESTSearch/RESTSearchClient.java?rev=418772&r1=418771&r2=418772&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/src/sample/yahooservices/RESTSearch/RESTSearchClient.java
(original)
+++ webservices/axis2/trunk/java/modules/samples/src/sample/yahooservices/RESTSearch/RESTSearchClient.java
Mon Jul  3 07:06:26 2006
@@ -16,33 +16,51 @@
 
 package sample.yahooservices.RESTSearch;
 
+import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Options;
-import org.apache.axis2.client.RESTCall;
+import org.apache.axis2.client.ServiceClient;
 
 public class RESTSearchClient {
     public static void main(String[] args) {
         try {
 
-            String epr = "http://api.search.yahoo.com/WebSearchService/V1/webSearch?appid=ApacheRestDemo&query=finances&format=pdf";
+//            String epr = "http://api.search.yahoo.com/WebSearchService/V1/webSearch?appid=ApacheRestDemo&query=finances&format=pdf";
+            String epr = "http://api.search.yahoo.com/WebSearchService/V1/webSearch";
 
-            RESTCall call = new RESTCall();
+            ServiceClient client = new ServiceClient();
             Options options = new Options();
-            call.setOptions(options);
+            client.setOptions(options);
             options.setTo(new EndpointReference(epr));
-            options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
             options.setProperty(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE);
-            options.setProperty(Constants.Configuration.ENABLE_REST_THROUGH_GET, Constants.VALUE_TRUE);
+            options.setProperty(Constants.Configuration.HTTP_METHOD, Constants.Configuration.HTTP_METHOD_GET);
 
             //if post is through GET of HTTP
-            OMElement response = call.sendReceive();
-            response.serialize(System.out);
+            OMElement response = client.sendReceive(getPayloadForYahooSearchCall());
+            System.out.println("response = " + response);
 
         } catch (Exception e) {
             e.printStackTrace();
         }
+    }
+
+    private static OMElement getPayloadForYahooSearchCall() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        OMElement rootElement = fac.createOMElement("webSearch", null);
+
+        OMElement appId = fac.createOMElement("appid", null, rootElement);
+        appId.setText("ApacheRestDemo");
+
+        OMElement query = fac.createOMElement("query", null, rootElement);
+        query.setText("Axis2");
+
+        OMElement format = fac.createOMElement("format", null, rootElement);
+        format.setText("pdf");
+
+        return rootElement;
     }
 
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message