You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by da...@apache.org on 2006/08/02 20:35:17 UTC
svn commit: r428084 - in /webservices/axis2/trunk/java/modules:
addressing/src/META-INF/ addressing/src/org/apache/axis2/handlers/addressing/
core/src/org/apache/axis2/description/ core/src/org/apache/axis2/engine/
integration/test/org/apache/axis2/add...
Author: davidillsley
Date: Wed Aug 2 11:35:16 2006
New Revision: 428084
URL: http://svn.apache.org/viewvc?rev=428084&view=rev
Log:
Moving UsingAddressing check to Addressing module. More preparation for AXIS2-948
Added:
webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingWSDLValidationHandler.java
Modified:
webservices/axis2/trunk/java/modules/addressing/src/META-INF/module.xml
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/addressing/AddressingServiceTest.java
Modified: webservices/axis2/trunk/java/modules/addressing/src/META-INF/module.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/src/META-INF/module.xml?rev=428084&r1=428083&r2=428084&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/META-INF/module.xml (original)
+++ webservices/axis2/trunk/java/modules/addressing/src/META-INF/module.xml Wed Aug 2 11:35:16 2006
@@ -7,6 +7,9 @@
<handler name="AddressingSubmissionInHandler" class="org.apache.axis2.handlers.addressing.AddressingSubmissionInHandler">
<order phase="PreDispatch"/>
</handler>
+ <handler name="AddressingWSDLValidationHandler" class="org.apache.axis2.handlers.addressing.AddressingWSDLValidationHandler">
+ <order phase="Dispatch" after="InstanceDispatcher" />
+ </handler>
</inflow>
<outflow>
@@ -28,6 +31,9 @@
</handler>
<handler name="AddressingSubmissionInHandler" class="org.apache.axis2.handlers.addressing.AddressingSubmissionInHandler">
<order phase="PreDispatch"/>
+ </handler>
+ <handler name="AddressingWSDLValidationHandler" class="org.apache.axis2.handlers.addressing.AddressingWSDLValidationHandler">
+ <order phase="Dispatch" after="InstanceDispatcher" />
</handler>
</INfaultflow>
</module>
Added: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingWSDLValidationHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingWSDLValidationHandler.java?rev=428084&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingWSDLValidationHandler.java (added)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingWSDLValidationHandler.java Wed Aug 2 11:35:16 2006
@@ -0,0 +1,59 @@
+/*
+* Copyright 2004,2005 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.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.axis2.handlers.addressing;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.AddressingHelper.FinalFaults;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class AddressingWSDLValidationHandler extends AbstractHandler implements AddressingConstants {
+
+ private static final Log log = LogFactory.getLog(AddressingWSDLValidationHandler.class);
+
+ public void invoke(MessageContext msgContext) throws AxisFault {
+ // Check that if wsaddressing=required that addressing headers were found inbound
+ checkUsingAddressing(msgContext);
+ // Check that if anonymous flag is in effect that the replyto and faultto are valid
+ // Not yet implemented
+ // If no AxisOperation has been found at the end of the dispatch phase and addressing
+ // is in use we should throw and ActionNotSupported Fault
+ // Not yet implemented
+ }
+
+ /*
+ * Check that if the wsaddressing="required" attribute exists on the service
+ * definition or <wsaw:UsingAddressing wsdl:required="true" /> was found in the
+ * WSDL that WS-Addressing headers were found on the inbound message
+ */
+ private void checkUsingAddressing(MessageContext msgContext)
+ throws AxisFault {
+ String addressingFlag = msgContext.getAxisService().getWSAddressingFlag();
+ if (log.isTraceEnabled())
+ log.trace("checkUsingAddressing: WSAddressingFlag=" + addressingFlag);
+ if (AddressingConstants.ADDRESSING_REQUIRED.equals(addressingFlag)) {
+ Object flag = msgContext.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
+ if (log.isTraceEnabled())
+ log.trace("checkUsingAddressing: WS_ADDRESSING_VERSION=" + flag);
+ if (flag == null) {
+ FinalFaults.triggerMessageAddressingRequiredFault(msgContext,AddressingConstants.WSA_ACTION);
+ }
+ }
+ }
+}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java?rev=428084&r1=428083&r2=428084&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java Wed Aug 2 11:35:16 2006
@@ -274,6 +274,10 @@
AxisEngine engine = new AxisEngine(cc);
mc.getConfigurationContext().registerOperationContext(mc.getMessageID(), oc);
engine.send(mc);
+
+ // Options object reused so soapAction needs to be removed so
+ // that soapAction+wsa:Action on response don't conflict
+ options.setAction("");
} else {
if (block) {
// Send the SOAP Message and receive a response
@@ -354,6 +358,10 @@
responseMessageContext.setTransportIn(msgctx.getTransportIn());
responseMessageContext.setTransportOut(msgctx.getTransportOut());
+ // Options object reused above so soapAction needs to be removed so
+ // that soapAction+wsa:Action on response don't conflict
+ responseMessageContext.setSoapAction("");
+
if (responseMessageContext.getEnvelope() == null) {
// If request is REST we assume the responseMessageContext is REST, so
// set the variable
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java?rev=428084&r1=428083&r2=428084&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java Wed Aug 2 11:35:16 2006
@@ -17,6 +17,14 @@
package org.apache.axis2.engine;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMNamespace;
@@ -35,9 +43,9 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.AddressingConstants.Final;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.addressing.RelatesTo;
+import org.apache.axis2.addressing.AddressingConstants.Final;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.OperationContext;
@@ -51,14 +59,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import javax.xml.namespace.QName;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Map;
-
/**
* There is one engine for the Server and the Client. the send() and receive()
* Methods are the basic operations the Sync, Async messageing are build on top.
@@ -135,30 +135,6 @@
}
}
- /*
- * Check that if the wsaddressing="required" attribute exists on the service
- * definition or <wsaw:UsingAddressing wsdl:required="true" /> was found in the
- * WSDL that WS-Addressing headers were found on the inbound message
- */
- private void checkUsingAddressing(MessageContext msgContext)
- throws AxisFault {
- String addressingFlag = msgContext.getAxisService().getWSAddressingFlag();
- if (log.isTraceEnabled())
- log.trace("checkUsingAddressing: WSAddressingFlag=" + addressingFlag);
- if (AddressingConstants.ADDRESSING_REQUIRED.equals(addressingFlag)) {
- Object flag = msgContext.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
- if (log.isTraceEnabled())
- log.trace("checkUsingAddressing: WS_ADDRESSING_VERSION=" + flag);
- if (flag == null) {
- String message = Messages.getMessage("wsaddressingrequirednotpresent");
- AxisFault af = new AxisFault(message);
- af.printStackTrace();
- log.debug(message, af);
- throw af;
- }
- }
- }
-
/**
* This method is called to handle any error that occurs at inflow or outflow. But if the
* method is called twice, it implies that sending the error handling has failed, in which case
@@ -511,8 +487,6 @@
// invoke the Message Receivers
checkMustUnderstand(msgContext);
- checkUsingAddressing(msgContext);
-
MessageReceiver receiver = msgContext.getAxisOperation().getMessageReceiver();
receiver.receive(msgContext);
@@ -606,8 +580,6 @@
// invoke the Message Receivers
checkMustUnderstand(msgContext);
-
- checkUsingAddressing(msgContext);
MessageReceiver receiver = msgContext.getAxisOperation().getMessageReceiver();
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/addressing/AddressingServiceTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/addressing/AddressingServiceTest.java?rev=428084&r1=428083&r2=428084&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/addressing/AddressingServiceTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/addressing/AddressingServiceTest.java Wed Aug 2 11:35:16 2006
@@ -229,7 +229,7 @@
fail("Should have received a specific fault");
}catch(AxisFault af){
af.printStackTrace();
- assertEquals("WS-Addressing required but not found.", af.getMessage());
+ assertEquals(Final.FAULT_ADDRESSING_HEADER_REQUIRED_REASON, af.getMessage());
}
}finally {
if (sender != null)
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org