axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/transport/http SimpleAxisServer.java
Date Wed, 14 Nov 2001 18:45:42 GMT
gdaniels    01/11/14 10:45:42

  Modified:    java/src/org/apache/axis/transport/http
                        SimpleAxisServer.java
  Log:
  Clean up code a tad, and handle null response messages by throwing
  a fault.
  
  Revision  Changes    Path
  1.39      +16 -7     xml-axis/java/src/org/apache/axis/transport/http/SimpleAxisServer.java
  
  Index: SimpleAxisServer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/SimpleAxisServer.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- SimpleAxisServer.java	2001/11/08 21:43:59	1.38
  +++ SimpleAxisServer.java	2001/11/14 18:45:42	1.39
  @@ -194,6 +194,8 @@
           StringBuffer cookie = new StringBuffer();
           StringBuffer cookie2 = new StringBuffer();
           StringBuffer authInfo = new StringBuffer();
  +        
  +        Message responseMsg = null;
   
           // Accept and process requests from the socket
           while (!stopped) {
  @@ -210,6 +212,8 @@
               msgContext.reset();
               //msgContext.setProperty("transport", "HTTPTransport");
               msgContext.setTransportName(transportName);
  +            
  +            responseMsg = null;
   
               try {
                   try {
  @@ -365,6 +369,12 @@
   
                       // invoke the Axis engine
                       engine.invoke(msgContext);
  +                    
  +                    // Retrieve the response from Axis
  +                    responseMsg = msgContext.getResponseMessage();
  +                    if (responseMsg == null) {
  +                        throw new AxisFault(JavaUtils.getMessage("nullResponse00"));
  +                    }
   
                   } catch( Exception e ) {
                       AxisFault af;
  @@ -385,13 +395,14 @@
                       // There may be headers we want to preserve in the
                       // response message - so if it's there, just add the
                       // FaultElement to it.  Otherwise, make a new one.
  -                    Message msg = msgContext.getResponseMessage();
  -                    if (msg == null) {
  -                        msg = new Message((AxisFault)e);
  -                        msgContext.setResponseMessage(msg);
  +                    responseMsg = msgContext.getResponseMessage();
  +                    if (responseMsg == null) {
  +                        responseMsg = new Message((AxisFault)e);
                       } else {
                           try {
  -                            SOAPEnvelope env = msg.getSOAPPart().getAsSOAPEnvelope();
  +                            SOAPEnvelope env = responseMsg.
  +                                                getSOAPPart().
  +                                                getAsSOAPEnvelope();
                               env.clearBody();
                               env.addBodyElement(new SOAPFaultElement((AxisFault)e));
                           } catch (AxisFault fault) {
  @@ -400,8 +411,6 @@
                       }
                   }
   
  -                // Retrieve the response from Axis
  -                Message responseMsg = msgContext.getResponseMessage();
                   byte[] response = (byte[]) responseMsg.getSOAPPart().getAsBytes();
   
                   // Send it on its way...
  
  
  

Mime
View raw message