You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by di...@apache.org on 2004/08/12 07:00:30 UTC
cvs commit: ws-fx/addressing/test/org/apache/ws/addressing/handler ClientSideAddressingHandlerTestCase.java
dims 2004/08/11 22:00:30
Modified: addressing/src/org/apache/axis/message/addressing/handler
AxisClientSideAddressingHandler.java
AxisServerSideAddressingHandler.java
GenericAxisHandler.java
addressing/src/org/apache/ws/addressing/handler
AbstractAddressingHandler.java
addressing/test/org/apache/ws/addressing/handler
ClientSideAddressingHandlerTestCase.java
Log:
Patch from Springer, Ian P. <ia...@hp.com>
=====================================================================
This makes it optional for the Axis handlers to be configured as
JAXRPCHandlers in the wsdd.
=====================================================================
Revision Changes Path
1.2 +167 -174 ws-fx/addressing/src/org/apache/axis/message/addressing/handler/AxisClientSideAddressingHandler.java
Index: AxisClientSideAddressingHandler.java
===================================================================
RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/handler/AxisClientSideAddressingHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AxisClientSideAddressingHandler.java 9 Aug 2004 16:36:18 -0000 1.1
+++ AxisClientSideAddressingHandler.java 12 Aug 2004 05:00:29 -0000 1.2
@@ -18,12 +18,12 @@
import org.apache.axis.AxisFault;
import org.apache.axis.Handler;
+import org.apache.axis.MessageContext;
import org.apache.ws.addressing.handler.ClientSideAddressingHandler;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import javax.xml.namespace.QName;
-import javax.xml.rpc.handler.MessageContext;
import java.util.Hashtable;
import java.util.List;
@@ -36,178 +36,171 @@
public class AxisClientSideAddressingHandler extends ClientSideAddressingHandler implements Handler
{
- private GenericAxisHandler axisHelperHandler = new GenericAxisHandler( this );
+ private GenericAxisHandler axisHelperHandler = new GenericAxisHandler( this );
+
+ /**
+ * @see org.apache.axis.Handler#init()
+ */
+ public void init()
+ {
+ axisHelperHandler.init();
+ }
+
+ /**
+ * @see org.apache.axis.Handler#cleanup()
+ */
+ public void cleanup()
+ {
+ axisHelperHandler.cleanup();
+ }
+
+ /**
+ * @see org.apache.axis.Handler#canHandleBlock(javax.xml.namespace.QName)
+ */
+ public boolean canHandleBlock( QName qname )
+ {
+ return ( axisHelperHandler.canHandleBlock( qname ) );
+ }
+
+ /**
+ * @see org.apache.axis.Handler#setOption(java.lang.String, java.lang.Object)
+ */
+ public void setOption( String name,
+ Object value )
+ {
+ axisHelperHandler.setOption( name, value );
+ }
+
+ /**
+ * Set a default value for the given option: if the option is not already set, then set it. if the option is already set,
+ * then do not set it.
+ * <p/>
+ * If this is called multiple times, the first with a non-null value if 'value' will set the default, remaining calls will
+ * be ignored.
+ * <p/>
+ * Returns true if value set (by this call), otherwise false;
+ */
+ public boolean setOptionDefault( String name,
+ Object value )
+ {
+ return axisHelperHandler.setOptionDefault( name, value );
+ }
+
+ /**
+ * @see org.apache.axis.Handler#getOption(java.lang.String)
+ */
+ public Object getOption( String name )
+ {
+ return axisHelperHandler.getOption( name );
+ }
+
+ /**
+ * @see org.apache.axis.Handler#getOptions()
+ */
+ public Hashtable getOptions()
+ {
+ return axisHelperHandler.getOptions();
+ }
+
+ /**
+ * @see org.apache.axis.Handler#setOptions(java.util.Hashtable)
+ */
+ public void setOptions( Hashtable opts )
+ {
+ axisHelperHandler.setOptions( opts );
+ }
+
+ /**
+ * @see org.apache.axis.Handler#setName(java.lang.String)
+ */
+ public void setName( String name )
+ {
+ axisHelperHandler.setName( name );
+ }
+
+ /**
+ * @see org.apache.axis.Handler#getName()
+ */
+ public String getName()
+ {
+ return axisHelperHandler.getName();
+ }
+
+ /**
+ * @see org.apache.axis.Handler#getDeploymentData(org.w3c.dom.Document)
+ */
+ public Element getDeploymentData( Document doc )
+ {
+ return axisHelperHandler.getDeploymentData( doc );
+ }
+
+ /**
+ * @see org.apache.axis.Handler#getUnderstoodHeaders()
+ */
+ public List getUnderstoodHeaders()
+ {
+ return axisHelperHandler.getUnderstoodHeaders();
+ }
+
+ /**
+ * @see org.apache.axis.Handler#generateWSDL(org.apache.axis.MessageContext)
+ */
+ public void generateWSDL( MessageContext msgContext ) throws AxisFault
+ {
+ axisHelperHandler.generateWSDL( msgContext );
+ }
+
+ /**
+ * @see org.apache.axis.Handler#invoke(org.apache.axis.MessageContext)
+ */
+ public void invoke( MessageContext msgContext ) throws AxisFault
+ {
+ axisHelperHandler.invoke( msgContext );
+ }
+
+ /**
+ * @see org.apache.axis.Handler#onFault(org.apache.axis.MessageContext)
+ */
+ public void onFault( MessageContext msgContext )
+ {
+ axisHelperHandler.onFault( msgContext );
+ }
+
+ /**
+ * Use the UUID generator that comes with Axis.
+ *
+ * @return a UUID
+ */
+ protected String generateUUId()
+ {
+ return axisHelperHandler.generateUUId();
+ }
+
+ /**
+ * Axis-specific impl of {@link org.apache.ws.addressing.handler.ClientSideAddressingHandler#getSOAPAction(javax.xml.rpc.handler.MessageContext)}.
+ *
+ * @param jaxRpcMsgContext JAX-RPC message context
+ *
+ * @return the value of the SOAPAction HTTP header
+ */
+ protected String getSOAPAction( javax.xml.rpc.handler.MessageContext jaxRpcMsgContext )
+ {
+ MessageContext msgContext = (MessageContext) jaxRpcMsgContext;
+ return msgContext.getSOAPActionURI();
+ }
+
+ /**
+ * Axis-specific impl of {@link org.apache.ws.addressing.handler.ClientSideAddressingHandler#setSOAPAction(javax.xml.rpc.handler.MessageContext,
+ * String)}.
+ *
+ * @param jaxRpcMsgContext JAX-RPC message context
+ * @param actionURI the SOAPAction URI to be set
+ */
+ protected void setSOAPAction( javax.xml.rpc.handler.MessageContext jaxRpcMsgContext, String actionURI )
+ {
+ MessageContext msgContext = (MessageContext) jaxRpcMsgContext;
+ msgContext.setUseSOAPAction( true );
+ msgContext.setSOAPActionURI( actionURI );
+ }
- /**
- * @see org.apache.axis.Handler#init()
- */
- public void init()
- {
- axisHelperHandler.init();
- }
-
- /**
- * @see org.apache.axis.Handler#cleanup()
- */
- public void cleanup()
- {
- axisHelperHandler.cleanup();
- }
-
- /**
- * @see org.apache.axis.Handler#onFault(org.apache.axis.MessageContext)
- */
- public void onFault( MessageContext msgContext )
- {
- axisHelperHandler.onFault( (org.apache.axis.MessageContext) msgContext );
- }
-
- /**
- * @see org.apache.axis.Handler#canHandleBlock(javax.xml.namespace.QName)
- */
- public boolean canHandleBlock( QName qname )
- {
- return ( axisHelperHandler.canHandleBlock( qname ) );
- }
-
- /**
- * @see org.apache.axis.Handler#setOption(java.lang.String, java.lang.Object)
- */
- public void setOption( String name,
- Object value )
- {
- axisHelperHandler.setOption( name, value );
- }
-
- /**
- * Set a default value for the given option: if the option is not already set, then set it. if the option is already set,
- * then do not set it.
- * <p/>
- * If this is called multiple times, the first with a non-null value if 'value' will set the default, remaining calls will
- * be ignored.
- * <p/>
- * Returns true if value set (by this call), otherwise false;
- */
- public boolean setOptionDefault( String name,
- Object value )
- {
- return axisHelperHandler.setOptionDefault( name, value );
- }
-
- /**
- * @see org.apache.axis.Handler#getOption(java.lang.String)
- */
- public Object getOption( String name )
- {
- return axisHelperHandler.getOption( name );
- }
-
- /**
- * @see org.apache.axis.Handler#getOptions()
- */
- public Hashtable getOptions()
- {
- return axisHelperHandler.getOptions();
- }
-
- /**
- * @see org.apache.axis.Handler#setOptions(java.util.Hashtable)
- */
- public void setOptions( Hashtable opts )
- {
- axisHelperHandler.setOptions( opts );
- }
-
- /**
- * @see org.apache.axis.Handler#setName(java.lang.String)
- */
- public void setName( String name )
- {
- axisHelperHandler.setName( name );
- }
-
- /**
- * @see org.apache.axis.Handler#getName()
- */
- public String getName()
- {
- return axisHelperHandler.getName();
- }
-
- /**
- * @see org.apache.axis.Handler#getDeploymentData(org.w3c.dom.Document)
- */
- public Element getDeploymentData( Document doc )
- {
- return axisHelperHandler.getDeploymentData( doc );
- }
-
- /**
- * @see org.apache.axis.Handler#getUnderstoodHeaders()
- */
- public List getUnderstoodHeaders()
- {
- return axisHelperHandler.getUnderstoodHeaders();
- }
-
- /**
- * @see org.apache.axis.Handler#generateWSDL(org.apache.axis.MessageContext)
- */
- public void generateWSDL( org.apache.axis.MessageContext msgContext ) throws AxisFault
- {
- axisHelperHandler.generateWSDL( msgContext );
- }
-
- /**
- * @see org.apache.axis.Handler#invoke(org.apache.axis.MessageContext)
- */
- public void invoke( org.apache.axis.MessageContext msgContext ) throws AxisFault
- {
- axisHelperHandler.invoke( msgContext );
- }
-
- /**
- * @see org.apache.axis.Handler#onFault(org.apache.axis.MessageContext)
- */
- public void onFault( org.apache.axis.MessageContext msgContext )
- {
- axisHelperHandler.onFault( msgContext );
- }
-
- /**
- * Use the UUID generator that comes with Axis.
- *
- * @return a UUID
- */
- protected String generateUUId()
- {
- return axisHelperHandler.generateUUId();
- }
-
- /**
- * Axis-specific impl of {@link org.apache.ws.addressing.handler.ClientSideAddressingHandler#getSOAPAction(javax.xml.rpc.handler.MessageContext)}.
- *
- * @param msgContext JAX-RPC message context
- *
- * @return the value of the SOAPAction HTTP header
- */
- protected String getSOAPAction( MessageContext msgContext )
- {
- org.apache.axis.MessageContext axisMsgContext = (org.apache.axis.MessageContext) msgContext;
- return axisMsgContext.getSOAPActionURI();
- }
-
- /**
- * Axis-specific impl of {@link org.apache.ws.addressing.handler.ClientSideAddressingHandler#setSOAPAction(javax.xml.rpc.handler.MessageContext,
- * String)}.
- *
- * @param msgContext JAX-RPC message context
- * @param actionURI the SOAPAction URI to be set
- */
- protected void setSOAPAction( MessageContext msgContext, String actionURI )
- {
- org.apache.axis.MessageContext axisMsgContext = (org.apache.axis.MessageContext) msgContext;
- axisMsgContext.setUseSOAPAction( true );
- axisMsgContext.setSOAPActionURI( actionURI );
- }
}
1.2 +195 -203 ws-fx/addressing/src/org/apache/axis/message/addressing/handler/AxisServerSideAddressingHandler.java
Index: AxisServerSideAddressingHandler.java
===================================================================
RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/handler/AxisServerSideAddressingHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AxisServerSideAddressingHandler.java 9 Aug 2004 16:36:19 -0000 1.1
+++ AxisServerSideAddressingHandler.java 12 Aug 2004 05:00:29 -0000 1.2
@@ -19,6 +19,7 @@
import org.apache.axis.AxisFault;
import org.apache.axis.Handler;
import org.apache.axis.Message;
+import org.apache.axis.MessageContext;
import org.apache.axis.message.addressing.AddressingHeaders;
import org.apache.axis.message.addressing.Constants;
import org.apache.axis.message.addressing.EndpointReference;
@@ -30,7 +31,6 @@
import javax.xml.rpc.Call;
import javax.xml.rpc.JAXRPCException;
import javax.xml.rpc.Service;
-import javax.xml.rpc.handler.MessageContext;
import javax.xml.rpc.handler.soap.SOAPMessageContext;
import javax.xml.soap.SOAPBody;
import java.util.Hashtable;
@@ -45,208 +45,200 @@
public class AxisServerSideAddressingHandler extends ServerSideAddressingHandler implements Handler
{
- private GenericAxisHandler axisHelperHandler = new GenericAxisHandler( this );
+ private GenericAxisHandler axisHelperHandler = new GenericAxisHandler( this );
- /**
- * @see org.apache.axis.Handler#init()
- */
- public void init()
- {
- axisHelperHandler.init();
- }
-
- /**
- * @see org.apache.axis.Handler#cleanup()
- */
- public void cleanup()
- {
- axisHelperHandler.cleanup();
- }
-
- /**
- * @see org.apache.axis.Handler#onFault(org.apache.axis.MessageContext)
- */
- public void onFault( MessageContext msgContext )
- {
- axisHelperHandler.onFault( (org.apache.axis.MessageContext) msgContext );
- }
-
- /**
- * @see org.apache.axis.Handler#canHandleBlock(javax.xml.namespace.QName)
- */
- public boolean canHandleBlock( QName qname )
- {
- return ( axisHelperHandler.canHandleBlock( qname ) );
- }
-
- /**
- * @see org.apache.axis.Handler#setOption(java.lang.String, java.lang.Object)
- */
- public void setOption( String name,
- Object value )
- {
- axisHelperHandler.setOption( name, value );
- }
-
- /**
- * Set a default value for the given option:
- * if the option is not already set, then set it.
- * if the option is already set, then do not set it.
- * <p/>
- * If this is called multiple times, the first with a non-null value
- * if 'value' will set the default, remaining calls will be ignored.
- * <p/>
- * Returns true if value set (by this call), otherwise false;
- */
- public boolean setOptionDefault( String name,
- Object value )
- {
- return axisHelperHandler.setOptionDefault( name, value );
- }
-
- /**
- * @see org.apache.axis.Handler#getOption(java.lang.String)
- */
- public Object getOption( String name )
- {
- return axisHelperHandler.getOption( name );
- }
-
- /**
- * @see org.apache.axis.Handler#getOptions()
- */
- public Hashtable getOptions()
- {
- return axisHelperHandler.getOptions();
- }
-
- /**
- * @see org.apache.axis.Handler#setOptions(java.util.Hashtable)
- */
- public void setOptions( Hashtable opts )
- {
- axisHelperHandler.setOptions( opts );
- }
-
- /**
- * @see org.apache.axis.Handler#setName(java.lang.String)
- */
- public void setName( String name )
- {
- axisHelperHandler.setName( name );
- }
-
- /**
- * @see org.apache.axis.Handler#getName()
- */
- public String getName()
- {
- return axisHelperHandler.getName();
- }
-
- /**
- * @see org.apache.axis.Handler#getDeploymentData(org.w3c.dom.Document)
- */
- public Element getDeploymentData( Document doc )
- {
- return axisHelperHandler.getDeploymentData( doc );
- }
-
- /**
- * @see org.apache.axis.Handler#getUnderstoodHeaders()
- */
- public List getUnderstoodHeaders()
- {
- return axisHelperHandler.getUnderstoodHeaders();
- }
-
- /**
- * @see org.apache.axis.Handler#generateWSDL(org.apache.axis.MessageContext)
- */
- public void generateWSDL( org.apache.axis.MessageContext msgContext ) throws AxisFault
- {
- axisHelperHandler.generateWSDL( msgContext );
- }
-
- /**
- * @see org.apache.axis.Handler#invoke(org.apache.axis.MessageContext)
- */
- public void invoke( org.apache.axis.MessageContext msgContext ) throws AxisFault
- {
- axisHelperHandler.invoke( msgContext );
- }
-
- /**
- * @see org.apache.axis.Handler#onFault(org.apache.axis.MessageContext)
- */
- public void onFault( org.apache.axis.MessageContext msgContext )
- {
- axisHelperHandler.onFault( msgContext );
- }
-
- /**
- * Use the UUID generator that comes with Axis.
- *
- * @return a UUID
- */
- protected String generateUUId()
- {
- return axisHelperHandler.generateUUId();
- }
-
- // TODO: not sure if overriding this method is even necessary.
- protected void forwardMessage( SOAPMessageContext soapMsgContext, EndpointReference endpointRef )
- {
- try
- {
- Service service = getService( soapMsgContext );
- Call call = service.createCall();
- call.setTargetEndpointAddress( endpointRef.getAddress().toString() );
- ( (org.apache.axis.client.Call) call ).setRequestMessage( (Message) soapMsgContext.getMessage() );
- AddressingHeaders addrHeaders = buildAddressingHeadersForMessageForward( soapMsgContext, endpointRef );
- call.setProperty( Constants.ENV_ADDRESSING_REQUEST_HEADERS, addrHeaders );
- configureCall( call, soapMsgContext );
- call.invoke( new Object[0] );
- SOAPBody responseBody = soapMsgContext.getMessage().getSOAPPart().getEnvelope().getBody();
- removeAllChildElements( responseBody );
- }
- catch ( Exception e )
- {
- throw new JAXRPCException( "Failed to forward SOAP message." );
- }
-
- }
-
- protected void setTargetService( SOAPMessageContext soapMsgContext, AddressingHeaders headers )
- throws Exception
- {
- org.apache.axis.MessageContext axisMsgContext = (org.apache.axis.MessageContext) soapMsgContext;
- // TODO: why is the below code necessary? - add comments
- if ( axisMsgContext.getService() == null &&
- axisMsgContext.getTargetService() == null )
- {
- axisMsgContext.setTargetService( getTargetServiceName( headers ) );
- // This is to ensure the SOAPEnvelope is rebuilt with the right type mappings and
- // MessageContext is set with the right properties.
- if ( axisMsgContext.getTargetService() != null )
- {
- ( (Message) axisMsgContext.getMessage() ).getSOAPPartAsString();
- }
- }
- }
-
- private AddressingHeaders buildAddressingHeadersForMessageForward( SOAPMessageContext soapMsgContext, EndpointReference endpointRef )
- {
- AddressingHeaders headers = null;
- if ( soapMsgContext != null )
- {
- headers = (AddressingHeaders) soapMsgContext.getProperty( Constants.ENV_ADDRESSING_RESPONSE_HEADERS );
- }
- if ( headers == null )
- {
- headers = new AddressingHeaders( endpointRef );
- }
- return headers;
- }
+ /**
+ * @see org.apache.axis.Handler#init()
+ */
+ public void init()
+ {
+ axisHelperHandler.init();
+ }
+
+ /**
+ * @see org.apache.axis.Handler#cleanup()
+ */
+ public void cleanup()
+ {
+ axisHelperHandler.cleanup();
+ }
+
+ /**
+ * @see org.apache.axis.Handler#canHandleBlock(javax.xml.namespace.QName)
+ */
+ public boolean canHandleBlock( QName qname )
+ {
+ return ( axisHelperHandler.canHandleBlock( qname ) );
+ }
+
+ /**
+ * @see org.apache.axis.Handler#setOption(java.lang.String, java.lang.Object)
+ */
+ public void setOption( String name,
+ Object value )
+ {
+ axisHelperHandler.setOption( name, value );
+ }
+
+ /**
+ * Set a default value for the given option:
+ * if the option is not already set, then set it.
+ * if the option is already set, then do not set it.
+ * <p/>
+ * If this is called multiple times, the first with a non-null value
+ * if 'value' will set the default, remaining calls will be ignored.
+ * <p/>
+ * Returns true if value set (by this call), otherwise false;
+ */
+ public boolean setOptionDefault( String name,
+ Object value )
+ {
+ return axisHelperHandler.setOptionDefault( name, value );
+ }
+
+ /**
+ * @see org.apache.axis.Handler#getOption(java.lang.String)
+ */
+ public Object getOption( String name )
+ {
+ return axisHelperHandler.getOption( name );
+ }
+
+ /**
+ * @see org.apache.axis.Handler#getOptions()
+ */
+ public Hashtable getOptions()
+ {
+ return axisHelperHandler.getOptions();
+ }
+
+ /**
+ * @see org.apache.axis.Handler#setOptions(java.util.Hashtable)
+ */
+ public void setOptions( Hashtable opts )
+ {
+ axisHelperHandler.setOptions( opts );
+ }
+
+ /**
+ * @see org.apache.axis.Handler#setName(java.lang.String)
+ */
+ public void setName( String name )
+ {
+ axisHelperHandler.setName( name );
+ }
+
+ /**
+ * @see org.apache.axis.Handler#getName()
+ */
+ public String getName()
+ {
+ return axisHelperHandler.getName();
+ }
+
+ /**
+ * @see org.apache.axis.Handler#getDeploymentData(org.w3c.dom.Document)
+ */
+ public Element getDeploymentData( Document doc )
+ {
+ return axisHelperHandler.getDeploymentData( doc );
+ }
+
+ /**
+ * @see org.apache.axis.Handler#getUnderstoodHeaders()
+ */
+ public List getUnderstoodHeaders()
+ {
+ return axisHelperHandler.getUnderstoodHeaders();
+ }
+
+ /**
+ * @see org.apache.axis.Handler#generateWSDL(org.apache.axis.MessageContext)
+ */
+ public void generateWSDL( MessageContext msgContext ) throws AxisFault
+ {
+ axisHelperHandler.generateWSDL( msgContext );
+ }
+
+ /**
+ * @see org.apache.axis.Handler#invoke(org.apache.axis.MessageContext)
+ */
+ public void invoke( MessageContext msgContext ) throws AxisFault
+ {
+ axisHelperHandler.invoke( msgContext );
+ }
+
+ /**
+ * @see org.apache.axis.Handler#onFault(org.apache.axis.MessageContext)
+ */
+ public void onFault( MessageContext msgContext )
+ {
+ axisHelperHandler.onFault( msgContext );
+ }
+
+ /**
+ * Use the UUID generator that comes with Axis.
+ *
+ * @return a UUID
+ */
+ protected String generateUUId()
+ {
+ return axisHelperHandler.generateUUId();
+ }
+
+ // TODO: not sure if overriding this method is even necessary.
+ protected void forwardMessage( SOAPMessageContext soapMsgContext, EndpointReference endpointRef )
+ {
+ try
+ {
+ Service service = getService( soapMsgContext );
+ Call call = service.createCall();
+ call.setTargetEndpointAddress( endpointRef.getAddress().toString() );
+ ( (org.apache.axis.client.Call) call ).setRequestMessage( (Message) soapMsgContext.getMessage() );
+ AddressingHeaders addrHeaders = buildAddressingHeadersForMessageForward( soapMsgContext, endpointRef );
+ call.setProperty( Constants.ENV_ADDRESSING_REQUEST_HEADERS, addrHeaders );
+ configureCall( call, soapMsgContext );
+ call.invoke( new Object[0] );
+ SOAPBody responseBody = soapMsgContext.getMessage().getSOAPPart().getEnvelope().getBody();
+ removeAllChildElements( responseBody );
+ }
+ catch ( Exception e )
+ {
+ throw new JAXRPCException( "Failed to forward SOAP message." );
+ }
+
+ }
+
+ protected void setTargetService( SOAPMessageContext soapMsgContext, AddressingHeaders headers )
+ throws Exception
+ {
+ org.apache.axis.MessageContext axisMsgContext = (org.apache.axis.MessageContext) soapMsgContext;
+ // TODO: why is the below code necessary? - add comments
+ if ( axisMsgContext.getService() == null &&
+ axisMsgContext.getTargetService() == null )
+ {
+ axisMsgContext.setTargetService( getTargetServiceName( headers ) );
+ // This is to ensure the SOAPEnvelope is rebuilt with the right type mappings and
+ // MessageContext is set with the right properties.
+ if ( axisMsgContext.getTargetService() != null )
+ {
+ ( (Message) axisMsgContext.getMessage() ).getSOAPPartAsString();
+ }
+ }
+ }
+
+ private AddressingHeaders buildAddressingHeadersForMessageForward( SOAPMessageContext soapMsgContext, EndpointReference endpointRef )
+ {
+ AddressingHeaders headers = null;
+ if ( soapMsgContext != null )
+ {
+ headers = (AddressingHeaders) soapMsgContext.getProperty( Constants.ENV_ADDRESSING_RESPONSE_HEADERS );
+ }
+ if ( headers == null )
+ {
+ headers = new AddressingHeaders( endpointRef );
+ }
+ return headers;
+ }
}
1.2 +63 -51 ws-fx/addressing/src/org/apache/axis/message/addressing/handler/GenericAxisHandler.java
Index: GenericAxisHandler.java
===================================================================
RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/handler/GenericAxisHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- GenericAxisHandler.java 9 Aug 2004 16:36:19 -0000 1.1
+++ GenericAxisHandler.java 12 Aug 2004 05:00:29 -0000 1.2
@@ -21,8 +21,10 @@
import org.apache.axis.message.addressing.uuid.AxisUUIdGenerator;
import org.apache.ws.addressing.uuid.UUIdGeneratorFactory;
+import javax.xml.namespace.QName;
import javax.xml.rpc.JAXRPCException;
import javax.xml.rpc.handler.Handler;
+import javax.xml.rpc.handler.HandlerInfo;
/**
* Helper class to which the Axis-specific JAX-RPC handlers in this package
@@ -35,57 +37,67 @@
class GenericAxisHandler extends BasicHandler
{
- private Handler jaxRpcHandler;
+ private Handler jaxRpcHandler;
- public GenericAxisHandler( Handler handler )
- {
- jaxRpcHandler = handler;
- }
-
- /**
- * Impl of {@link org.apache.axis.Handler#invoke(org.apache.axis.MessageContext)}
- * that delegates to either
- * JAX-RPC {@link Handler#handleRequest(javax.xml.rpc.handler.MessageContext)} or
- * JAX-RPC {@link Handler#handleResponse(javax.xml.rpc.handler.MessageContext)},
- * depending upon whether the handler chain pivot has been passed yet or not.
- */
- public void invoke( org.apache.axis.MessageContext msgContext ) throws AxisFault
- {
- if ( !msgContext.getPastPivot() )
- {
- jaxRpcHandler.handleRequest( msgContext );
- }
- else
- {
- jaxRpcHandler.handleResponse( msgContext );
- }
- }
-
- /**
- * Impl of {@link org.apache.axis.Handler#onFault(org.apache.axis.MessageContext)}
- * that delegates to
- * JAX-RPC {@link Handler#handleFault(javax.xml.rpc.handler.MessageContext)}.
- */
- public void onFault( org.apache.axis.MessageContext msgContext )
- {
- jaxRpcHandler.handleFault( msgContext );
- }
-
- /**
- * Use the UUID generator that comes with Axis.
- *
- * @return a UUID
- */
- String generateUUId()
- {
- try
- {
- return UUIdGeneratorFactory.createUUIdGenerator( AxisUUIdGenerator.class ).generateUUId();
- }
- catch ( RuntimeException re )
- {
- throw new JAXRPCException( "Failed to generate UUId using Axis UUId generator " + AxisUUIdGenerator.class.getName() + ".", re );
- }
- }
+ public GenericAxisHandler( Handler handler )
+ {
+ jaxRpcHandler = handler;
+ }
+
+ /**
+ * Impl of {@link org.apache.axis.Handler#init()}
+ * that delegates to
+ * JAX-RPC {@link Handler#init(javax.xml.rpc.handler.HandlerInfo)}.
+ */
+ public void init()
+ {
+ jaxRpcHandler.init( new HandlerInfo( jaxRpcHandler.getClass(), getOptions(), new QName[0] ) );
+ }
+
+ /**
+ * Impl of {@link org.apache.axis.Handler#invoke(org.apache.axis.MessageContext)}
+ * that delegates to either
+ * JAX-RPC {@link Handler#handleRequest(javax.xml.rpc.handler.MessageContext)} or
+ * JAX-RPC {@link Handler#handleResponse(javax.xml.rpc.handler.MessageContext)},
+ * depending upon whether the handler chain pivot has been passed yet or not.
+ */
+ public void invoke( org.apache.axis.MessageContext msgContext ) throws AxisFault
+ {
+ if ( !msgContext.getPastPivot() )
+ {
+ jaxRpcHandler.handleRequest( msgContext );
+ }
+ else
+ {
+ jaxRpcHandler.handleResponse( msgContext );
+ }
+ }
+
+ /**
+ * Impl of {@link org.apache.axis.Handler#onFault(org.apache.axis.MessageContext)}
+ * that delegates to
+ * JAX-RPC {@link Handler#handleFault(javax.xml.rpc.handler.MessageContext)}.
+ */
+ public void onFault( org.apache.axis.MessageContext msgContext )
+ {
+ jaxRpcHandler.handleFault( msgContext );
+ }
+
+ /**
+ * Use the UUID generator that comes with Axis.
+ *
+ * @return a UUID
+ */
+ String generateUUId()
+ {
+ try
+ {
+ return UUIdGeneratorFactory.createUUIdGenerator( AxisUUIdGenerator.class ).generateUUId();
+ }
+ catch ( RuntimeException re )
+ {
+ throw new JAXRPCException( "Failed to generate UUId using Axis UUId generator " + AxisUUIdGenerator.class.getName() + ".", re );
+ }
+ }
}
1.2 +119 -68 ws-fx/addressing/src/org/apache/ws/addressing/handler/AbstractAddressingHandler.java
Index: AbstractAddressingHandler.java
===================================================================
RCS file: /home/cvs/ws-fx/addressing/src/org/apache/ws/addressing/handler/AbstractAddressingHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractAddressingHandler.java 9 Aug 2004 16:36:02 -0000 1.1
+++ AbstractAddressingHandler.java 12 Aug 2004 05:00:29 -0000 1.2
@@ -41,26 +41,24 @@
* @author Davanum Srinivas (dims@yahoo.com)
* @author Ian P. Springer <ia...@hp.com>
*/
-public abstract class AbstractAddressingHandler extends GenericHandler {
+public abstract class AbstractAddressingHandler extends GenericHandler
+{
public static final String CONFIG_PROP__ACTOR = "actor";
public static final String CONFIG_PROP__REFERENCE_PROPERTY_NAMES = "referencePropertyNames";
public static final String CONFIG_PROP__REMOVE_HEADERS = "removeHeaders";
- private static final Log LOG =
- LogFactory.getLog(AbstractAddressingHandler.class.getName());
-
static final String UUID_URI_SCHEME = "uuid";
private static final QName[] UNDERSTOOD_HEADERS = new QName[]{
- new QName(Constants.NS_URI_ADDRESSING, Constants.ACTION),
- new QName(Constants.NS_URI_ADDRESSING, Constants.FAULT_TO),
- new QName(Constants.NS_URI_ADDRESSING, Constants.FROM),
- new QName(Constants.NS_URI_ADDRESSING, Constants.MESSAGE_ID),
- new QName(Constants.NS_URI_ADDRESSING, Constants.RECIPIENT),
- new QName(Constants.NS_URI_ADDRESSING, Constants.RELATES_TO),
- new QName(Constants.NS_URI_ADDRESSING, Constants.REPLY_TO),
- new QName(Constants.NS_URI_ADDRESSING, Constants.TO),
+ new QName( Constants.NS_URI_ADDRESSING, Constants.ACTION ),
+ new QName( Constants.NS_URI_ADDRESSING, Constants.FAULT_TO ),
+ new QName( Constants.NS_URI_ADDRESSING, Constants.FROM ),
+ new QName( Constants.NS_URI_ADDRESSING, Constants.MESSAGE_ID ),
+ new QName( Constants.NS_URI_ADDRESSING, Constants.RECIPIENT ),
+ new QName( Constants.NS_URI_ADDRESSING, Constants.RELATES_TO ),
+ new QName( Constants.NS_URI_ADDRESSING, Constants.REPLY_TO ),
+ new QName( Constants.NS_URI_ADDRESSING, Constants.TO ),
};
/**
@@ -68,9 +66,10 @@
*/
protected static final boolean CONTINUE_HANDLER_CHAIN_PROCESSING = true;
+ private static final Log LOG =
+ LogFactory.getLog( AbstractAddressingHandler.class.getName() );
+
private Map handlerConfigProps;
- private String actor;
- private boolean removeHeaders;
private List refPropQNames;
/**
@@ -78,7 +77,8 @@
*
* @return Returns a list QNames of the SOAP headers that this handler processes
*/
- public QName[] getHeaders() {
+ public QName[] getHeaders()
+ {
return UNDERSTOOD_HEADERS;
}
@@ -95,21 +95,48 @@
*
* @param handlerInfo handler info containing handler configuration properties from deployment descriptor
*/
- public void init(HandlerInfo handlerInfo) {
- super.init(handlerInfo);
- LOG.info("Initializing JAX-RPC handler " + this.getClass().getName() + "...");
+ public void init( HandlerInfo handlerInfo )
+ {
+ super.init( handlerInfo );
+ LOG.info( "Initializing JAX-RPC handler " + this.getClass().getName() + "..." );
handlerConfigProps = handlerInfo.getHandlerConfig();
- initializeReferencePropertyNames();
- initializeRemoveHeaders();
- initializeActor();
+ initReferencePropertyQNames();
+ }
+
+ /**
+ * Returns this handler's configuration properties.
+ *
+ * @return this handler's configuration properties
+ */
+ protected Map getHandlerConfigProperties()
+ {
+ return handlerConfigProps;
}
- protected String getHandlerConfigProperty(String propName) {
- return (String) handlerConfigProps.get(propName);
+ /**
+ * Returns the value of the specified handler configuration property.
+ *
+ * @param propName the name of a configuration property
+ *
+ * @return the value of the specified handler configuration property
+ */
+ protected String getHandlerConfigProperty( String propName )
+ {
+ return (String) getHandlerConfigProperties().get( propName );
}
- protected boolean isHandlerConfigPropertyTrue(String propName) {
- return Boolean.TRUE.toString().equalsIgnoreCase(getHandlerConfigProperty(propName));
+ /**
+ * Returns true if the value of the specified handler configuration property is "true",
+ * or false otherwise.
+ *
+ * @param propName the name of a configuration property
+ *
+ * @return true if the value of the specified handler configuration property is "true",
+ * or false otherwise
+ */
+ protected boolean isHandlerConfigPropertyTrue( String propName )
+ {
+ return Boolean.TRUE.toString().equalsIgnoreCase( getHandlerConfigProperty( propName ) );
}
/**
@@ -118,73 +145,97 @@
*
* @return
*/
- protected String generateUUId() {
- try {
- return UUIdGeneratorFactory.createUUIdGenerator(AxisUUIdGenerator.class).generateUUId();
- } catch (RuntimeException re) {
- throw new JAXRPCException("Failed to generate UUId using default UUId generator " + UUIdGeneratorFactory.DEFAULT_IMPL_CLASSNAME + ".", re);
+ protected String generateUUId()
+ {
+ try
+ {
+ return UUIdGeneratorFactory.createUUIdGenerator( AxisUUIdGenerator.class ).generateUUId();
+ }
+ catch ( RuntimeException re )
+ {
+ throw new JAXRPCException( "Failed to generate UUId using default UUId generator " + UUIdGeneratorFactory.DEFAULT_IMPL_CLASSNAME + ".", re );
}
}
- protected String getActor() {
- return actor;
- }
-
- protected List getReferencePropertyQNames() {
- return refPropQNames;
+ protected boolean isMustUnderstandEnabled( MessageContext msgContext )
+ {
+ return isPropertyTrue( msgContext, Constants.ENV_ADDRESSING_SET_MUST_UNDERSTAND );
}
- protected boolean isRemoveHeadersEnabled() {
- return removeHeaders;
+ protected boolean isPropertyTrue( MessageContext msgContext, String propName )
+ {
+ return Boolean.TRUE.toString().equals( msgContext.getProperty( propName ) );
}
- protected boolean isMustUnderstandEnabled(MessageContext msgContext) {
- return isPropertyTrue(msgContext, Constants.ENV_ADDRESSING_SET_MUST_UNDERSTAND);
+ protected MessageID createMessageID()
+ throws URI.MalformedURIException
+ {
+ return new MessageID( new URI( UUID_URI_SCHEME + ":" + generateUUId() ) );
}
- protected boolean isPropertyTrue(MessageContext msgContext, String propName) {
- return Boolean.TRUE.toString().equals(msgContext.getProperty(propName));
+ protected List getReferencePropertyQNames()
+ {
+ return refPropQNames;
}
- protected MessageID createMessageID()
- throws URI.MalformedURIException {
- return new MessageID(new URI(UUID_URI_SCHEME + ":" + generateUUId()));
+ /**
+ * Returns the value of the "actor" handler config property.
+ *
+ * @return the value of the "actor" handler config property
+ */
+ protected String getActor()
+ {
+ return getHandlerConfigProperty( CONFIG_PROP__ACTOR );
}
- protected void initializeActor() {
- actor = getHandlerConfigProperty(CONFIG_PROP__ACTOR);
+ /**
+ * Returns the value of the "removeHeaders" handler config property.
+ *
+ * @return the value of the "removeHeaders" handler config property
+ */
+ protected boolean isRemoveHeadersEnabled()
+ {
+ return isHandlerConfigPropertyTrue( CONFIG_PROP__REMOVE_HEADERS );
}
/**
- * Retrieve QNames for reference properties from deployment and initialize the refPropQNames list which is the list of
- * reference properties that this handler should care about.
+ * Retrieves QNames for reference properties from WSDD and initializes
+ * refPropQNames - the list of reference properties that this handler
+ * should care about.
*/
- private void initializeReferencePropertyNames() {
- String refPropNames = getHandlerConfigProperty(CONFIG_PROP__REFERENCE_PROPERTY_NAMES);
- if (refPropNames == null) {
- LOG.debug("No reference properties will be processed.");
+ protected void initReferencePropertyQNames()
+ {
+ String refPropNamesConfigPropValue = getHandlerConfigProperty( CONFIG_PROP__REFERENCE_PROPERTY_NAMES );
+
+ if ( refPropNamesConfigPropValue == null )
+ {
+ LOG.debug( "No reference properties will be processed." );
refPropQNames = new ArrayList();
- } else if (refPropNames.equals("*")) {
- LOG.debug("All reference properties will be processed.");
+ }
+ else if ( refPropNamesConfigPropValue.equals( "*" ) )
+ {
+ LOG.debug( "All reference properties will be processed." );
refPropQNames = null;
- } else {
+ }
+ else
+ {
refPropQNames = new ArrayList();
- StringTokenizer tokenizer = new StringTokenizer(refPropNames, ",");
- while (tokenizer.hasMoreTokens()) {
+ StringTokenizer tokenizer = new StringTokenizer( refPropNamesConfigPropValue, "," );
+ while ( tokenizer.hasMoreTokens() )
+ {
String qnameString = tokenizer.nextToken().trim();
- try {
- QName qname = QName.valueOf(qnameString);
- LOG.debug("Reference properties with QName '" + qnameString + "' will be processed.");
- refPropQNames.add(qname);
- } catch (IllegalArgumentException iae) {
- LOG.warn("Invalid QName '" + qnameString + "' specified in handler config.");
+ try
+ {
+ QName qname = QName.valueOf( qnameString );
+ LOG.debug( "Reference properties with QName '" + qnameString + "' will be processed." );
+ refPropQNames.add( qname );
+ }
+ catch ( IllegalArgumentException iae )
+ {
+ LOG.warn( "Invalid QName '" + qnameString + "' specified in handler config." );
}
}
}
- }
-
- private void initializeRemoveHeaders() {
- removeHeaders = isHandlerConfigPropertyTrue(CONFIG_PROP__REMOVE_HEADERS);
}
}
1.2 +4 -2 ws-fx/addressing/test/org/apache/ws/addressing/handler/ClientSideAddressingHandlerTestCase.java
Index: ClientSideAddressingHandlerTestCase.java
===================================================================
RCS file: /home/cvs/ws-fx/addressing/test/org/apache/ws/addressing/handler/ClientSideAddressingHandlerTestCase.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ClientSideAddressingHandlerTestCase.java 9 Aug 2004 16:34:27 -0000 1.1
+++ ClientSideAddressingHandlerTestCase.java 12 Aug 2004 05:00:30 -0000 1.2
@@ -104,8 +104,10 @@
* @throws Exception on error
*/
public void testHandleFault() throws Exception {
- // TODO
- System.err.println("WARN: testHandleFault() not implemented.");
+ SOAPMessageContext msgContext = createSOAPMessageContext();
+ msgContext.setMessage( createMessage( "org/apache/ws/addressing/handler/testRequest.xml" ) );
+ m_handler.setSOAPAction( msgContext, "http://foo.com/mail#Put" );
+ assertTrue( "handleFault() should always return true", m_handler.handleFault( msgContext ) );
}
}