axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: ws-axis/java/src/org/apache/axis/message Text.java
Date Wed, 26 Jan 2005 00:52:48 GMT
dims        2005/01/25 16:52:48

  Modified:    java/test/wsdl/jaxrpchandler2 build.xml deploy.wsdd
                        EchoServiceServerHandler.java
                        JAXRPCHandler2TestCase.java
               java/src/org/apache/axis/handlers JAXRPCHandler.java
               java/src/org/apache/axis/message Text.java
  Added:       java/test/wsdl/jaxrpchandler2 EchoServiceServerHandler3.java
  Log:
  Fix for AXIS-1732 - JAXRPC Handler modification not propagated to actual service implmentation
  
  AND
  
  additional SAAJ problem reported by Michael Merz (working on JSR 181 impl in beehive)
  
  Revision  Changes    Path
  1.4       +1 -1      ws-axis/java/test/wsdl/jaxrpchandler2/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/wsdl/jaxrpchandler2/build.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- build.xml	2 Jun 2004 17:05:20 -0000	1.3
  +++ build.xml	26 Jan 2005 00:52:48 -0000	1.4
  @@ -59,7 +59,7 @@
         <fileset dir="${axis.home}/test/wsdl/jaxrpchandler2">
           <include name="*TestCase.java"/>
           <include name="*Impl.java"/>
  -	<include name="*Handler.java"/>
  +	<include name="*Handler*.java"/>
         </fileset>
       </copy>
   
  
  
  
  1.3       +18 -9     ws-axis/java/test/wsdl/jaxrpchandler2/deploy.wsdd
  
  Index: deploy.wsdd
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/wsdl/jaxrpchandler2/deploy.wsdd,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- deploy.wsdd	10 Dec 2003 00:18:49 -0000	1.2
  +++ deploy.wsdd	26 Jan 2005 00:52:48 -0000	1.3
  @@ -1,12 +1,21 @@
   <deployment name="test" xmlns="http://xml.apache.org/axis/wsdd/"
       xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
  -  <service name="EchoService2" provider="java:RPC">
  -    <parameter name="className" value="test.wsdl.jaxrpchandler2.EchoServiceImpl" />
  -    <parameter name="allowedMethods" value="echo" />
  -    <requestFlow>
  -      <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
  -        <parameter name="className" value="test.wsdl.jaxrpchandler2.EchoServiceServerHandler"
/>
  -      </handler>
  -    </requestFlow>
  -  </service>
  +    <service name="EchoService2" provider="java:RPC">
  +        <parameter name="className" value="test.wsdl.jaxrpchandler2.EchoServiceImpl"/>
  +        <parameter name="allowedMethods" value="echo"/>
  +        <requestFlow>
  +            <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
  +                <parameter name="className" value="test.wsdl.jaxrpchandler2.EchoServiceServerHandler"/>
  +            </handler>
  +        </requestFlow>
  +    </service>
  +    <service name="EchoService3" provider="java:RPC">
  +        <parameter name="className" value="test.wsdl.jaxrpchandler2.EchoServiceImpl"/>
  +        <parameter name="allowedMethods" value="echo"/>
  +        <requestFlow>
  +            <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
  +                <parameter name="className" value="test.wsdl.jaxrpchandler2.EchoServiceServerHandler3"/>
  +            </handler>
  +        </requestFlow>
  +    </service>
   </deployment>
  
  
  
  1.2       +0 -1      ws-axis/java/test/wsdl/jaxrpchandler2/EchoServiceServerHandler.java
  
  Index: EchoServiceServerHandler.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/wsdl/jaxrpchandler2/EchoServiceServerHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EchoServiceServerHandler.java	9 Dec 2003 18:42:20 -0000	1.1
  +++ EchoServiceServerHandler.java	26 Jan 2005 00:52:48 -0000	1.2
  @@ -28,7 +28,6 @@
   	    SOAPElement argElement = echoElement.addChildElement("arg0");
   	    argElement = argElement.addAttribute(soapEnvelope.createName("type", "xsi", "http://www.w3.org/2001/XMLSchema-instance"),
"xsd:string");
   	    argElement.addTextNode("my echo string");
  -	    soapMsg.saveChanges();
   	    
   	} catch (Exception e) {
   	    e.printStackTrace();
  
  
  
  1.3       +54 -35    ws-axis/java/test/wsdl/jaxrpchandler2/JAXRPCHandler2TestCase.java
  
  Index: JAXRPCHandler2TestCase.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/wsdl/jaxrpchandler2/JAXRPCHandler2TestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JAXRPCHandler2TestCase.java	10 Dec 2003 00:18:49 -0000	1.2
  +++ JAXRPCHandler2TestCase.java	26 Jan 2005 00:52:48 -0000	1.3
  @@ -1,50 +1,69 @@
   package test.wsdl.jaxrpchandler2;
   
  -import java.rmi.RemoteException;
  +import junit.framework.TestCase;
   
   import javax.xml.namespace.QName;
  -import javax.xml.rpc.*;
  -
  -import junit.framework.TestCase;
  +import javax.xml.rpc.Call;
  +import javax.xml.rpc.Service;
  +import javax.xml.rpc.ServiceFactory;
  +import java.rmi.RemoteException;
   
   public class JAXRPCHandler2TestCase extends TestCase {
   
  -    protected String serviceEndpointUrl =
  -	"http://localhost:8080/axis/services/EchoService2";
  -    protected String qnameService = "EchoService2";
  -    protected String qnamePort = "EchoServicePort";
  -    
  -    protected Call call;
  -    
  -    protected String echoString = "my echo string";
  -    
       public JAXRPCHandler2TestCase(String arg0) {
  -	super(arg0);
  +        super(arg0);
       }
   
  -    public void testJAXRPCHandler2() {
  -	call.setOperationName(new QName("http://soapinterop.org/", "echo"));
  -	String returnString = null;
  -	try {
  -	    returnString = (String) call.invoke(new Object[] { echoString });
  -	} catch (RemoteException e) {
  -	    e.printStackTrace();
  -	    fail("Remote exception while calling invoke");
  -	}
  -	
  -	assertEquals(
  -		     "returnString does not match echoString",
  -		     echoString,
  -		     returnString);
  +    public void testJAXRPCHandler2() throws Exception {
  +        String serviceEndpointUrl =
  +                "http://localhost:8080/axis/services/EchoService2";
  +        String qnameService = "EchoService2";
  +        String qnamePort = "EchoServicePort";
  +        Call call;
  +        String echoString = "my echo string";
  +        ServiceFactory serviceFactory = ServiceFactory.newInstance();
  +        Service service = serviceFactory.createService(new QName(qnameService));
  +        call = service.createCall(new QName(qnamePort));
  +        call.setTargetEndpointAddress(serviceEndpointUrl);
  +        call.setOperationName(new QName("http://soapinterop.org/", "echo"));
  +        String returnString = null;
  +        try {
  +            returnString = (String) call.invoke(new Object[]{echoString});
  +        } catch (RemoteException e) {
  +            e.printStackTrace();
  +            fail("Remote exception while calling invoke");
  +        }
  +        assertEquals("returnString does not match echoString",
  +                echoString,
  +                returnString);
  +    }
  +
  +    public void testJAXRPCHandler3() throws Exception {
  +        String serviceEndpointUrl =
  +                "http://localhost:8080/axis/services/EchoService3";
  +        String qnameService = "EchoService3";
  +        String qnamePort = "EchoServicePort";
  +        Call call;
  +        String echoString = "Joe";
  +        ServiceFactory serviceFactory = ServiceFactory.newInstance();
  +        Service service = serviceFactory.createService(new QName(qnameService));
  +        call = service.createCall(new QName(qnamePort));
  +        call.setTargetEndpointAddress(serviceEndpointUrl);
  +        call.setOperationName(new QName("http://soapinterop.org/", "echo"));
  +        String returnString = null;
  +        try {
  +            returnString = (String) call.invoke(new Object[]{echoString});
  +        } catch (RemoteException e) {
  +            e.printStackTrace();
  +            fail("Remote exception while calling invoke");
  +        }
  +        assertEquals(
  +                "Sam",
  +                returnString);
       }
  -    
  -    protected void setUp() throws Exception {
  -	super.setUp();
   
  -	ServiceFactory serviceFactory = ServiceFactory.newInstance();
  -	Service service = serviceFactory.createService(new QName(qnameService));
  -	call = service.createCall(new QName(qnamePort));
  -	call.setTargetEndpointAddress(serviceEndpointUrl);
  +    protected void setUp() throws Exception {
  +        super.setUp();
       }
   
   }
  
  
  
  1.1                  ws-axis/java/test/wsdl/jaxrpchandler2/EchoServiceServerHandler3.java
  
  Index: EchoServiceServerHandler3.java
  ===================================================================
  package test.wsdl.jaxrpchandler2;
  
  import org.w3c.dom.Node;
  
  import javax.xml.namespace.QName;
  import javax.xml.rpc.handler.Handler;
  import javax.xml.rpc.handler.HandlerInfo;
  import javax.xml.rpc.handler.MessageContext;
  import javax.xml.rpc.handler.soap.SOAPMessageContext;
  import javax.xml.soap.SOAPMessage;
  
  public class EchoServiceServerHandler3 implements Handler {
      private HandlerInfo info;
  
      public void init(HandlerInfo handlerInfo) {
          info = handlerInfo;
      }
  
      public void destroy() {
      }
  
      public QName[] getHeaders() {
          return info.getHeaders();
      }
  
      public boolean handleRequest(MessageContext mc) {
          try {
              SOAPMessage msg = ((SOAPMessageContext) mc).getMessage();
              Node child = msg.getSOAPPart().getEnvelope().getBody()
                      .getFirstChild()
                      .getFirstChild()
                      .getFirstChild();
              String name = child.getNodeValue();
              if (name != null && name.equals("Joe")) {
                  child.setNodeValue("Sam");
              }
              return true;
          } catch (Exception ex) {
              ex.printStackTrace();
              return false;
          }
      }
  
      public boolean handleResponse(MessageContext mc) {
          return true;
      }
  
      public boolean handleFault(MessageContext mc) {
          return true;
      }
  }
      
  
  
  1.14      +15 -4     ws-axis/java/src/org/apache/axis/handlers/JAXRPCHandler.java
  
  Index: JAXRPCHandler.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/handlers/JAXRPCHandler.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- JAXRPCHandler.java	29 Oct 2004 21:03:23 -0000	1.13
  +++ JAXRPCHandler.java	26 Jan 2005 00:52:48 -0000	1.14
  @@ -21,6 +21,7 @@
   import org.apache.axis.components.logger.LogFactory;
   import org.apache.commons.logging.Log;
   
  +import javax.xml.soap.SOAPException;
   import java.util.Map;
   
   
  @@ -48,10 +49,20 @@
   
       public void invoke(MessageContext msgContext) throws AxisFault {
           log.debug("Enter: JAXRPCHandler::enter invoke");
  -        if (!msgContext.getPastPivot()) {
  -            impl.handleRequest(msgContext);
  -        } else {
  -            impl.handleResponse(msgContext);
  +        try {
  +            if (!msgContext.getPastPivot()) {
  +                impl.handleRequest(msgContext);
  +            } else {
  +                impl.handleResponse(msgContext);
  +            }
  +        } finally {
  +            if (msgContext.getMessage().saveRequired()) {
  +                try {
  +                    msgContext.getMessage().saveChanges();
  +                } catch (SOAPException e) {
  +                    AxisFault.makeFault(e);
  +                }
  +            }
           }
           log.debug("Enter: JAXRPCHandler::exit invoke");
       }
  
  
  
  1.13      +1 -0      ws-axis/java/src/org/apache/axis/message/Text.java
  
  Index: Text.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/message/Text.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Text.java	10 Aug 2004 02:36:45 -0000	1.12
  +++ Text.java	26 Jan 2005 00:52:48 -0000	1.13
  @@ -76,6 +76,7 @@
   
       // Overriding the MessageElement Method, where it throws exeptions.
       public void setNodeValue(String nodeValue) throws DOMException{
  +        setDirty(true);
           textRep.setNodeValue(nodeValue);
       }
   
  
  
  

Mime
View raw message