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 he...@apache.org on 2005/06/30 08:51:57 UTC

svn commit: r202496 - in /webservices/axis/trunk/java: modules/core/src/org/apache/axis/ modules/core/src/org/apache/axis/clientapi/ modules/core/src/org/apache/axis/deployment/ modules/core/src/org/apache/axis/transport/http/ modules/samples/test/org/...

Author: hemapani
Date: Wed Jun 29 23:51:55 2005
New Revision: 202496

URL: http://svn.apache.org/viewcvs?rev=202496&view=rev
Log:
fix to the REST support

Modified:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/Constants.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOnlyMEPClient.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOutMEPClient.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/TwoChannelBasedSender.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/axis2.xml
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportUtils.java
    webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/chuncking-enabled-axis2.xml
    webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/commons-http-enabled-axis2.xml
    webservices/axis/trunk/java/modules/samples/test/org/apache/axis/mail/mail-enabled-axis2.xml
    webservices/axis/trunk/java/modules/samples/test/org/apache/axis/rest/RESTBasedEchoRawXMLTest.java
    webservices/axis/trunk/java/xdocs/rest-ws.html

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/Constants.java?rev=202496&r1=202495&r2=202496&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/Constants.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/Constants.java Wed Jun 29 23:51:55 2005
@@ -165,12 +165,9 @@
 
 
    public static interface Configuration {
-        public static final String DO_REST = "doREST";
         public static final String ENABLE_REST = "enableREST";
         // globally enable MTOM 
         public static final String ENABLE_MTOM = "enableMTOM";
-        //set after checking the Envelope & ENABLE_MTOM
-        //public static final String DO_MTOM = "doMTOM";
     }
     public static final String VALUE_TRUE = "true";
     public static final String VALUE_FALSE = "false";
@@ -178,8 +175,8 @@
     public static final String RESPONSE_WRITTEN = "CONTENT_WRITTEN";
     
     
-    public static final String TESTING_PATH = "target/test-resources/"; 
-   //public static final String TESTING_PATH = "modules/samples/target/test-resources/";
+    //public static final String TESTING_PATH = "target/test-resources/"; 
+   public static final String TESTING_PATH = "modules/samples/target/test-resources/";
    
    public static final String TESTING_REPOSITORY = TESTING_PATH+ "samples";
    

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOnlyMEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOnlyMEPClient.java?rev=202496&r1=202495&r2=202496&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOnlyMEPClient.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOnlyMEPClient.java Wed Jun 29 23:51:55 2005
@@ -43,7 +43,7 @@
     }
 
     public void send(OperationDescription axisop, final MessageContext msgctx) throws AxisFault {
-        verifyInvocation(axisop);
+        verifyInvocation(axisop,msgctx);
         msgctx.setSoapAction(soapAction);
         msgctx.setMessageInformationHeaders(messageInformationHeaders);
         msgctx.setServiceContext(serviceContext);

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOutMEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOutMEPClient.java?rev=202496&r1=202495&r2=202496&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOutMEPClient.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOutMEPClient.java Wed Jun 29 23:51:55 2005
@@ -61,6 +61,7 @@
      */
     protected boolean useSeparateListener = false;
 
+
     /**
      * The address the message should be send
      */
@@ -108,7 +109,7 @@
 
     public MessageContext invokeBlocking(OperationDescription axisop, final MessageContext msgctx)
         throws AxisFault {
-        verifyInvocation(axisop);
+        verifyInvocation(axisop,msgctx);
         if (useSeparateListener) {
             SyncCallBack callback = new SyncCallBack();
             invokeNonBlocking(axisop, msgctx, callback);
@@ -167,7 +168,7 @@
         final MessageContext msgctx,
         final Callback callback)
         throws AxisFault {
-        verifyInvocation(axisop);
+        verifyInvocation(axisop,msgctx);
         msgctx.setTo(to);
         try {
             final ConfigurationContext syscontext = serviceContext.getEngineContext();
@@ -343,4 +344,5 @@
             }
         }
     }
+   
 }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java?rev=202496&r1=202495&r2=202496&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java Wed Jun 29 23:51:55 2005
@@ -41,6 +41,12 @@
     protected final String mep;
     protected String soapVersionURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
     protected String soapAction = "";
+    protected boolean doREST = false; 
+
+    public void setDoREST(boolean b) {
+       doREST = b;
+   }
+
 
     public String getSoapAction() {
         return soapAction;
@@ -51,7 +57,7 @@
         this.mep = mep;
     }
 
-    protected void verifyInvocation(OperationDescription axisop) throws AxisFault {
+    protected void verifyInvocation(OperationDescription axisop,MessageContext msgCtx) throws AxisFault {
         if (axisop == null) {
             throw new AxisFault("OperationDescription can not be null");
         }
@@ -66,6 +72,7 @@
         if (serviceContext.getServiceConfig().getOperation(axisop.getName()) == null) {
             serviceContext.getServiceConfig().addOperation(axisop);
         }
+        msgCtx.setDoingREST(doREST);
     }
 
     protected MessageContext prepareTheSystem(OMElement toSend) throws AxisFault {

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/TwoChannelBasedSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/TwoChannelBasedSender.java?rev=202496&r1=202495&r2=202496&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/TwoChannelBasedSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/TwoChannelBasedSender.java Wed Jun 29 23:51:55 2005
@@ -55,7 +55,7 @@
         response.setServerSide(false);
         response.setOperationContext(msgctx.getOperationContext());
         response.setServiceContext(msgctx.getServiceContext());
-
+        response.setDoingREST(msgctx.isDoingREST());
         
         SOAPEnvelope resenvelope = TransportUtils.createSOAPMessage(response);
 //                try {

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/axis2.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/axis2.xml?rev=202496&r1=202495&r2=202496&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/axis2.xml (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/axis2.xml Wed Jun 29 23:51:55 2005
@@ -5,7 +5,7 @@
     <parameter name="hotdeployment" locked="xsd:false">true</parameter>
     <parameter name="hotupdate" locked="xsd:false">false</parameter>
     <!-- Uncomment this to enable REST support -->
-<!--    <parameter name="eanbleREST" locked="xsd:false">true</parameter>-->
+<!--    <parameter name="enableREST" locked="xsd:false">true</parameter>-->
 
 
 

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportUtils.java?rev=202496&r1=202495&r2=202496&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportUtils.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportUtils.java Wed Jun 29 23:51:55 2005
@@ -80,11 +80,10 @@
 			} else if (contentType != null
 					&& contentType.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) > -1) {
                  //If the content Type is text/xml (BTW which is the SOAP 1.1 Content type ) and
-                 //the SOAP Action is absent it is rest !!        
+                 //the SOAP Action is absent it is rest !!    
+                Object enable =  msgContext.getProperty(Constants.Configuration.ENABLE_REST);
 				if ((soapAction == null || soapAction.length() == 0)
-						&& Constants.VALUE_TRUE
-								.equals(msgContext
-										.getProperty(Constants.Configuration.ENABLE_REST))) {
+						&& Constants.VALUE_TRUE.equals(enable)) {
 					msgContext.setDoingREST(true);
 					SOAPFactory soapFactory = new SOAP11Factory();
                     Reader reader = new InputStreamReader(in);

Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/chuncking-enabled-axis2.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/chuncking-enabled-axis2.xml?rev=202496&r1=202495&r2=202496&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/chuncking-enabled-axis2.xml (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/chuncking-enabled-axis2.xml Wed Jun 29 23:51:55 2005
@@ -4,8 +4,6 @@
    <!-- ================================================= -->
     <parameter name="hotdeployment" locked="xsd:false">true</parameter>
     <parameter name="hotupdate" locked="xsd:false">false</parameter>
-    <!-- Uncomment this to enable REST support -->
-<!--    <parameter name="eanbleREST" locked="xsd:false">true</parameter>-->
 
 
 

Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/commons-http-enabled-axis2.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/commons-http-enabled-axis2.xml?rev=202496&r1=202495&r2=202496&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/commons-http-enabled-axis2.xml (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/commons-http-enabled-axis2.xml Wed Jun 29 23:51:55 2005
@@ -4,8 +4,6 @@
    <!-- ================================================= -->
     <parameter name="hotdeployment" locked="xsd:false">true</parameter>
     <parameter name="hotupdate" locked="xsd:false">false</parameter>
-    <!-- Uncomment this to enable REST support -->
-<!--    <parameter name="eanbleREST" locked="xsd:false">true</parameter>-->
 
 
 

Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/mail/mail-enabled-axis2.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/mail/mail-enabled-axis2.xml?rev=202496&r1=202495&r2=202496&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/mail/mail-enabled-axis2.xml (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/mail/mail-enabled-axis2.xml Wed Jun 29 23:51:55 2005
@@ -4,8 +4,6 @@
    <!-- ================================================= -->
     <parameter name="hotdeployment" locked="xsd:false">true</parameter>
     <parameter name="hotupdate" locked="xsd:false">false</parameter>
-    <!-- Uncomment this to enable REST support -->
-<!--    <parameter name="eanbleREST" locked="xsd:false">true</parameter>-->
 
 
 

Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/rest/RESTBasedEchoRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/rest/RESTBasedEchoRawXMLTest.java?rev=202496&r1=202495&r2=202496&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/rest/RESTBasedEchoRawXMLTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/rest/RESTBasedEchoRawXMLTest.java Wed Jun 29 23:51:55 2005
@@ -20,12 +20,15 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
 
 import junit.framework.TestCase;
 
 import org.apache.axis.Constants;
 import org.apache.axis.addressing.AddressingConstants;
 import org.apache.axis.addressing.EndpointReference;
+import org.apache.axis.clientapi.AsyncResult;
+import org.apache.axis.clientapi.Callback;
 import org.apache.axis.context.MessageContext;
 import org.apache.axis.context.ServiceContext;
 import org.apache.axis.description.Parameter;
@@ -33,6 +36,7 @@
 import org.apache.axis.description.ServiceDescription;
 import org.apache.axis.engine.AxisConfiguration;
 import org.apache.axis.engine.AxisConfigurationImpl;
+import org.apache.axis.engine.AxisFault;
 import org.apache.axis.engine.Echo;
 import org.apache.axis.integration.UtilServer;
 import org.apache.axis.om.OMAbstractFactory;
@@ -151,45 +155,7 @@
         return method;
     }
 
-//    public void testEchoXMLASync() throws Exception {
-//                OMElement payload = createEnvelope();
-//
-//        org.apache.axis.clientapi.Call call = new org.apache.axis.clientapi.Call();
-//
-//        call.setTo(targetEPR);
-//        call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, false);
-//
-//        Callback callback = new Callback() {
-//            public void onComplete(AsyncResult result) {
-//                try {
-//                    result.getResponseEnvelope().serializeWithCache(XMLOutputFactory.newInstance().createXMLStreamWriter(System.out));
-//                } catch (XMLStreamException e) {
-//                    reportError(e);
-//                } finally {
-//                    finish = true;
-//                }
-//            }
-//
-//            public void reportError(Exception e) {
-//                e.printStackTrace();
-//                finish = true;
-//            }
-//        };
-//
-//        call.invokeNonBlocking(operationName.getLocalPart(), payload, callback);
-//        int index = 0;
-//        while (!finish) {
-//            Thread.sleep(1000);
-//            index++;
-//            if(index > 10 ){
-//                throw new AxisFault("Server is shutdown as the Async response take too longs time");
-//            }
-//        }
-//
-//
-//        log.info("send the reqest");
-//    }
-
+    
     public void testEchoXMLSync() throws Exception {
         SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
 
@@ -199,7 +165,7 @@
 
         call.setTo(targetEPR);
         call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, false);
-        call.set(Constants.Configuration.DO_REST,"true");
+        call.setDoREST(true);
         OMElement result =
                 (OMElement) call.invokeBlocking(operationName.getLocalPart(), payload);
         result.serializeWithCache(new OMOutput(XMLOutputFactory.newInstance().createXMLStreamWriter(System.out)));

Modified: webservices/axis/trunk/java/xdocs/rest-ws.html
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/xdocs/rest-ws.html?rev=202496&r1=202495&r2=202496&view=diff
==============================================================================
--- webservices/axis/trunk/java/xdocs/rest-ws.html (original)
+++ webservices/axis/trunk/java/xdocs/rest-ws.html Wed Jun 29 23:51:55 2005
@@ -9,7 +9,7 @@
  <h2>Doing REST web services with HTTP POST</h2> 
   <p>REST support can be enabled in the Server side by adding the following line to the axis.xml file.</p>
   <code>
-    &lt;parameter name="eanbleREST" locked="xsd:false"&gt;true&lt;/parameter&gt;
+    call.setDoREST(true);
     </code>
   <p>But it act both as a REST endpoint as well as a SOAP endpoint. When a Message is received if the content type is text/xml and the SOAP Action Headers is missing the Message is considered as a RESTful Message. Else they are treated as usual SOAP Messages.</p>