axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hemap...@apache.org
Subject svn commit: r191389 [2/2] - in /webservices/axis/trunk/java: modules/core/src/org/apache/axis/ modules/core/src/org/apache/axis/clientapi/ modules/core/src/org/apache/axis/context/ modules/core/src/org/apache/axis/description/ modules/core/src/org/apac...
Date Mon, 20 Jun 2005 04:06:31 GMT
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/tcp/TCPTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/tcp/TCPTransportSender.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/tcp/TCPTransportSender.java
(original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/tcp/TCPTransportSender.java
Sun Jun 19 21:06:28 2005
@@ -56,22 +56,21 @@
         //TCP no headers   :)
     }
 
-    public void finalizeSendWithOutputStreamFromIncomingConnection(
-        MessageContext msgContext,
-        Writer writer) {
+    public void finalizeSendWithOutputStreamFromIncomingConnection(MessageContext msgContext)
{
     }
 
-    public void finalizeSendWithToAddress(MessageContext msgContext, Writer writer)
-        throws AxisFault {
+    public void finalizeSendWithToAddress(MessageContext msgContext) throws AxisFault {
         try {
             socket.shutdownOutput();
-            msgContext.setProperty(MessageContext.TRANSPORT_READER, new InputStreamReader(socket.getInputStream()));
+            msgContext.setProperty(
+                MessageContext.TRANSPORT_READER,
+                new InputStreamReader(socket.getInputStream()));
         } catch (IOException e) {
             throw new AxisFault(e);
         }
     }
 
-    protected Writer openTheConnection(EndpointReference toURL) throws AxisFault {
+    protected OutputStream openTheConnection(EndpointReference toURL) throws AxisFault {
         if (toURL != null) {
             try {
                 URL url = new URL(toURL.getAddress());
@@ -79,7 +78,7 @@
                     new InetSocketAddress(url.getHost(), url.getPort() == -1 ? 80 : url.getPort());
                 socket = new Socket();
                 socket.connect(add);
-                return new OutputStreamWriter(socket.getOutputStream());
+                return socket.getOutputStream();
             } catch (MalformedURLException e) {
                 throw new AxisFault(e.getMessage(), e);
             } catch (IOException e) {
@@ -92,20 +91,20 @@
 
     public void startSendWithOutputStreamFromIncomingConnection(
         MessageContext msgContext,
-        Writer writer)
+        OutputStream out)
         throws AxisFault {
     }
 
-    public void startSendWithToAddress(MessageContext msgContext, Writer writer) {
+    public void startSendWithToAddress(MessageContext msgContext, OutputStream out) {
     }
 
     public void cleanUp() throws AxisFault {
         try {
-            if(socket != null){
+            if (socket != null) {
                 socket.close();
                 socket = null;
             }
-            
+
         } catch (IOException e) {
         }
 

Modified: webservices/axis/trunk/java/modules/core/test/org/apache/axis/context/ContextHireachyTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/test/org/apache/axis/context/ContextHireachyTest.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/test/org/apache/axis/context/ContextHireachyTest.java
(original)
+++ webservices/axis/trunk/java/modules/core/test/org/apache/axis/context/ContextHireachyTest.java
Sun Jun 19 21:06:28 2005
@@ -60,8 +60,7 @@
         OperationContext opContext =
             operationDescription.findOperationContext(
                 msgctx,
-                serviceCOntext,
-                true);
+                serviceCOntext);
         msgctx.setServiceContext(serviceCOntext);
 
         //test the complte Hisracy built

Modified: webservices/axis/trunk/java/modules/core/test/org/apache/axis/context/OperationContextTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/test/org/apache/axis/context/OperationContextTest.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/test/org/apache/axis/context/OperationContextTest.java
(original)
+++ webservices/axis/trunk/java/modules/core/test/org/apache/axis/context/OperationContextTest.java
Sun Jun 19 21:06:28 2005
@@ -45,12 +45,12 @@
     	
     	messageContext1.setMessageID(new Long(System.currentTimeMillis()).toString());
     	OperationDescription axisOperation = new OperationDescription(new QName("test"));
-    	OperationContext operationContext1 = axisOperation.findOperationContext(messageContext1,
sessionContext, true);
+    	OperationContext operationContext1 = axisOperation.findOperationContext(messageContext1,
sessionContext);
     	
     	MessageContext messageContext2 = this.getBasicMessageContext();
     	messageContext2.setMessageID(new Long(System.currentTimeMillis()).toString());
     	messageContext2.getMessageInformationHeaders().setRelatesTo(new RelatesTo(messageContext1.getMessageID()));
-    	OperationContext operationContext2 = axisOperation.findOperationContext(messageContext2,
sessionContext,  true);
+    	OperationContext operationContext2 = axisOperation.findOperationContext(messageContext2,
sessionContext);
     	assertEquals(operationContext1, operationContext2);
     }
     

Modified: webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/EnginePausingTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/EnginePausingTest.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/EnginePausingTest.java
(original)
+++ webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/EnginePausingTest.java
Sun Jun 19 21:06:28 2005
@@ -77,7 +77,7 @@
 
         mc.setTransportOut(transportOut);
         mc.setServerSide(true);
-        mc.setProperty(MessageContext.TRANSPORT_WRITER, new OutputStreamWriter(System.out));
+        mc.setProperty(MessageContext.TRANSPORT_OUT, System.out);
         SOAPFactory omFac = OMAbstractFactory.getSOAP11Factory();
         mc.setEnvelope(omFac.getDefaultEnvelope());
 

Modified: webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/EngineWithoutPhaseResolvingTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/EngineWithoutPhaseResolvingTest.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/EngineWithoutPhaseResolvingTest.java
(original)
+++ webservices/axis/trunk/java/modules/core/test/org/apache/axis/engine/EngineWithoutPhaseResolvingTest.java
Sun Jun 19 21:06:28 2005
@@ -82,9 +82,9 @@
                         transportIn,
                         transport);
                         
-        mc.setOperationContext(OperationContextFactory.createMEPContext(WSDLConstants.MEP_CONSTANT_IN_OUT,
false, axisOp, serviceContext));
+        mc.setOperationContext(OperationContextFactory.createMEPContext(WSDLConstants.MEP_CONSTANT_IN_OUT,
axisOp, serviceContext));
         mc.setTransportOut(transport);
-        mc.setProperty(MessageContext.TRANSPORT_WRITER, new OutputStreamWriter(System.out));
+        mc.setProperty(MessageContext.TRANSPORT_OUT, System.out);
         mc.setServerSide(true);
         SOAPFactory omFac = OMAbstractFactory.getSOAP11Factory();
         mc.setEnvelope(omFac.getDefaultEnvelope());

Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/CallUnregisteredServiceTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/CallUnregisteredServiceTest.java?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/CallUnregisteredServiceTest.java
(original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/CallUnregisteredServiceTest.java
Sun Jun 19 21:06:28 2005
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- 
+
 package org.apache.axis.engine;
 
 //todo
@@ -38,11 +38,11 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-public class CallUnregisteredServiceTest extends TestCase{
+public class CallUnregisteredServiceTest extends TestCase {
     private Log log = LogFactory.getLog(getClass());
     private QName serviceName = new QName("", "EchoXMLService");
     private QName operationName = new QName("http://localhost/my", "echoOMElement");
-    
+
     private AxisConfiguration engineRegistry;
     private MessageContext mc;
     private Thread thisThread;
@@ -64,25 +64,29 @@
         UtilServer.stop();
     }
 
-
     public void testEchoXMLSync() throws Exception {
         try {
             SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
 
-
             SOAPEnvelope reqEnv = fac.getDefaultEnvelope();
             OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");
             OMElement method = fac.createOMElement("echoOMElement", omNs);
             OMElement value = fac.createOMElement("myValue", omNs);
-            value.addChild(fac.createText(value,"Isaac Assimov, the foundation Sega"));
+            value.addChild(fac.createText(value, "Isaac Assimov, the foundation Sega"));
             method.addChild(value);
             reqEnv.getBody().addChild(method);
 
             Call call = new Call();
-            EndpointReference targetEPR = new EndpointReference(AddressingConstants.WSA_TO,
"http://127.0.0.1:" + (UtilServer.TESTING_PORT) + "/axis/services/EchoXMLService1");
-            call.setTransportInfo(Constants.TRANSPORT_HTTP,Constants.TRANSPORT_HTTP,false);
+            EndpointReference targetEPR =
+                new EndpointReference(
+                    AddressingConstants.WSA_TO,
+                    "http://127.0.0.1:"
+                        + (UtilServer.TESTING_PORT)
+                        + "/axis/services/EchoXMLService1");
+            call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, false);
             call.setTo(targetEPR);
-            SOAPEnvelope resEnv = (SOAPEnvelope)call.invokeBlocking(operationName.getLocalPart(),reqEnv);
+            SOAPEnvelope resEnv =
+                (SOAPEnvelope) call.invokeBlocking(operationName.getLocalPart(), reqEnv);
 
             SOAPBody sb = resEnv.getBody();
             if (sb.hasFault()) {
@@ -91,6 +95,7 @@
             fail("The test must fail due to wrong service Name");
 
         } catch (AxisFault e) {
+            assertTrue(e.getMessage().indexOf("Service Not found") > 0);
             tearDown();
             return;
         }

Added: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/rest/HttpGetRESTBasedTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/rest/HttpGetRESTBasedTest.java?rev=191389&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/rest/HttpGetRESTBasedTest.java
(added)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/rest/HttpGetRESTBasedTest.java
Sun Jun 19 21:06:28 2005
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+package org.apache.axis.rest;
+
+//todo
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.axis.integration.UtilServer;
+
+public class HttpGetRESTBasedTest extends TestCase {
+
+    public HttpGetRESTBasedTest() {
+        super(HttpGetRESTBasedTest.class.getName());
+    }
+
+    public HttpGetRESTBasedTest(String testName) {
+        super(testName);
+    }
+
+    protected void setUp() throws Exception {
+ //       UtilServer.start();
+
+    }
+
+    protected void tearDown() throws Exception {
+
+ //       UtilServer.stop();
+    }
+
+    public void testEchoXMLSync() throws Exception {
+        //TODO support the GET with the Simple Axis Server and enable this test case
+//        URL wsdlrequestUrl =
+//            new URL("http://127.0.0.1:8080/axis2/services/Version/getVersion?operation=getVersion");
+//
+//        HttpURLConnection connection = (HttpURLConnection) wsdlrequestUrl.openConnection();
+//        BufferedReader reader =
+//            new BufferedReader(new InputStreamReader(connection.getInputStream()));
+//        connection.getResponseCode();
+//        String line = reader.readLine();
+//        while (line != null) {
+//            System.out.println(line);
+//            line = reader.readLine();
+//        }
+    }
+
+}

Added: webservices/axis/trunk/java/xdocs/images/userguide/http-get-ws.png
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/xdocs/images/userguide/http-get-ws.png?rev=191389&view=auto
==============================================================================
Binary file - no diff available.

Propchange: webservices/axis/trunk/java/xdocs/images/userguide/http-get-ws.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: webservices/axis/trunk/java/xdocs/userguide.html
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/xdocs/userguide.html?rev=191389&r1=191388&r2=191389&view=diff
==============================================================================
--- webservices/axis/trunk/java/xdocs/userguide.html (original)
+++ webservices/axis/trunk/java/xdocs/userguide.html Sun Jun 19 21:06:28 2005
@@ -787,11 +787,50 @@
   
   <p>&nbsp;</p>
   
-  <!--
-  <h3>Enable the REST support for the Client side</h3>
+  
+ <h3>REST Support </h3>
+ 
+ <h4>Enable REST support in the Server Side</h4>  
+    <p>REST support can be enabled in the Server side by adding the following line
to the server.xml file.</p>
+    
+    <code>
+    &lt;parameter name="eanbleREST" locked="xsd:false"&gt;true&lt;/parameter&gt;
+    </code>
+    
+<!--    -->
+
+  <h4>Enable the REST support for the Client side</h4>
   <p>There are two ways to enable REST at the client side, first is to do the same
thing done at the 
   Server side in the client.xml file or do the following in the Call.</p>
   <code>call.set(Constants.Configuration.DO_REST,"true");</code>
--->
+  
+  <h4>Accsess a REST Web Service Via HTTP GET</h4>
+   <p>Axis2 let the users accsess Web Service that has simple type parameters via the
HTTP GET. For example following URL requests the version service Via HTTP GET. But the Web
Services arrived via GET assumes REST . Other parameter are converted in to the XML and put
them in to the SOAP Body.</p>
+   <code>http://127.0.0.1:8080/axis2/services/Version/getVersion?operation=getVersion</code>
+   <p>Result can be shown in the browser as follows</p>
+   <img src="images/userguide/http-get-ws.png"/>
+   
+  <p>A GET request should fulfil following conditions</p>
+   <ol>
+      <li>All the parameters the Web Service should accept MUST be simple types (e.g.
String, int, float, long)</li>
+      <li>There must be a parameter called operation that states the name of the operation</li>
+   </ol>
+   
+   <p>For an example  request <code>http://127.0.0.1:8080/axis2/services/Version/getVersion?operation=getVersion</code>
will be converted to the following SOAP Message for processing by Axis2</p>
+   <pre>
+   <code>
+       &lt;soapenv:Envelope 
+       		xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+		xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+		xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"&gt;
+    	    &lt;soapenv:Body&gt;
+        	&lt;axis2:getVersion xmlns:axis2="http://ws.apache.org/goGetWithREST" &gt;&lt;/axis2:getVersion&gt;
+    	    &lt;/soapenv:Body&gt;
+       &lt;/soapenv:Envelope&gt;
+   </code>
+   </pre>
+   
+   
 </body>
 </html>



Mime
View raw message