You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2005/11/24 16:25:51 UTC

svn commit: r348753 - in /webservices/axis2/trunk/java/modules: core/src/org/apache/axis2/transport/http/ integration/ integration/itest/org/ integration/itest/org/apache/ integration/itest/org/apache/axis2/ integration/itest/org/apache/axis2/rest/ int...

Author: dims
Date: Thu Nov 24 07:25:42 2005
New Revision: 348753

URL: http://svn.apache.org/viewcvs?rev=348753&view=rev
Log:
- move rest tests from test to itest
- remove commented tests in project.xml
- reformat CommonsHTTPTransportSender
- change the constant (added an underscore between CONTENT and TYPE)
- Added a constant for REST content type.

TODO:
- Thilini please revisit CommonsHTTPSender (see my TODO comment in code)
- and get "maven all-tests" working with all the rest test cases
  (Please remove whatever is not needed or does not work)
- If possible get rid of the new RequestData class.


Added:
    webservices/axis2/trunk/java/modules/integration/itest/org/
    webservices/axis2/trunk/java/modules/integration/itest/org/apache/
    webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/
    webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/
      - copied from r348741, webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rest/
    webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/GetTest.java
      - copied, changed from r348751, webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rest/GetTest.java
    webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/HttpGetRESTBasedTest.java
      - copied, changed from r348751, webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rest/HttpGetRESTBasedTest.java
    webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/PostTest.java
      - copied, changed from r348751, webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rest/PostTest.java
    webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/RESTBasedEchoRawXMLTest.java
      - copied, changed from r348751, webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rest/RESTBasedEchoRawXMLTest.java
    webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/RESTGetTest.java
      - copied, changed from r348751, webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rest/RESTGetTest.java
Removed:
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rest/
Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPConstants.java
    webservices/axis2/trunk/java/modules/integration/project.xml

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?rev=348753&r1=348752&r2=348753&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java Thu Nov 24 07:25:42 2005
@@ -107,69 +107,67 @@
 
     public CommonsHTTPTransportSender() {
     } //default
-    
+
     public RequestData createRequest(MessageContext msgContext) {
-    	//This used to obtain two strings to go with the url and to pass in the body when doing 
-    	//POST with application/x-www-form-urlencoded
-    	RequestData data = new RequestData();
-     	String contentType = findContentType(true,msgContext);
-    	OMElement dataOut = msgContext.getEnvelope().getBody().getFirstElement();
-    	
-    	Iterator iter1 = dataOut.getChildElements();
-		ArrayList paraList = new ArrayList();
-		ArrayList urlList = new ArrayList();
-    	
-    	//String[] s  = new String[] {"abc","def","pqr"};
-		String[] s = new String[] {};
-            String ns = "http:/rwrfr";
-            OMElement bodypara = OMAbstractFactory.getOMFactory().createOMElement("dummy", null);
-            
-        	while(iter1.hasNext()){    
-        		OMElement ele = (OMElement)iter1.next();
-        		 boolean has = false;
-        	        
-        	        for(int i = 0;i<s.length; i++)
-        	        {
-        	        	if(s[i].equals(ele.getLocalName())){
-        	        		has = true;
-        	        		break;
-        	        	}
-        	        }
-        	    String parameter1;
-        	   
-        		if(has){
-        			parameter1 = ele.getLocalName() + "=" + ele.getText();
-        			urlList.add(parameter1);
-        		
-        		}else {
-        			bodypara.addChild(ele);
-        		}
-    	  	}
-        	
-        	String urlString= "";
-        	for(int i= 0; i<urlList.size() ; i++){
-        		String c = (String)urlList.get(i);
-        		urlString = urlString + "&" + c;
-        		data.urlRequest = urlString;
-        	}
-        	
-        	Iterator it = bodypara.getChildElements();
-        	while (it.hasNext()){
-        		OMElement ele1 = (OMElement)it.next();
-        		String parameter2;
-        		parameter2 = ele1.getLocalName() + "=" + ele1.getText();
-        		paraList.add(parameter2);
-        	}
-        	
-        	String paraString= "";
-           	for(int j= 0; j<paraList.size() ; j++){
-            	String b = (String)paraList.get(j);
-            	paraString = paraString + "&" + b;
-            	data.bodyRequest = paraString;
-        	}
-           	return data;
-	}
-    
+        //This used to obtain two strings to go with the url and to pass in the body when doing 
+        //POST with application/x-www-form-urlencoded
+        RequestData data = new RequestData();
+        String contentType = findContentType(true, msgContext);
+        OMElement dataOut = msgContext.getEnvelope().getBody().getFirstElement();
+
+        Iterator iter1 = dataOut.getChildElements();
+        ArrayList paraList = new ArrayList();
+        ArrayList urlList = new ArrayList();
+
+        //TODO: s is ALWAYS EMPTY. so what gets added to urllist????
+        String[] s = new String[]{};
+        OMElement bodypara = OMAbstractFactory.getOMFactory().createOMElement("dummy", null);
+
+        while (iter1.hasNext()) {
+            OMElement ele = (OMElement) iter1.next();
+            boolean has = false;
+
+            for (int i = 0; i < s.length; i++) {
+                if (s[i].equals(ele.getLocalName())) {
+                    has = true;
+                    break;
+                }
+            }
+            String parameter1;
+
+            if (has) {
+                parameter1 = ele.getLocalName() + "=" + ele.getText();
+                urlList.add(parameter1);
+
+            } else {
+                bodypara.addChild(ele);
+            }
+        }
+
+        String urlString = "";
+        for (int i = 0; i < urlList.size(); i++) {
+            String c = (String) urlList.get(i);
+            urlString = urlString + "&" + c;
+            data.urlRequest = urlString;
+        }
+
+        Iterator it = bodypara.getChildElements();
+        while (it.hasNext()) {
+            OMElement ele1 = (OMElement) it.next();
+            String parameter2;
+            parameter2 = ele1.getLocalName() + "=" + ele1.getText();
+            paraList.add(parameter2);
+        }
+
+        String paraString = "";
+        for (int j = 0; j < paraList.size(); j++) {
+            String b = (String) paraList.get(j);
+            paraString = paraString + "&" + b;
+            data.bodyRequest = paraString;
+        }
+        return data;
+    }
+
     public synchronized void invoke(MessageContext msgContext) throws AxisFault {
         try {
             String charSetEnc =
@@ -219,15 +217,15 @@
             // ######################################################
 
             OMElement dataOut;
-             /**
+            /**
              * Figuringout the REST properties/parameters
              */
             msgContext.setDoingREST(HTTPTransportUtils.isDoingREST(msgContext));
             msgContext.setRestThroughPOST(HTTPTransportUtils.isDoingRESTThoughPost(msgContext));
             boolean isRest = msgContext.isDoingREST();
-            
+
             if (isRest) {
-            	dataOut = msgContext.getEnvelope().getBody().getFirstElement();
+                dataOut = msgContext.getEnvelope().getBody().getFirstElement();
             } else {
                 dataOut = msgContext.getEnvelope();
             }
@@ -246,8 +244,8 @@
                     if (transportInfo != null) {
                         omOutput.setSoap11(msgContext.isSOAP11());
                         //this is the servlet2.3 way of setting encodings
-                        String contentType = findContentType(isRest,msgContext);
-						String encoding = contentType + "; charset=" + omOutput.getCharSetEncoding();
+                        String contentType = findContentType(isRest, msgContext);
+                        String encoding = contentType + "; charset=" + omOutput.getCharSetEncoding();
                         transportInfo.setContentType(encoding);
                     } else {
                         throw new AxisFault(HTTPConstants.HTTPOutTransportInfo + " does not set");
@@ -272,25 +270,25 @@
     }
 
     /**
-	 * @return
-	 */
-	private String findContentType(boolean isRest,MessageContext msgContext) {
-		if (isRest){
-			if (msgContext.getProperty("content Type")!=null){
-				String contentType = (String)msgContext.getProperty("content Type");
-			//get the users setting from the axis2.xml parameters
-			//if present return that
-			//else return the default (application/xml)
-				return contentType;
-			}else{
-				return "application/xml";
-			}
-		}else{
-			return omOutput.getContentType();
-		}
-	}
+     * @return
+     */
+    private String findContentType(boolean isRest, MessageContext msgContext) {
+        if (isRest) {
+            if (msgContext.getProperty(HTTPConstants.REST_CONTENT_TYPE) != null) {
+                String contentType = (String) msgContext.getProperty(HTTPConstants.REST_CONTENT_TYPE);
+                //get the users setting from the axis2.xml parameters
+                //if present return that
+                //else return the default (application/xml)
+                return contentType;
+            } else {
+                return "application/xml";
+            }
+        } else {
+            return omOutput.getContentType();
+        }
+    }
 
-	public void writeMessageWithToOutPutStream(
+    public void writeMessageWithToOutPutStream(
             MessageContext msgContext,
             OutputStream out) {
 
@@ -321,19 +319,19 @@
                         soapActionString);
             }
             if (msgContext.isDoingREST()) {
-            	if (msgContext.isRestThroughPOST()) {
-            		this.transportConfigurationPOST(
-                                msgContext,
-                                dataout,
-                                url,
-                                soapActionString);          	
-            	}
-         
-                 else {
+                if (msgContext.isRestThroughPOST()) {
+                    this.transportConfigurationPOST(
+                            msgContext,
+                            dataout,
+                            url,
+                            soapActionString);
+                }
+
+                else {
                     this.transportConfigurationGET(msgContext, url);
                 }
-        }
-            
+            }
+
         } catch (MalformedURLException e) {
             throw new AxisFault(e);
         } catch (HttpException e) {
@@ -344,39 +342,39 @@
 
     }
     // POST application/x-www-form-urlencoded
-    
-    public class PostAxisRequestEntity implements RequestEntity{
 
-    	private String charSetEnc;
-    	private String postRequestBody;
-    	private MessageContext msgCtxt;
-    	private String contentType;
-    	
-    	public PostAxisRequestEntity(String postRequestBody, String charSetEnc,MessageContext msgCtxt, String contentType) {
-    		this.postRequestBody = postRequestBody;
-    		this.charSetEnc = charSetEnc;
-    		this.msgCtxt = msgCtxt;
-    		this.contentType = contentType;
-    	}
-    	
-		public boolean isRepeatable() {			
-			return true;
-		}
-
-		
-		public void writeRequest(OutputStream output) throws IOException {		
-			output.write(postRequestBody.getBytes());			
-		}
-		
-		public long getContentLength() {
-			return this.postRequestBody.getBytes().length;
-		}
-
-		
-		public String getContentType() {			
-			return this.contentType;
-		}
-    	
+    public class PostAxisRequestEntity implements RequestEntity {
+
+        private String charSetEnc;
+        private String postRequestBody;
+        private MessageContext msgCtxt;
+        private String contentType;
+
+        public PostAxisRequestEntity(String postRequestBody, String charSetEnc, MessageContext msgCtxt, String contentType) {
+            this.postRequestBody = postRequestBody;
+            this.charSetEnc = charSetEnc;
+            this.msgCtxt = msgCtxt;
+            this.contentType = contentType;
+        }
+
+        public boolean isRepeatable() {
+            return true;
+        }
+
+
+        public void writeRequest(OutputStream output) throws IOException {
+            output.write(postRequestBody.getBytes());
+        }
+
+        public long getContentLength() {
+            return this.postRequestBody.getBytes().length;
+        }
+
+
+        public String getContentType() {
+            return this.contentType;
+        }
+
     }
 
     //get the contentLength...
@@ -428,7 +426,7 @@
                     element.serializeAndConsume(output);
                     output.flush();
                     return bytesOut.toByteArray();
-            
+
                 } else {
                     omOutput.setCharSetEncoding(charSetEnc);
                     omOutput.setOutputStream(bytesOut, true);  //changed...
@@ -509,7 +507,7 @@
         }
 
         public String getContentType() {
-        	
+
             String encoding = omOutput.getCharSetEncoding();
             String contentType = omOutput.getContentType();
             if (encoding != null) {
@@ -615,8 +613,8 @@
         //todo giving proxy and NTLM support
 
         PostMethod postMethod = new PostMethod(url.toString());
-        String contentType = findContentType(true,msgContext);
-        
+        String contentType = findContentType(true, msgContext);
+
         msgContext.setProperty(HTTP_METHOD, postMethod);
         String charEncoding =
                 (String) msgContext.getProperty(
@@ -624,31 +622,31 @@
         if (charEncoding == null) {
             charEncoding = MessageContext.DEFAULT_CHAR_SET_ENCODING;
         }
-        
+
         //if POST as application/x-www-form-urlencoded
         RequestData reqData = null;
-        if (contentType.equalsIgnoreCase(HTTPConstants.REST_CONTENTTYPE_URL_ENCODED)){
-        	reqData = createRequest(msgContext);
-        	postMethod.setPath(url.getPath()+ ((reqData.urlRequest) != null ? ("?" + reqData.urlRequest) : ""));
-        	postMethod.setRequestEntity(new PostAxisRequestEntity(reqData.bodyRequest,charEncoding,msgContext,contentType));
-        	
-        }else{
-        	postMethod.setPath(url.getPath());
-        	
-                
-        postMethod.setRequestEntity(
-                new AxisRequestEntity(
-                        dataout,
-                        chuncked,
-                        msgContext,
-                        charEncoding,
-                        soapActionString));
+        if (contentType.equalsIgnoreCase(HTTPConstants.REST_CONTENT_TYPE_URL_ENCODED)) {
+            reqData = createRequest(msgContext);
+            postMethod.setPath(url.getPath() + ((reqData.urlRequest) != null ? ("?" + reqData.urlRequest) : ""));
+            postMethod.setRequestEntity(new PostAxisRequestEntity(reqData.bodyRequest, charEncoding, msgContext, contentType));
+
+        } else {
+            postMethod.setPath(url.getPath());
+
+
+            postMethod.setRequestEntity(
+                    new AxisRequestEntity(
+                            dataout,
+                            chuncked,
+                            msgContext,
+                            charEncoding,
+                            soapActionString));
         }
 
         if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10)
                 && chuncked) {
             postMethod.setContentChunked(true);
-        } 
+        }
         postMethod.setRequestHeader(
                 HTTPConstants.HEADER_USER_AGENT,
                 "Axis/2.0");
@@ -751,50 +749,50 @@
     }
 
     //Method to return the parameter string to pass with the URL when using GET   
-    
-    public String getParam(MessageContext msgContext){
-    	OMElement dataOut;
-    	dataOut = msgContext.getEnvelope().getBody().getFirstElement();
-		Iterator iter1 = dataOut.getChildElements();
-    	ArrayList paraList = new ArrayList();
-    	       
-    	while(iter1.hasNext()){
-    		OMElement ele = (OMElement)iter1.next();
-    		String parameter;
-    		parameter = ele.getLocalName() + "=" + ele.getText();
-    		paraList.add(parameter);
-    	}
-    	
-    		String paraString= "";
-    		int count = paraList.size();
-    		for(int i= 0; i<count ; i++){
-    			String c = (String)paraList.get(i);
-    			paraString = paraString + "&" + c;
-    		}
-    	return paraString;
-	}
-    
+
+    public String getParam(MessageContext msgContext) {
+        OMElement dataOut;
+        dataOut = msgContext.getEnvelope().getBody().getFirstElement();
+        Iterator iter1 = dataOut.getChildElements();
+        ArrayList paraList = new ArrayList();
+
+        while (iter1.hasNext()) {
+            OMElement ele = (OMElement) iter1.next();
+            String parameter;
+            parameter = ele.getLocalName() + "=" + ele.getText();
+            paraList.add(parameter);
+        }
+
+        String paraString = "";
+        int count = paraList.size();
+        for (int i = 0; i < count; i++) {
+            String c = (String) paraList.get(i);
+            paraString = paraString + "&" + c;
+        }
+        return paraString;
+    }
+
     private void transportConfigurationGET(MessageContext msgContext, URL url)
             throws MalformedURLException, AxisFault, IOException {
-    	
-    	String param = getParam(msgContext);
-  	    GetMethod getMethod = new GetMethod();
-        getMethod.setPath(url.getFile()+"?"+param);
+
+        String param = getParam(msgContext);
+        GetMethod getMethod = new GetMethod();
+        getMethod.setPath(url.getFile() + "?" + param);
 
         //Serialization as "application/x-www-form-urlencoded"
-        
-       String charEncoding =
+
+        String charEncoding =
                 (String) msgContext.getProperty(
                         MessageContext.CHARACTER_SET_ENCODING);
         if (charEncoding == null) //Default encoding scheme
             getMethod.setRequestHeader(
                     HTTPConstants.HEADER_CONTENT_TYPE,
-                    HTTPConstants.REST_CONTENTTYPE_URL_ENCODED +"; charset="
+                    HTTPConstants.REST_CONTENT_TYPE_URL_ENCODED + "; charset="
                             + MessageContext.DEFAULT_CHAR_SET_ENCODING);
         else
             getMethod.setRequestHeader(
                     HTTPConstants.HEADER_CONTENT_TYPE,
-                    HTTPConstants.REST_CONTENTTYPE_URL_ENCODED + "; charset=" + charEncoding);
+                    HTTPConstants.REST_CONTENT_TYPE_URL_ENCODED + "; charset=" + charEncoding);
 
         this.httpClient = new HttpClient();
 
@@ -1007,14 +1005,15 @@
         client.getState().setProxyCredentials(AuthScope.ANY, proxyCred);
         config.setProxy(proxyHostName, proxyPort);
     }
-    
+
     //
-    private class RequestData{
-    	String urlRequest;
-		String bodyRequest;
-		}
-    	String urlRequest;
-    	String bodyRequest;
-	}
+    private class RequestData {
+        String urlRequest;
+        String bodyRequest;
+    }
+
+    String urlRequest;
+    String bodyRequest;
+}
 
 

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPConstants.java?rev=348753&r1=348752&r2=348753&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPConstants.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPConstants.java Thu Nov 24 07:25:42 2005
@@ -24,7 +24,9 @@
  */
 public class HTTPConstants {
 
-	public static final String REST_CONTENTTYPE_URL_ENCODED="application/x-www-form-urlencoded" ;
+    public static final String REST_CONTENT_TYPE ="REST_CONTENT_TYPE" ;
+
+	public static final String REST_CONTENT_TYPE_URL_ENCODED ="application/x-www-form-urlencoded" ;
 	
     public static final String PROTOCOL_VERSION = "PROTOCOL";
 

Copied: webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/GetTest.java (from r348751, webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rest/GetTest.java)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/GetTest.java?p2=webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/GetTest.java&p1=webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rest/GetTest.java&r1=348751&r2=348753&rev=348753&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rest/GetTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/GetTest.java Thu Nov 24 07:25:42 2005
@@ -1,16 +1,27 @@
-package org.apache.axis2.rest;
+/*
+ * Copyright 2004,2005 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.
+ */
 
-import java.io.ByteArrayInputStream;
+package org.apache.axis2.rest;
 
+import junit.framework.TestCase;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Call;
 import org.apache.axis2.engine.util.TestConstants;
-//import org.apache.axis2.clientapi.RESTCall;
-import org.apache.axis2.om.OMAbstractFactory;
 import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMFactory;
-import org.apache.axis2.om.OMNamespace;
 import org.apache.axis2.om.impl.OMOutputImpl;
 import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
 
@@ -19,55 +30,42 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
-
-import junit.framework.TestCase;
+import java.io.ByteArrayInputStream;
 
 public class GetTest extends TestCase implements TestConstants {
 
-	public void testRESTGet() throws Exception{
+    public void testRESTGet() throws Exception {
+
+        String epr = "http://localhost:8080/axis2/services/MyService";
 
-            String epr = "http://localhost:8080/axis2/services/MyService";
-        	
-            String  xml = 
-            	"<echo>"+
-				"<Text>Hello</Text>"+
-				"</echo>";
-        	
-        	byte arr[] = xml.getBytes();
-        	ByteArrayInputStream bais = new ByteArrayInputStream(arr);
-        	
-        	XMLStreamReader reader = null;
-        	try {
-        		XMLInputFactory xif= XMLInputFactory.newInstance();
-        		reader= xif.createXMLStreamReader(bais);
-        	} catch (XMLStreamException e) {
-        		e.printStackTrace();
-        	}
-        	StAXOMBuilder builder= new StAXOMBuilder(reader);
-        	OMElement data = builder.getDocumentElement();
-            
-        	OMFactory fac = OMAbstractFactory.getOMFactory();
-            /*OMNamespace omNs = fac.createOMNamespace("http://example1.org/example1", "example1");
-            OMElement payload = fac.createOMElement("echo", omNs);
-            OMElement value = fac.createOMElement("Text", omNs);
-            value.addChild(fac.createText(value, "Hello"));
-            payload.addChild(value);*/
-
-            //RESTCall call = new RESTCall();
-        	//OMElement val = fac.
-            Call call = new Call();
-            call.setTo(new EndpointReference(epr));
-            call.setTransportInfo(Constants.TRANSPORT_HTTP,Constants.TRANSPORT_HTTP, false);
-            call.set(Constants.Configuration.ENABLE_REST,Constants.VALUE_TRUE);
-            call.set(Constants.Configuration.ENABLE_REST_THROUGH_GET,Constants.VALUE_TRUE);
-
-            //if post is through GET of HTTP
-            //OMElement response = call.invokeBlocking("webSearch",data);
-            OMElement response = call.invokeBlocking("webSearch",data);
-            //OMElement response = call.invokeBlocking();  
-            XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
-            response.serialize(new OMOutputImpl(writer));
-            writer.flush();
-		}
+        String xml = "<echo>" +
+                "<Text>Hello</Text>" +
+                "</echo>";
+
+        byte arr[] = xml.getBytes();
+        ByteArrayInputStream bais = new ByteArrayInputStream(arr);
+
+        XMLStreamReader reader = null;
+        try {
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+            reader = xif.createXMLStreamReader(bais);
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+        }
+        StAXOMBuilder builder = new StAXOMBuilder(reader);
+        OMElement data = builder.getDocumentElement();
+
+        Call call = new Call();
+        call.setTo(new EndpointReference(epr));
+        call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, false);
+        call.set(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE);
+        call.set(Constants.Configuration.ENABLE_REST_THROUGH_GET, Constants.VALUE_TRUE);
+
+        //if post is through GET of HTTP
+        OMElement response = call.invokeBlocking("webSearch", data);
+        XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
+        response.serialize(new OMOutputImpl(writer));
+        writer.flush();
+    }
 }
 

Copied: webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/HttpGetRESTBasedTest.java (from r348751, webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rest/HttpGetRESTBasedTest.java)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/HttpGetRESTBasedTest.java?p2=webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/HttpGetRESTBasedTest.java&p1=webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rest/HttpGetRESTBasedTest.java&r1=348751&r2=348753&rev=348753&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rest/HttpGetRESTBasedTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/HttpGetRESTBasedTest.java Thu Nov 24 07:25:42 2005
@@ -16,8 +16,6 @@
 
 package org.apache.axis2.rest;
 
-//todo
-
 import junit.framework.TestCase;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.engine.Echo;

Copied: webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/PostTest.java (from r348751, webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rest/PostTest.java)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/PostTest.java?p2=webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/PostTest.java&p1=webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rest/PostTest.java&r1=348751&r2=348753&rev=348753&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rest/PostTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/PostTest.java Thu Nov 24 07:25:42 2005
@@ -17,79 +17,63 @@
 
 package org.apache.axis2.rest;
 
+import junit.framework.TestCase;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Call;
 import org.apache.axis2.engine.util.TestConstants;
-import org.apache.axis2.om.OMAbstractFactory;
 import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMFactory;
-import org.apache.axis2.om.OMNamespace;
 import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
+import org.apache.axis2.transport.http.HTTPConstants;
 
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
-
 import java.io.ByteArrayInputStream;
 import java.io.StringWriter;
 
-import junit.framework.TestCase;
-
 /**
  * Sample for synchronous single channel blocking service invocation.
  * Message Exchage Pattern IN-OUT
  */
-public class PostTest extends TestCase implements TestConstants{
-    //private static EndpointReference targetEPR = new EndpointReference("http://localhost:8080/axis2/services/MyService");
-	//private static EndpointReference targetEPR = new EndpointReference("http://127.0.0.1:80/axis2/services/MyService");
+public class PostTest extends TestCase implements TestConstants {
     private static EndpointReference targetEPR = new EndpointReference("http://127.0.0.1:8070/onca/xml");
-    
-    public void testRESTPost() throws Exception{
+
+    public void testRESTPost() throws Exception {
         try {
-           // OMElement payload = ClientUtil.getEchoOMElement();
-        	/*OMFactory fac = OMAbstractFactory.getOMFactory();
-            OMNamespace omNs = fac.createOMNamespace("http://example1.org/example1", "example1");
-            OMElement payload = fac.createOMElement("echo", omNs);
-            OMElement value = fac.createOMElement("Text", omNs);
-            value.addChild(fac.createText(value, "Hello"));
-            payload.addChild(value);*/
-
-        	String  xml = 
-        		"<websearch>"+
-        		"<Service>AWSECommerceService</Service>"+
-        		"<SubscriptionId>03WM83XFMP0X52C7A9R2</SubscriptionId>"+
-        		"<Operation>ItemSearch</Operation>"+
-        		"<SearchIndex>Books</SearchIndex>"+
-        		"<Keywords>Sanjiva,Web,Services</Keywords>"+
-        		"<ResponseGroup>Request,Small</ResponseGroup>"+
-        		"</websearch>";
-        	
-        	byte arr[] = xml.getBytes();
-        	ByteArrayInputStream bais = new ByteArrayInputStream(arr);
-        	
-        	XMLStreamReader reader = null;
-        	try {
-        		XMLInputFactory xif= XMLInputFactory.newInstance();
-        		reader= xif.createXMLStreamReader(bais);
-        	} catch (XMLStreamException e) {
-        		e.printStackTrace();
-        	}
-        	StAXOMBuilder builder= new StAXOMBuilder(reader);
-        	OMElement websearch = builder.getDocumentElement();
-        	
-        	Call call = new Call();
+            String xml =
+                    "<websearch>" +
+                            "<Service>AWSECommerceService</Service>" +
+                            "<SubscriptionId>03WM83XFMP0X52C7A9R2</SubscriptionId>" +
+                            "<Operation>ItemSearch</Operation>" +
+                            "<SearchIndex>Books</SearchIndex>" +
+                            "<Keywords>Sanjiva,Web,Services</Keywords>" +
+                            "<ResponseGroup>Request,Small</ResponseGroup>" +
+                            "</websearch>";
+
+            byte arr[] = xml.getBytes();
+            ByteArrayInputStream bais = new ByteArrayInputStream(arr);
+
+            XMLStreamReader reader = null;
+            try {
+                XMLInputFactory xif = XMLInputFactory.newInstance();
+                reader = xif.createXMLStreamReader(bais);
+            } catch (XMLStreamException e) {
+                e.printStackTrace();
+            }
+            StAXOMBuilder builder = new StAXOMBuilder(reader);
+            OMElement websearch = builder.getDocumentElement();
+
+            Call call = new Call();
             call.setTo(targetEPR);
-            call.setTransportInfo(Constants.TRANSPORT_HTTP,Constants.TRANSPORT_HTTP,false);
-            call.set(Constants.Configuration.ENABLE_REST,Constants.VALUE_TRUE);
-            //call.set(Constants.Configuration.ENABLE_REST_THROUGH_GET,Constants.VALUE_TRUE);
-            call.set("content Type","application/x-www-form-urlencoded");
+            call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, false);
+            call.set(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE);
+            call.set(HTTPConstants.REST_CONTENT_TYPE, "application/x-www-form-urlencoded");
 
             //Blocking invocation
-            //OMElement result = call.invokeBlocking("echo",payload);
-            OMElement result = call.invokeBlocking("echo",websearch);
+            OMElement result = call.invokeBlocking("echo", websearch);
 
             StringWriter writer = new StringWriter();
             result.serialize(XMLOutputFactory.newInstance()
@@ -104,5 +88,5 @@
             e.printStackTrace();
         }
     }
-    }
+}
 

Copied: webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/RESTBasedEchoRawXMLTest.java (from r348751, webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rest/RESTBasedEchoRawXMLTest.java)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/RESTBasedEchoRawXMLTest.java?p2=webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/RESTBasedEchoRawXMLTest.java&p1=webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rest/RESTBasedEchoRawXMLTest.java&r1=348751&r2=348753&rev=348753&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rest/RESTBasedEchoRawXMLTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/RESTBasedEchoRawXMLTest.java Thu Nov 24 07:25:42 2005
@@ -39,17 +39,8 @@
 
 public class RESTBasedEchoRawXMLTest extends TestCase implements TestConstants {
 
-    private Log log = LogFactory.getLog(getClass());
-
     private AxisService service;
 
-    private boolean finish = false;
-
-
-    private Thread thread;
-
-    private final MessageInformation messageInfo = new MessageInformation();
-
     public RESTBasedEchoRawXMLTest() {
         super(RESTBasedEchoRawXMLTest.class.getName());
     }
@@ -69,49 +60,6 @@
                         Echo.class.getName(),
                         operationName);
         UtilServer.deployService(service);
-//                
-//         Runnable runnable = new Runnable() {
-//            public void run() {
-//                try {
-//                    ServerSocket socket = new ServerSocket(UtilServer.TESTING_PORT+345);
-//                    Socket clientSocket = socket.accept();
-//                    
-//                    InputStream in = clientSocket.getInputStream();
-//                    OutputStream out = clientSocket.getOutputStream();
-//                    
-//                    
-//                    byte[] byteBuff = new byte[in.available()];
-//                    in.read(byteBuff);
-//                    messageInfo.requestMessage = new String(byteBuff);
-//                    
-//                    Socket toServer = new Socket();
-//                    toServer.connect(new InetSocketAddress(UtilServer.TESTING_PORT));
-//                    OutputStream toServerOut = toServer.getOutputStream();
-//                    toServerOut.write(messageInfo.requestMessage.getBytes());
-//                    toServerOut.flush();
-//                    
-//                    InputStream fromServerIn = toServer.getInputStream();
-//                    byteBuff = new byte[fromServerIn.available()];
-//                    fromServerIn.read(byteBuff);
-//                    messageInfo.responseMessage = new String(byteBuff);
-//                    out.write(messageInfo.responseMessage.getBytes());
-//                    Thread.sleep(30000);
-//                    out.flush();
-//                    
-//                    toServer.close();
-//                    clientSocket.close();
-//                    socket.close();
-//                } catch (Exception e) {
-//                    // TODO Auto-generated catch block
-//                    e.printStackTrace();
-//                }
-//
-//            }
-//        };
-//        thread = new Thread(runnable);
-//        thread.start();
-
-
     }
 
     protected void tearDown() throws Exception {
@@ -133,30 +81,22 @@
 
 
     public void testEchoXMLSync() throws Exception {
-        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
-
         OMElement payload = createEnvelope();
 
         org.apache.axis2.client.Call call =
-                new org.apache.axis2.client.Call("target/test-resources/intregrationRepo");
+                new org.apache.axis2.client.Call("target/test-resources/integrationRepo");
 
         call.setTo(targetEPR);
         call.setTransportInfo(Constants.TRANSPORT_HTTP,
                 Constants.TRANSPORT_HTTP,
                 false);
-        //call.setDoREST(true);
-        call.set(Constants.Configuration.ENABLE_REST,Constants.VALUE_TRUE);
+        call.set(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE);
         OMElement result =
                 call.invokeBlocking(operationName.getLocalPart(),
                         payload);
         result.serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(
-                                System.out));
+                System.out));
 
         call.close();
-    }
-
-    public class MessageInformation {
-        private String requestMessage = null;
-        private String responseMessage = null;
     }
 }

Copied: webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/RESTGetTest.java (from r348751, webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rest/RESTGetTest.java)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/RESTGetTest.java?p2=webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/RESTGetTest.java&p1=webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rest/RESTGetTest.java&r1=348751&r2=348753&rev=348753&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rest/RESTGetTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/RESTGetTest.java Thu Nov 24 07:25:42 2005
@@ -6,87 +6,60 @@
  */
 package org.apache.axis2.rest;
 
-import java.io.ByteArrayInputStream;
-
-import javax.xml.stream.FactoryConfigurationError;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
 import junit.framework.TestCase;
-
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Call;
-//import org.apache.axis2.client.*;
 import org.apache.axis2.engine.util.TestConstants;
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.impl.OMOutputImpl;
 import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
 
-/**
- * @author Thilini
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.ByteArrayInputStream;
 
 //This Sample test Client is written for Yahoo Web Search
+public class RESTGetTest extends TestCase implements TestConstants {
+
+    public void testRESTGet() throws Exception {
+        String epr = "http://api.search.yahoo.com/WebSearchService/V1/webSearch";
+
+        String xml =
+                "<websearch>" +
+                        "<appid>ApacheRestDemo</appid>" +
+                        "<query>finances</query>" +
+                        "<format>pdf</format>" +
+                        "</websearch>";
 
-public class RESTGetTest extends TestCase implements TestConstants{
-	
-	public void testRESTGet(){
-		//String epr = "http://api.search.yahoo.com/WebSearchService/V1/webSearch?appid=ApacheRestDemo&query=finances&format=pdf";
-    	//String epr = "http://127.0.0.1:8080/WebSearchService/V1/webSearch";
-    	//String epr = "http://webservices.amazon.com/onca/xml";
-    	String epr = "http://api.search.yahoo.com/WebSearchService/V1/webSearch";
-    	
-        String  xml = 
-        	"<websearch>"+
-			"<appid>ApacheRestDemo</appid>"+
-			"<query>finances</query>"+
-			"<format>pdf</format>"+
-			"</websearch>";
-    	
-    	byte arr[] = xml.getBytes();
-    	ByteArrayInputStream bais = new ByteArrayInputStream(arr);
-    	
-    	XMLStreamReader reader = null;
-    	try {
-    		XMLInputFactory xif= XMLInputFactory.newInstance();
-    		reader= xif.createXMLStreamReader(bais);
-    	} catch (XMLStreamException e) {
-    		e.printStackTrace();
-    	}
-    	StAXOMBuilder builder= new StAXOMBuilder(reader);
-    	OMElement data = builder.getDocumentElement();
+        byte arr[] = xml.getBytes();
+        ByteArrayInputStream bais = new ByteArrayInputStream(arr);
 
+        XMLStreamReader reader = null;
         try {
-			//RESTCall call = new RESTCall();
-			Call call = new Call();
-			call.setTo(new EndpointReference(epr));
-			call.setTransportInfo(Constants.TRANSPORT_HTTP,Constants.TRANSPORT_HTTP, false);
-			call.set(Constants.Configuration.ENABLE_REST,Constants.VALUE_TRUE);
-			call.set(Constants.Configuration.ENABLE_REST_THROUGH_GET,Constants.VALUE_TRUE);
-
-			//if post is through GET of HTTP
-			OMElement response = call.invokeBlocking("webSearch",data);
-			//OMElement response = call.invokeBlocking();  
-			XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
-			response.serialize(new OMOutputImpl(writer));
-			writer.flush();
-		} catch (AxisFault e1) {
-			// TODO Auto-generated catch block
-			e1.printStackTrace();
-		} catch (XMLStreamException e1) {
-			// TODO Auto-generated catch block
-			e1.printStackTrace();
-		} catch (FactoryConfigurationError e1) {
-			// TODO Auto-generated catch block
-			e1.printStackTrace();
-		}   
-	}
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+            reader = xif.createXMLStreamReader(bais);
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+        }
+        StAXOMBuilder builder = new StAXOMBuilder(reader);
+        OMElement data = builder.getDocumentElement();
+
+        Call call = new Call();
+        call.setTo(new EndpointReference(epr));
+        call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, false);
+        call.set(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE);
+        call.set(Constants.Configuration.ENABLE_REST_THROUGH_GET, Constants.VALUE_TRUE);
+
+        //if post is through GET of HTTP
+        OMElement response = call.invokeBlocking("webSearch", data);
+        XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
+        response.serialize(new OMOutputImpl(writer));
+        writer.flush();
+    }
 }

Modified: webservices/axis2/trunk/java/modules/integration/project.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/project.xml?rev=348753&r1=348752&r2=348753&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/project.xml (original)
+++ webservices/axis2/trunk/java/modules/integration/project.xml Thu Nov 24 07:25:42 2005
@@ -272,10 +272,6 @@
                 <exclude>**org/apache/axis2/mail/*.java</exclude>
                 <exclude>**org/apache/axis2/soap12testing/soap12testsuite/*.java</exclude>
                 <exclude>**/ScenarioST1Test.java</exclude>
-                <!-- exclude the rest test cases -->
-                <exclude>**/GetTest.java</exclude>
-                <exclude>**/PostTest.java</exclude>
-                <exclude>**/RESTGetTest.java</exclude>
             </excludes>
             <includes>
                 <include>**/*Test.java</include>