You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by du...@apache.org on 2006/02/13 03:38:11 UTC
svn commit: r377293 - in /webservices/axis/trunk/java:
src/org/apache/axis/client/ src/org/apache/axis/security/
src/org/apache/axis/server/ src/org/apache/axis/transport/http/
src/org/apache/axis/wsrm/ test/functional/
Author: dug
Date: Sun Feb 12 18:38:09 2006
New Revision: 377293
URL: http://svn.apache.org/viewcvs?rev=377293&view=rev
Log:
Add some javadoc to the WSA client stuff
Add back in the WSA server code
Add a mini-WSA test
Added:
webservices/axis/trunk/java/src/org/apache/axis/security/WSSecInterface.java
webservices/axis/trunk/java/src/org/apache/axis/wsrm/
webservices/axis/trunk/java/src/org/apache/axis/wsrm/RMInterface.java
webservices/axis/trunk/java/test/functional/TestWSA.java
Modified:
webservices/axis/trunk/java/src/org/apache/axis/client/AxisClient.java
webservices/axis/trunk/java/src/org/apache/axis/client/Call.java
webservices/axis/trunk/java/src/org/apache/axis/server/AxisServer.java
webservices/axis/trunk/java/src/org/apache/axis/transport/http/SimpleAxisServer.java
webservices/axis/trunk/java/test/functional/FunctionalTests.java
webservices/axis/trunk/java/test/functional/auto-deploy.wsdd
Modified: webservices/axis/trunk/java/src/org/apache/axis/client/AxisClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/src/org/apache/axis/client/AxisClient.java?rev=377293&r1=377292&r2=377293&view=diff
==============================================================================
--- webservices/axis/trunk/java/src/org/apache/axis/client/AxisClient.java (original)
+++ webservices/axis/trunk/java/src/org/apache/axis/client/AxisClient.java Sun Feb 12 18:38:09 2006
@@ -29,10 +29,12 @@
import org.apache.axis.handlers.HandlerInfoChainFactory;
import org.apache.axis.handlers.soap.MustUnderstandChecker;
import org.apache.axis.handlers.soap.SOAPService;
+import org.apache.axis.security.WSSecInterface;
import org.apache.axis.utils.Messages;
import org.apache.axis.wsa.AsyncService;
import org.apache.axis.wsa.MIHeader;
import org.apache.axis.wsa.WSAHandler;
+import org.apache.axis.wsrm.RMInterface ;
import org.apache.commons.logging.Log;
import javax.xml.namespace.QName;
@@ -55,6 +57,8 @@
MustUnderstandChecker checker = new MustUnderstandChecker(null);
HandlerChain handlerImpl = null ;
+ RMInterface rmImpl = null ;
+ WSSecInterface secImpl = null ;
public AxisClient(EngineConfiguration config) {
super(config);
@@ -116,11 +120,8 @@
}
// Run the security code - Init security sessions if needed
- String secCls = msgContext.getStrProp( "WSSecurity" );
- if ( secCls == null )
- secCls = (String) msgContext.getAxisEngine().getOption("WSSecurity");
- // Add code here... Dug
- // securityCode.init();
+ if ( secImpl != null )
+ secImpl.init( msgContext );
}
public void invokeTransport(MessageContext msgContext) throws Exception {
@@ -138,12 +139,12 @@
if ( hName != null && (h = getTransport( hName )) != null ) {
// Piggy-back any RM headers (like ACKs)
- // add code here... Dug
- // rmcode.addRMHeaders();
+ if ( rmImpl != null )
+ rmImpl.addRMHeaders(msgContext);
// Run security - Protect
- // add code here... Dug
- // securityCode.protect();
+ if ( secImpl != null )
+ secImpl.protect( msgContext );
// Invoke the actual transport chain
h.invoke(msgContext);
@@ -153,8 +154,8 @@
WSAHandler.invoke( msgContext );
// Run security - Verify
- // add code here... Dug
- // securityCode.verify();
+ if ( secImpl != null )
+ secImpl.verify( msgContext );
}
else
throw new AxisFault(Messages.getMessage("noTransport00", hName));
@@ -239,6 +240,21 @@
// set active context
setCurrentMessageContext(msgContext);
+ // Look for WSSecurity impl
+ String cls = msgContext.getStrProp( "WSSecurityImpl" );
+ if ( cls == null )
+ cls = (String) msgContext.getAxisEngine()
+ .getOption("WSSecurityImpl");
+ if ( cls != null )
+ secImpl = (WSSecInterface) Class.forName(cls).newInstance();
+
+ // Look for WSRM impl
+ cls = msgContext.getStrProp( "WSRMImpl" );
+ if ( cls == null )
+ cls = (String) msgContext.getAxisEngine().getOption("WSRMImpl");
+ if ( cls != null )
+ rmImpl = (RMInterface) Class.forName(cls).newInstance();
+
// Do WSA processing first
WSAHandler.invoke( msgContext );
@@ -277,12 +293,19 @@
msgContext.setPastPivot(false);
invokeOutbound(msgContext);
- // Add check for RM here - for now just do normal stuff... Dug
- // Normal transport flow
- if ( msgContext.getIsOneWay() )
- invokeTransportOneWay( msgContext );
- else
- invokeTransport( msgContext );
+ // Check to see if the RM code wants to deal with it
+ boolean skipTransport = false ;
+
+ if ( rmImpl != null )
+ skipTransport = rmImpl.sendMessage( msgContext );
+
+ if ( !skipTransport ) {
+ // Normal transport flow
+ if ( msgContext.getIsOneWay() )
+ invokeTransportOneWay( msgContext );
+ else
+ invokeTransport( msgContext );
+ }
// If there was no response message and we didn't call
// invokeOneWay() then wait for an async response
Modified: webservices/axis/trunk/java/src/org/apache/axis/client/Call.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/src/org/apache/axis/client/Call.java?rev=377293&r1=377292&r2=377293&view=diff
==============================================================================
--- webservices/axis/trunk/java/src/org/apache/axis/client/Call.java (original)
+++ webservices/axis/trunk/java/src/org/apache/axis/client/Call.java Sun Feb 12 18:38:09 2006
@@ -3022,74 +3022,143 @@
operationSetManually = false;
}
+ /**
+ * Gets the WS-Addressing MessageID for the outgoing message.
+ *
+ * @param name the name of the property
+ */
public String getMessageID() {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
return mih == null ? null : mih.getMessageID();
}
+ /**
+ * Sets the WS-Addressing wsa:To value
+ *
+ * @param epr The EPR.
+ *
+ * Note: this does not set the transport URL. As of now they are
+ * treated as two independent entities.
+ */
public void setTo(EndpointReference epr) throws Exception {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
if ( mih == null ) mih = new MIHeader( this );
mih.setTo( epr );
}
+ /**
+ * Sets the WS-Addressing wsa:To value based on the url passed in.
+ *
+ * @param epr The url to use for the wsa:To's Address element.
+ *
+ * Note: this does not set the transport URL. As of now they are
+ * treated as two independent entities.
+ */
public void setTo(String url) throws Exception {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
if ( mih == null ) mih = new MIHeader( this );
mih.setTo( EndpointReference.fromLocation( url ) );
}
+ /**
+ * Gets the WS-Addressing wsa:To EPR.
+ */
public EndpointReference getTo() {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
return mih == null ? null : mih.getTo();
}
+ /**
+ * Sets the WS-Addressing wsa:From value
+ *
+ * @param epr The epr to use for the wsa:From
+ */
public void setFrom(EndpointReference epr) throws Exception {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
if ( mih == null ) mih = new MIHeader( this );
mih.setFrom( epr );
}
+ /**
+ * Sets the WS-Addressing wsa:From value from a url
+ *
+ * @param epr The url to use for the wsa:From
+ */
public void setFrom(String url) throws Exception {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
if ( mih == null ) mih = new MIHeader( this );
mih.setFrom( EndpointReference.fromLocation( url ) );
}
+ /**
+ * Get the wsa:From EPR
+ *
+ * @return The wsa:From EPR
+ */
public EndpointReference getFrom() {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
return mih == null ? null : mih.getFrom();
}
+ /**
+ * Sets the wsa:ReplyTo EPR
+ *
+ * @param epr The epr to use for the wsa:ReplyTo
+ */
public void setReplyTo(EndpointReference epr) throws Exception {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
if ( mih == null ) mih = new MIHeader( this );
mih.setReplyTo( epr );
}
+ /**
+ * Sets the wsa:ReplyTo EPR from a url
+ *
+ * @param url The url to use for the wsa:ReplyTo Address field
+ */
public void setReplyTo(String url) throws Exception {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
if ( mih == null ) mih = new MIHeader( this );
mih.setReplyTo( EndpointReference.fromLocation( url ) );
}
+ /**
+ * Gets the wsa:ReplyTo EPR
+ *
+ * @return the wsa:ReplyTo EPR
+ */
public EndpointReference getReplyTo() {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
return mih == null ? null : mih.getReplyTo();
}
+ /**
+ * Sets the wsa:FaultTo EPR
+ *
+ * @param epr he epr to use for the wsa:FaultTo
+ */
public void setFaultTo(EndpointReference epr) throws Exception {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
if ( mih == null ) mih = new MIHeader( this );
mih.setFaultTo( epr );
}
+ /**
+ * Sets the wsa:FaultTo EPR from a url
+ *
+ * @param url The url to use for the wsa:FaultTo Address field
+ */
public void setFaultTo(String url) throws Exception {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
if ( mih == null ) mih = new MIHeader( this );
mih.setFaultTo( EndpointReference.fromLocation( url ) );
}
+ /**
+ * Gets the wsa:FaultTo EPR
+ *
+ * @param The wsa:FaultTo EPR
+ */
public EndpointReference getFaultTo() {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
return mih == null ? null : mih.getFaultTo();
Added: webservices/axis/trunk/java/src/org/apache/axis/security/WSSecInterface.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/src/org/apache/axis/security/WSSecInterface.java?rev=377293&view=auto
==============================================================================
--- webservices/axis/trunk/java/src/org/apache/axis/security/WSSecInterface.java (added)
+++ webservices/axis/trunk/java/src/org/apache/axis/security/WSSecInterface.java Sun Feb 12 18:38:09 2006
@@ -0,0 +1,9 @@
+package org.apache.axis.security ;
+
+import org.apache.axis.MessageContext ;
+
+public interface WSSecInterface {
+ public void init(MessageContext msgContext) throws Exception ;
+ public void protect(MessageContext msgContext) throws Exception ;
+ public void verify(MessageContext msgContext) throws Exception ;
+}
Modified: webservices/axis/trunk/java/src/org/apache/axis/server/AxisServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/src/org/apache/axis/server/AxisServer.java?rev=377293&r1=377292&r2=377293&view=diff
==============================================================================
--- webservices/axis/trunk/java/src/org/apache/axis/server/AxisServer.java (original)
+++ webservices/axis/trunk/java/src/org/apache/axis/server/AxisServer.java Sun Feb 12 18:38:09 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2001-2004 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.
@@ -25,19 +25,27 @@
import org.apache.axis.Message;
import org.apache.axis.MessageContext;
import org.apache.axis.SimpleTargetedChain;
-import org.apache.axis.message.SOAPEnvelope;
import org.apache.axis.soap.SOAPConstants;
import org.apache.axis.client.AxisClient;
import org.apache.axis.components.logger.LogFactory;
import org.apache.axis.configuration.EngineConfigurationFactoryFinder;
+import org.apache.axis.message.SOAPEnvelope;
+import org.apache.axis.security.WSSecInterface ;
import org.apache.axis.utils.ClassUtils;
import org.apache.axis.utils.Messages;
import org.apache.commons.logging.Log;
+import org.apache.axis.message.SOAPEnvelope;
+import org.apache.axis.message.SOAPBodyElement;
+import org.apache.axis.message.SOAPHeaderElement;
+import org.apache.axis.wsrm.RMInterface ;
+import org.apache.axis.wsa.MIHeader;
+import org.apache.axis.wsa.WSAHandler;
import java.util.Map;
+import java.lang.reflect.Method ;
+
/**
*
- * @author Doug Davis (dug@us.ibm.com)
* @author Glen Daniels (gdaniels@allaire.com)
*/
public class AxisServer extends AxisEngine
@@ -48,7 +56,11 @@
LogFactory.getLog("org.apache.axis.TIME");
private static AxisServerFactory factory = null;
-
+ private long t0=0, t1=0, t2=0, t3=0, t4=0, t5=0;
+
+ private RMInterface rmImpl = null ;
+ private WSSecInterface secImpl = null ;
+
public static AxisServer getServer(Map environment) throws AxisFault
{
if (factory == null) {
@@ -124,13 +136,160 @@
return clientEngine;
}
+ public void invokeInboundTransport(MessageContext msgContext)
+ throws Exception
+ {
+ /* Process the Transport Specific Request Chain */
+ /**********************************************/
+ String hName = msgContext.getTransportName();
+ Handler h = null ;
+ SimpleTargetedChain transportChain = null ;
+
+ if (log.isDebugEnabled()) {
+ log.debug(Messages.getMessage("transport01","AxisServer.invoke",hName));
+ t1=System.currentTimeMillis();
+ }
+
+ if ( hName != null && (h = getTransport( hName )) != null ) {
+ if (h instanceof SimpleTargetedChain) {
+ transportChain = (SimpleTargetedChain)h;
+ h = transportChain.getRequestHandler();
+ if (h != null)
+ h.invoke(msgContext);
+ }
+ }
+ // Run security
+ if ( secImpl != null )
+ secImpl.verify( msgContext );
+ }
+
+ public void invokeOutboundTransport(MessageContext msgContext)
+ throws Exception
+ {
+ String hName = msgContext.getTransportName();
+ Handler h = null ;
+ SimpleTargetedChain transportChain = null ;
+
+ // Run security
+ if ( secImpl != null )
+ secImpl.protect( msgContext );
+
+ /* Process the Transport Specific Response Chain */
+ /***********************************************/
+ if ( hName != null && (h = getTransport( hName )) != null ) {
+ if (h instanceof SimpleTargetedChain) {
+ transportChain = (SimpleTargetedChain)h;
+ h = transportChain.getResponseHandler();
+ if (h != null) {
+ // add call to RM code to add piggy-backed headers
+ if ( rmImpl != null )
+ rmImpl.addRMHeaders( msgContext );
+ h.invoke(msgContext);
+ }
+ }
+ }
+ }
+
+ public void invokeService(MessageContext msgContext) throws Exception {
+ Handler h = null ;
+
+ if ( tlog.isDebugEnabled() )
+ t2=System.currentTimeMillis();
+
+ try {
+ // Run WSA logic
+ WSAHandler.invoke( msgContext );
+
+ MIHeader mih = MIHeader.fromCurrentMessage();
+
+ if ( mih != null ) {
+ // See if it needs to be rerouted
+ // Dug - not yet // (new WSXHandler()).invoke( msgContext );
+ }
+
+ /* Process the Global Request Chain */
+ /************************************/
+ if ((h = getGlobalRequest()) != null ) {
+ h.invoke(msgContext);
+ }
+
+ /**
+ * At this point, the service should have been set by someone
+ * (either the originator of the MessageContext, or one of the
+ * transport or global Handlers). If it hasn't been set, we
+ * fault.
+ */
+ h = msgContext.getService();
+ if (h == null) {
+ // It's possible that we haven't yet parsed the
+ // message at this point. This is a kludge to
+ // make sure we have. There probably wants to be
+ // some kind of declarative "parse point" on the handler
+ // chain instead....
+ Message rm = msgContext.getRequestMessage();
+ rm.getSOAPEnvelope().getFirstBody();
+
+ h = msgContext.getService();
+ if (h == null)
+ throw new AxisFault("Server.NoService",
+ Messages.getMessage("noService05",
+ "" + msgContext.getTargetService()),
+ null, null );
+ }
+ if ( tlog.isDebugEnabled() )
+ t3=System.currentTimeMillis();
+
+ SOAPEnvelope env = msgContext.getRequestMessage().getSOAPEnvelope();
+
+ // Only invoke the service is there's a body - sort of a hack
+ if ( env.getFirstBody() != null ) {
+ initSOAPConstants(msgContext);
+ try {
+ h.invoke(msgContext);
+ }
+ catch(AxisFault af) {
+ if ( (h= getGlobalRequest()) != null )
+ h.onFault(msgContext);
+ throw af ;
+ }
+ finally {
+ msgContext.setPastPivot( true );
+ }
+ }
+
+ if ( tlog.isDebugEnabled() )
+ t4=System.currentTimeMillis();
+ }
+ catch(Exception exp) {
+ // If WSA isn't turned on then just rethrow it
+ // Dug - fix this, it should not do this we need to make this
+ // work even when WSA is turned on
+ if ( MIHeader.fromRequest() == null ) throw exp ;
+
+ if ( !(exp instanceof AxisFault) )
+ exp = AxisFault.makeFault( exp );
+
+ msgContext.setPastPivot( true );
+ msgContext.setResponseMessage( new Message(exp) );
+
+ // WSA stuff
+ WSAHandler.fixAction( msgContext );
+ }
+ // WSA logic is run first
+ WSAHandler.invoke( msgContext );
+
+ /* Process the Global Response Chain */
+ /***********************************/
+ if ((h = getGlobalResponse()) != null)
+ h.invoke(msgContext);
+ }
+
/**
* Main routine of the AXIS server. In short we locate the appropriate
* handler for the desired service and invoke() it.
*/
public void invoke(MessageContext msgContext) throws AxisFault {
- long t0=0, t1=0, t2=0, t3=0, t4=0, t5=0;
- if( tlog.isDebugEnabled() ) {
+ if ( tlog.isDebugEnabled() ) {
t0=System.currentTimeMillis();
}
@@ -154,6 +313,21 @@
// set active context
setCurrentMessageContext(msgContext);
+ // Look for WSSecurity impl
+ String tmp = msgContext.getStrProp( "WSSecurityImpl" );
+ if ( tmp == null )
+ tmp = (String) msgContext.getAxisEngine()
+ .getOption("WSSecurityImpl");
+ if ( tmp != null )
+ secImpl = (WSSecInterface) Class.forName(tmp).newInstance();
+
+ // Look for WSRM impl
+ tmp = msgContext.getStrProp( "WSRMImpl" );
+ if ( tmp == null )
+ tmp = (String) msgContext.getAxisEngine().getOption("WSRMImpl");
+ if ( tmp != null )
+ rmImpl = (RMInterface) Class.forName(tmp).newInstance();
+
hName = msgContext.getStrProp( MessageContext.ENGINE_HANDLER );
if ( hName != null ) {
if ( (h = getHandler(hName)) == null ) {
@@ -167,16 +341,23 @@
h = null ;
}
}
- if( tlog.isDebugEnabled() ) {
+ if ( tlog.isDebugEnabled() ) {
t1=System.currentTimeMillis();
}
- if ( h != null )
+ if ( h != null ) {
+ try {
h.invoke(msgContext);
+ }
+ catch(Exception exp ) {
+ exp.printStackTrace();
+ throw exp ;
+ }
+ }
else
throw new AxisFault( "Server.error",
Messages.getMessage("noHandler00", hName),
null, null );
- if( tlog.isDebugEnabled() ) {
+ if ( tlog.isDebugEnabled() ) {
t2=System.currentTimeMillis();
tlog.debug( "AxisServer.invoke " + hName + " invoke=" +
( t2-t1 ) + " pre=" + (t1-t0 ));
@@ -220,90 +401,62 @@
*/
- /* Process the Transport Specific Request Chain */
- /**********************************************/
- hName = msgContext.getTransportName();
- SimpleTargetedChain transportChain = null;
-
- if (log.isDebugEnabled())
- log.debug(Messages.getMessage("transport01", "AxisServer.invoke", hName));
-
- if( tlog.isDebugEnabled() ) {
- t1=System.currentTimeMillis();
- }
- if ( hName != null && (h = getTransport( hName )) != null ) {
- if (h instanceof SimpleTargetedChain) {
- transportChain = (SimpleTargetedChain)h;
- h = transportChain.getRequestHandler();
- if (h != null)
- h.invoke(msgContext);
+ invokeInboundTransport(msgContext);
+
+ boolean skipService = false ;
+ if ( rmImpl != null ) {
+ try {
+ skipService = rmImpl.processRMHeaders( msgContext );
+ }
+ catch(Exception exp) {
+ skipService = true ;
+ if ( !(exp instanceof AxisFault) )
+ exp = AxisFault.makeFault( exp );
+ msgContext.setPastPivot( true );
+ msgContext.setResponseMessage( new Message(exp) );
+
+ // Kind of a hack but Axis doesn't have any way for a
+ // handler to throw an exception AND include a fault
+ // header in the response message - so for now just
+ // have the RM code pass it back this way - hopefully
+ // we'll have a nicer solution in the WAS version
+ SOAPHeaderElement hdr ;
+ hdr = (SOAPHeaderElement) msgContext
+ .getProperty("HeaderFault");
+ if ( hdr != null ) {
+ SOAPEnvelope env = msgContext.getResponseMessage()
+ .getSOAPEnvelope();
+ env.addHeader( hdr );
}
+ // End of hack
+
+ /* Process the Global Response Chain */
+ /***********************************/
+ // Process global/hard-coded handlers
+ WSAHandler.fixAction( msgContext );
+ WSAHandler.invoke( msgContext );
+
+ if ((h = getGlobalResponse()) != null)
+ h.invoke(msgContext);
+ }
}
- if( tlog.isDebugEnabled() ) {
- t2=System.currentTimeMillis();
- }
- /* Process the Global Request Chain */
- /**********************************/
- if ((h = getGlobalRequest()) != null ) {
- h.invoke(msgContext);
- }
+ if ( !skipService )
+ invokeService(msgContext);
- /**
- * At this point, the service should have been set by someone
- * (either the originator of the MessageContext, or one of the
- * transport or global Handlers). If it hasn't been set, we
- * fault.
- */
- h = msgContext.getService();
- if (h == null) {
- // It's possible that we haven't yet parsed the
- // message at this point. This is a kludge to
- // make sure we have. There probably wants to be
- // some kind of declarative "parse point" on the handler
- // chain instead....
- Message rm = msgContext.getRequestMessage();
- rm.getSOAPEnvelope().getFirstBody();
-
- h = msgContext.getService();
- if (h == null)
- throw new AxisFault("Server.NoService",
- Messages.getMessage("noService05",
- "" + msgContext.getTargetService()),
- null, null );
- }
- if( tlog.isDebugEnabled() ) {
- t3=System.currentTimeMillis();
- }
+ msgContext.setPastPivot( true );
- initSOAPConstants(msgContext);
- try {
- h.invoke(msgContext);
- } catch (AxisFault ae) {
- if ((h = getGlobalRequest()) != null ) {
- h.onFault(msgContext);
- }
- throw ae;
- }
+ /*
+ if ( msgContext.getIsOneWay() )
+ msgContext.setResponseMessage( null );
+ */
- if( tlog.isDebugEnabled() ) {
- t4=System.currentTimeMillis();
- }
+ // Send async response if needed
+ WSAHandler.sendResponse( msgContext );
- /* Process the Global Response Chain */
- /***********************************/
- if ((h = getGlobalResponse()) != null)
- h.invoke(msgContext);
+ invokeOutboundTransport(msgContext);
- /* Process the Transport Specific Response Chain */
- /***********************************************/
- if (transportChain != null) {
- h = transportChain.getResponseHandler();
- if (h != null)
- h.invoke(msgContext);
- }
-
- if( tlog.isDebugEnabled() ) {
+ if ( tlog.isDebugEnabled() ) {
t5=System.currentTimeMillis();
tlog.debug( "AxisServer.invoke2 " +
" preTr=" +
@@ -337,7 +490,7 @@
* Extract ans store soap constants info from the envelope
* @param msgContext
* @throws AxisFault
- */
+ */
private void initSOAPConstants(MessageContext msgContext) throws AxisFault {
Message msg = msgContext.getRequestMessage();
if (msg == null)
@@ -466,9 +619,9 @@
// make sure we have. There probably wants to be
// some kind of declarative "parse point" on the handler
// chain instead....
- Message rm = msgContext.getRequestMessage();
- if (rm != null) {
- rm.getSOAPEnvelope().getFirstBody();
+ Message msg = msgContext.getRequestMessage();
+ if (msg != null) {
+ msg.getSOAPEnvelope().getFirstBody();
h = msgContext.getService();
}
if (h == null) {
Modified: webservices/axis/trunk/java/src/org/apache/axis/transport/http/SimpleAxisServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/src/org/apache/axis/transport/http/SimpleAxisServer.java?rev=377293&r1=377292&r2=377293&view=diff
==============================================================================
--- webservices/axis/trunk/java/src/org/apache/axis/transport/http/SimpleAxisServer.java (original)
+++ webservices/axis/trunk/java/src/org/apache/axis/transport/http/SimpleAxisServer.java Sun Feb 12 18:38:09 2006
@@ -337,6 +337,12 @@
pool.shutdown();
}
+ public void startListening(int port) throws Exception {
+ ServerSocket ss = new ServerSocket(port);
+ setServerSocket(ss);
+ start( true );
+ }
+
/**
* Server process.
*/
Added: webservices/axis/trunk/java/src/org/apache/axis/wsrm/RMInterface.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/src/org/apache/axis/wsrm/RMInterface.java?rev=377293&view=auto
==============================================================================
--- webservices/axis/trunk/java/src/org/apache/axis/wsrm/RMInterface.java (added)
+++ webservices/axis/trunk/java/src/org/apache/axis/wsrm/RMInterface.java Sun Feb 12 18:38:09 2006
@@ -0,0 +1,9 @@
+package org.apache.axis.wsrm ;
+
+import org.apache.axis.MessageContext ;
+
+public interface RMInterface {
+ public void addRMHeaders(MessageContext msgContext) throws Exception ;
+ public boolean sendMessage(MessageContext msgContext) throws Exception ;
+ public boolean processRMHeaders(MessageContext msgContext) throws Exception ;
+};
Modified: webservices/axis/trunk/java/test/functional/FunctionalTests.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/test/functional/FunctionalTests.java?rev=377293&r1=377292&r2=377293&view=diff
==============================================================================
--- webservices/axis/trunk/java/test/functional/FunctionalTests.java (original)
+++ webservices/axis/trunk/java/test/functional/FunctionalTests.java Sun Feb 12 18:38:09 2006
@@ -80,6 +80,8 @@
//suite.addTestSuite(TestMimeHeaders.class);
suite.addTestSuite(TestAutoTypes.class);
+
+ suite.addTestSuite(TestWSA.class);
return suite;
}
Added: webservices/axis/trunk/java/test/functional/TestWSA.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/test/functional/TestWSA.java?rev=377293&view=auto
==============================================================================
--- webservices/axis/trunk/java/test/functional/TestWSA.java (added)
+++ webservices/axis/trunk/java/test/functional/TestWSA.java Sun Feb 12 18:38:09 2006
@@ -0,0 +1,69 @@
+package test.functional;
+
+import junit.framework.TestCase;
+import org.apache.axis.client.AdminClient;
+import org.apache.axis.client.Call;
+import org.apache.axis.client.Service ;
+import org.apache.axis.encoding.XMLType;
+import org.apache.axis.utils.Options;
+import javax.xml.rpc.ParameterMode;
+import javax.xml.namespace.QName;
+import org.apache.axis.transport.http.SimpleAxisServer ;
+
+/**
+ * Test WSAddressing
+ */
+public class TestWSA extends TestCase {
+ public Call call = null ;
+
+ public TestWSA(String s) {
+ super(s);
+ }
+
+ /**
+ * Sets up the WSA Async listener
+ */
+ protected void setUp() throws Exception {
+ (new SimpleAxisServer()).startListening(88);
+ AdminClient.main( new String[] { "samples/wsa/deploy.wsdd" } );
+ }
+
+ public void testWSA() throws Exception {
+ Service service = new Service();
+ Call call = (Call) service.createCall();
+ Object rc = null ;
+ String rcStr = null ;
+
+ call.setTargetEndpointAddress( "http://localhost:8080/axis/services/wsaService");
+ call.addParameter( "text", XMLType.XSD_STRING, ParameterMode.IN );
+ call.setReturnType( XMLType.XSD_STRING );
+ call.setEncodingStyle("");
+
+ System.out.println( "Running non-WSA echo" );
+ rc = call.invoke( "echo", new Object[] { "hi1" } );
+ System.out.println( "rc: " + rc );
+ assertEquals( rc, "hi1" );
+
+ System.out.println( "Turning WSA on, and redoing echo" );
+ call.setProperty( "useWSA", "true" );
+ rc = call.invoke( "echo", new Object[] { "hi2" } );
+ System.out.println( "rc: " + rc );
+ assertEquals( rc, "hi2" );
+ assertEquals( null, call.getProperty("ASYNCRESPONSE") );
+
+ System.out.println( "Setting wsa:ReplyTo to async" );
+ call.setReplyTo( "http://localhost:88/axis/services/asyncService" );
+ rc = call.invoke( "echo", new Object[] { "hi3" } );
+ System.out.println( "rc: " + rc );
+ assertEquals( rc, "hi3" );
+ assertEquals( "true", call.getMessageContext().getProperty("ASYNCRESPONSE") );
+
+ /*
+ System.out.println( "Calling ping (one way)" );
+ call.invokeOneWay( "ping", new Object[] { "hi" } );
+
+ Thread.sleep(1000);
+ */
+ }
+
+}
Modified: webservices/axis/trunk/java/test/functional/auto-deploy.wsdd
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/test/functional/auto-deploy.wsdd?rev=377293&r1=377292&r2=377293&view=diff
==============================================================================
--- webservices/axis/trunk/java/test/functional/auto-deploy.wsdd (original)
+++ webservices/axis/trunk/java/test/functional/auto-deploy.wsdd Sun Feb 12 18:38:09 2006
@@ -5,15 +5,18 @@
<globalConfiguration>
<parameter name="axis.doAutoTypes" value="true"/>
<parameter name="disablePrettyXML" value="true"/>
- <requestFlow>
- <handler type="java:org.apache.axis.handlers.JWSHandler">
- <parameter name="scope" value="session"/>
- </handler>
- <handler type="java:org.apache.axis.handlers.JWSHandler">
- <parameter name="scope" value="request"/>
- <parameter name="extension" value=".jwr"/>
- </handler>
- </requestFlow>
</globalConfiguration>
+
+ <transport name="SimpleHTTP">
+ <requestFlow>
+ <handler type="java:org.apache.axis.handlers.JWSHandler">
+ <parameter name="scope" value="session"/>
+ </handler>
+ <handler type="java:org.apache.axis.handlers.JWSHandler">
+ <parameter name="scope" value="request"/>
+ <parameter name="extension" value=".jwr"/>
+ </handler>
+ </requestFlow>
+ </transport>
</deployment>