axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/client Call.java
Date Mon, 12 Nov 2001 18:12:42 GMT
dug         01/11/12 10:12:42

  Modified:    java/src/org/apache/axis/client Call.java
  Log:
  Fix a bug where targetService on the client was getting erased
  by the call to msgContext.reset() - as a result client service
  chains were never being called.
  
  Revision  Changes    Path
  1.40      +41 -29    xml-axis/java/src/org/apache/axis/client/Call.java
  
  Index: Call.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Call.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- Call.java	2001/11/09 23:21:24	1.39
  +++ Call.java	2001/11/12 18:12:42	1.40
  @@ -1060,7 +1060,8 @@
        * @exception AxisFault
        */
       public Object invoke( RPCElement body ) throws AxisFault {
  -        category.debug(JavaUtils.getMessage("enter00", "Call::invoke(RPCElement)") );
  +        category.debug(JavaUtils.getMessage("enter00", 
  +                                            "Call::invoke(RPCElement)") );
           SOAPEnvelope         reqEnv = new SOAPEnvelope();
           SOAPEnvelope         resEnv = null ;
           Message              reqMsg = new Message( reqEnv );
  @@ -1082,34 +1083,10 @@
           if (uri != null) reqEnv.setEncodingStyleURI(uri);
   
           msgContext.setRequestMessage(reqMsg);
  -        msgContext.setResponseMessage(resMsg);
   
           reqEnv.addBodyElement(body);
           reqEnv.setMessageType(Message.REQUEST);
   
  -        if ( body.getPrefix() == null )       body.setPrefix( "m" );
  -        if ( body.getNamespaceURI() == null ) {
  -            throw new AxisFault("Call.invoke", JavaUtils.getMessage("cantInvoke00", body.getMethodName()),
  -                    null, null);
  -        } else if (msgContext.getServiceHandler() == null) {
  -            msgContext.setTargetService(body.getNamespaceURI());
  -        }
  -
  -
  -        if (category.isDebugEnabled()) {
  -            StringWriter writer = new StringWriter();
  -            try {
  -                SerializationContext ctx = new SerializationContext(writer,
  -                                                                   msgContext);
  -                reqEnv.output(ctx);
  -                writer.close();
  -            } catch (Exception e) {
  -                e.printStackTrace(new PrintWriter(writer));
  -            } finally {
  -                category.debug(writer.getBuffer().toString());
  -            }
  -        }
  -
           try {
               invoke();
           }
  @@ -1153,7 +1130,8 @@
               }
           }
   
  -        category.debug(JavaUtils.getMessage("exit00", "Call::invoke(RPCElement)") );
  +        category.debug(JavaUtils.getMessage("exit00",
  +                                            "Call::invoke(RPCElement)") );
           return( result );
       }
   
  @@ -1186,9 +1164,16 @@
       public void invoke() throws AxisFault {
           category.debug(JavaUtils.getMessage("enter00", "Call::invoke()") );
   
  +        Message      reqMsg  = null ;
  +        SOAPEnvelope reqEnv  = null ;
  +
           msgContext.reset();
  +        msgContext.setResponseMessage(null);
           msgContext.setProperty( MessageContext.CALL, this );
  +        msgContext.setMaintainSession(maintainSession);
   
  +        // Go thru the properties and ones that are Axis specific, and
  +        // need to be moved to the msgContext - do so.
           if (myProperties != null) {
               Enumeration enum = myProperties.keys();
               while (enum.hasMoreElements()) {
  @@ -1209,16 +1194,43 @@
               }
           }
   
  -        msgContext.setMaintainSession(maintainSession);
  +        // Determine client target service
  +        reqMsg = msgContext.getRequestMessage();
  +        reqEnv = reqMsg.getSOAPPart().getAsSOAPEnvelope();
  +        SOAPBodyElement body = reqEnv.getFirstBody();
  +
  +        if ( body.getPrefix() == null )       body.setPrefix( "m" );
  +        if ( body.getNamespaceURI() == null ) {
  +            throw new AxisFault("Call.invoke", 
  +                   JavaUtils.getMessage("cantInvoke00", body.getName()),
  +                                        null, null);
  +        } else if (msgContext.getServiceHandler() == null) {
  +            msgContext.setTargetService(body.getNamespaceURI());
  +        }
  +        category.debug("TargetService:" + msgContext.getTargetService());
   
  -        // set up message context if there is a transport
  +        // set up transport if there is one
           if (transport != null) {
               transport.setupMessageContext(msgContext, this, this.engine);
           }
           else
               msgContext.setTransportName( transportName );
   
  -        category.debug("TargetService:" + msgContext.getTargetService());
  +        // For debugging - print request message
  +        if (category.isDebugEnabled()) {
  +            StringWriter writer = new StringWriter();
  +            try {
  +                SerializationContext ctx = new SerializationContext(writer,
  +                                                                   msgContext);
  +                reqEnv.output(ctx);
  +                writer.close();
  +            } catch (Exception e) {
  +                e.printStackTrace(new PrintWriter(writer));
  +            } finally {
  +                category.debug(writer.getBuffer().toString());
  +            }
  +        }
  +
           try {
               engine.invoke( msgContext );
   
  
  
  

Mime
View raw message