geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r165705 - in /geronimo/trunk: etc/ modules/axis-builder/src/java/org/apache/geronimo/axis/builder/ modules/axis/src/java/org/apache/geronimo/axis/client/ modules/axis/src/java/org/apache/geronimo/axis/server/
Date Mon, 02 May 2005 22:31:27 GMT
Author: djencks
Date: Mon May  2 15:31:25 2005
New Revision: 165705

URL: http://svn.apache.org/viewcvs?rev=165705&view=rev
Log:
upgrade to private wsdl4j version.  Fix one way operations. copy some handling from AxisServlet.
 See also AXIS-1971

Modified:
    geronimo/trunk/etc/project.properties
    geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/HeavyweightOperationDescBuilder.java
    geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceEndpointMethodInterceptor.java
    geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java

Modified: geronimo/trunk/etc/project.properties
URL: http://svn.apache.org/viewcvs/geronimo/trunk/etc/project.properties?rev=165705&r1=165704&r2=165705&view=diff
==============================================================================
--- geronimo/trunk/etc/project.properties (original)
+++ geronimo/trunk/etc/project.properties Mon May  2 15:31:25 2005
@@ -158,7 +158,7 @@
 stax_api_version=1.0
 tomcat_version=5.5.9
 velocity_version=1.4
-wsdl4j_version=1.5
+wsdl4j_version=PATCH-1193602
 xerces_version=2.6.2
 xfire_version=20050202
 xml_apis_version=1.0.b2

Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/HeavyweightOperationDescBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/HeavyweightOperationDescBuilder.java?rev=165705&r1=165704&r2=165705&view=diff
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/HeavyweightOperationDescBuilder.java
(original)
+++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/HeavyweightOperationDescBuilder.java
Mon May  2 15:31:25 2005
@@ -277,6 +277,7 @@
         operationDesc.setMethod(method);
 
         // MAP RETURN TYPE
+        operationDesc.setMep(operation.getStyle());
         if (methodMapping.isSetWsdlReturnValueMapping()) {
             mapReturnType();
         } else if (operation.getStyle() == OperationType.REQUEST_RESPONSE) {

Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceEndpointMethodInterceptor.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceEndpointMethodInterceptor.java?rev=165705&r1=165704&r2=165705&view=diff
==============================================================================
--- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceEndpointMethodInterceptor.java
(original)
+++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceEndpointMethodInterceptor.java
Mon May  2 15:31:25 2005
@@ -25,6 +25,7 @@
 import java.util.Map;
 import javax.security.auth.Subject;
 import javax.xml.rpc.holders.Holder;
+import javax.wsdl.OperationType;
 
 import net.sf.cglib.proxy.MethodInterceptor;
 import net.sf.cglib.proxy.MethodProxy;
@@ -86,25 +87,33 @@
         Object response = null;
         List parameterDescs = operationInfo.getOperationDesc().getParameters();
         Object[] unwrapped = extractFromHolders(objects, parameterDescs, operationInfo.getOperationDesc().getNumInParams());
-        try {
-            response = call.invoke(unwrapped);
-        } catch (RemoteException e) {
-            throw operationInfo.unwrapFault(e);
-        }
+        if (operationInfo.getOperationDesc().getMep() == OperationType.REQUEST_RESPONSE)
{
+            try {
+                response = call.invoke(unwrapped);
+            } catch (RemoteException e) {
+                throw operationInfo.unwrapFault(e);
+            }
 
-        if (response instanceof java.rmi.RemoteException) {
-            throw operationInfo.unwrapFault((RemoteException) response);
-        } else {
-            stub.extractAttachments(call);
-            Map outputParameters = call.getOutputParams();
-            putInHolders(outputParameters, objects, parameterDescs);
-            Class returnType = operationInfo.getOperationDesc().getReturnClass();
-            //return type should never be null... but we are not objecting if wsdl-return-value-mapping
is not set.
-            if (response == null || returnType == null || returnType.isAssignableFrom(response.getClass()))
{
-                return response;
+            if (response instanceof RemoteException) {
+                throw operationInfo.unwrapFault((RemoteException) response);
             } else {
-                return org.apache.axis.utils.JavaUtils.convert(response, returnType);
+                stub.extractAttachments(call);
+                Map outputParameters = call.getOutputParams();
+                putInHolders(outputParameters, objects, parameterDescs);
+                Class returnType = operationInfo.getOperationDesc().getReturnClass();
+                //return type should never be null... but we are not objecting if wsdl-return-value-mapping
is not set.
+                if (response == null || returnType == null || returnType.isAssignableFrom(response.getClass()))
{
+                    return response;
+                } else {
+                    return JavaUtils.convert(response, returnType);
+                }
             }
+        } else if (operationInfo.getOperationDesc().getMep() == OperationType.ONE_WAY) {
+            //one way
+            call.invokeOneWay(unwrapped);
+            return null;
+        } else {
+            throw new RuntimeException("Invalid messaging style: " + operationInfo.getOperationDesc().getMep());
         }
     }
 

Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java?rev=165705&r1=165704&r2=165705&view=diff
==============================================================================
--- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java
(original)
+++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java
Mon May  2 15:31:25 2005
@@ -25,6 +25,7 @@
 import java.util.Map;
 import javax.servlet.http.HttpServletResponse;
 import javax.wsdl.Definition;
+import javax.wsdl.OperationType;
 import javax.wsdl.Port;
 import javax.wsdl.Service;
 import javax.wsdl.WSDLException;
@@ -32,7 +33,8 @@
 import javax.wsdl.extensions.soap.SOAPAddress;
 import javax.wsdl.factory.WSDLFactory;
 import javax.wsdl.xml.WSDLWriter;
-import javax.xml.soap.SOAPException;
+import javax.xml.soap.MimeHeader;
+import javax.xml.soap.MimeHeaders;
 import javax.xml.soap.SOAPMessage;
 
 import org.apache.axis.AxisFault;
@@ -80,10 +82,10 @@
     }
 
     public void invoke(Request req, Response res) throws Exception {
-        org.apache.axis.MessageContext context = new org.apache.axis.MessageContext(null);
-        req.setAttribute(MESSAGE_CONTEXT, context);
+        org.apache.axis.MessageContext messageContext = new org.apache.axis.MessageContext(null);
+        req.setAttribute(MESSAGE_CONTEXT, messageContext);
 
-        context.setClassLoader(classLoader);
+        messageContext.setClassLoader(classLoader);
 
         Message responseMessage = null;
 
@@ -92,57 +94,87 @@
         InputStream inputStream = req.getInputStream();
         Message requestMessage = new Message(inputStream, false, contentType, contentLocation);
 
-        context.setRequestMessage(requestMessage);
-        context.setProperty(HTTPConstants.MC_HTTP_SERVLETPATHINFO, req.getURI().getPath());
-        context.setProperty(org.apache.axis.MessageContext.TRANS_URL, req.getURI().toString());
-        context.setService(service);
-        context.setProperty(REQUEST, req);
-        context.setProperty(RESPONSE, res);
+        messageContext.setRequestMessage(requestMessage);
+        messageContext.setProperty(HTTPConstants.MC_HTTP_SERVLETPATHINFO, req.getURI().getPath());
+        messageContext.setProperty(org.apache.axis.MessageContext.TRANS_URL, req.getURI().toString());
+        messageContext.setService(service);
+        messageContext.setProperty(REQUEST, req);
+        messageContext.setProperty(RESPONSE, res);
 
         try {
             String characterEncoding = (String) requestMessage.getProperty(SOAPMessage.CHARACTER_SET_ENCODING);
             if (characterEncoding != null) {
-                context.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, characterEncoding);
+                messageContext.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, characterEncoding);
             } else {
-                context.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, "UTF-8");
+                messageContext.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, "UTF-8");
             }
 
 
             String soapAction = req.getHeader(HTTPConstants.HEADER_SOAP_ACTION);
             if (soapAction != null) {
-                context.setUseSOAPAction(true);
-                context.setSOAPActionURI(soapAction);
+                messageContext.setUseSOAPAction(true);
+                messageContext.setSOAPActionURI(soapAction);
             }
 
             SOAPEnvelope env = requestMessage.getSOAPEnvelope();
             if (env != null && env.getSOAPConstants() != null) {
-                context.setSOAPConstants(env.getSOAPConstants());
+                messageContext.setSOAPConstants(env.getSOAPConstants());
             }
-            SOAPService service = context.getService();
+            SOAPService service = messageContext.getService();
 
             Thread.currentThread().setContextClassLoader(classLoader);
-            service.invoke(context);
+            service.invoke(messageContext);
 
-            responseMessage = context.getResponseMessage();
+            responseMessage = messageContext.getResponseMessage();
         } catch (AxisFault fault) {
-            responseMessage = handleFault(fault, res, context);
+            responseMessage = handleFault(fault, res, messageContext);
 
         } catch (Exception e) {
-            responseMessage = handleException(context, res, e);
+            responseMessage = handleException(messageContext, res, e);
+        }
+        //TODO investigate and fix operation == null!
+        if (messageContext.getOperation() != null) {
+            if (messageContext.getOperation().getMep() == OperationType.ONE_WAY) {
+                // No content, so just indicate accepted
+                res.setStatusCode(202);
+                return;
+            } else if (responseMessage == null) {
+                responseMessage = handleException(messageContext, null, new RuntimeException("No
response for non-one-way operation"));
+            }
+        } else if (responseMessage == null) {
+            res.setStatusCode(202);
+            return;
         }
         try {
-            SOAPConstants soapConstants = context.getSOAPConstants();
+            SOAPConstants soapConstants = messageContext.getSOAPConstants();
             String contentType1 = responseMessage.getContentType(soapConstants);
             res.setContentType(contentType1);
+                // Transfer MIME headers to HTTP headers for response message.
+                MimeHeaders responseMimeHeaders = responseMessage.getMimeHeaders();
+                for (Iterator i = responseMimeHeaders.getAllHeaders(); i.hasNext(); ) {
+                    MimeHeader responseMimeHeader = (MimeHeader) i.next();
+                    res.setHeader(responseMimeHeader.getName(),
+                                  responseMimeHeader.getValue());
+                }
+            //TODO discuss this with dims.
+//                // synchronize the character encoding of request and response
+//                String responseEncoding = (String) messageContext.getProperty(
+//                        SOAPMessage.CHARACTER_SET_ENCODING);
+//                if (responseEncoding != null) {
+//                    try {
+//                        responseMessage.setProperty(SOAPMessage.CHARACTER_SET_ENCODING,
+//                                                responseEncoding);
+//                    } catch (SOAPException e) {
+//                        log.info(Messages.getMessage("exception00"), e);
+//                    }
+//                }
+                //determine content type from message response
+                contentType = responseMessage.getContentType(messageContext.
+                        getSOAPConstants());
+                responseMessage.writeTo(res.getOutputStream());
         } catch (Exception e) {
-            e.printStackTrace();
-        }
-        try {
-            responseMessage.writeTo(res.getOutputStream());
-        } catch (SOAPException e) {
             log.info(Messages.getMessage("exception00"), e);
         }
-
     }
 
     private Message handleException(MessageContext context, Response res, Exception e) {



Mime
View raw message