Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 77970 invoked from network); 20 Jun 2005 04:07:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 20 Jun 2005 04:07:11 -0000 Received: (qmail 43434 invoked by uid 500); 20 Jun 2005 04:07:10 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 43406 invoked by uid 500); 20 Jun 2005 04:07:10 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 43378 invoked by uid 99); 20 Jun 2005 04:07:09 -0000 X-ASF-Spam-Status: No, hits=0.3 required=10.0 tests=NORMAL_HTTP_TO_IP,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Sun, 19 Jun 2005 21:07:03 -0700 Received: (qmail 77856 invoked by uid 65534); 20 Jun 2005 04:06:36 -0000 Message-ID: <20050620040636.77855.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: axis-cvs@ws.apache.org From: hemapani@apache.org X-Mailer: svnmailer-1.0.2 X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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 @@

 

- + +

Enable the REST support for the Client side

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.

call.set(Constants.Configuration.DO_REST,"true"); ---> + +

Accsess a REST Web Service Via HTTP GET

+

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.

+ http://127.0.0.1:8080/axis2/services/Version/getVersion?operation=getVersion +

Result can be shown in the browser as follows

+ + +

A GET request should fulfil following conditions

+
    +
  1. All the parameters the Web Service should accept MUST be simple types (e.g. String, int, float, long)
  2. +
  3. There must be a parameter called operation that states the name of the operation
  4. +
+ +

For an example request http://127.0.0.1:8080/axis2/services/Version/getVersion?operation=getVersion will be converted to the following SOAP Message for processing by Axis2

+
+   
+       <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">
+    	    <soapenv:Body>
+        	<axis2:getVersion xmlns:axis2="http://ws.apache.org/goGetWithREST" ></axis2:getVersion>
+    	    </soapenv:Body>
+       </soapenv:Envelope>
+   
+   
+ +