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 ch...@apache.org on 2006/02/10 06:46:09 UTC
svn commit: r376569 - in /webservices/axis2/trunk/java/modules:
addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
common/src/org/apache/axis2/i18n/resource.properties
Author: chinthaka
Date: Thu Feb 9 21:46:09 2006
New Revision: 376569
URL: http://svn.apache.org/viewcvs?rev=376569&view=rev
Log:
Throwing a proper SOAPFault when sgc id is wrong
Modified:
webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties
Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java?rev=376569&r1=376568&r2=376569&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java Thu Feb 9 21:46:09 2006
@@ -24,19 +24,28 @@
import org.apache.axis2.client.Options;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.ServiceGroupContext;
+import org.apache.axis2.i18n.Messages;
+import org.apache.ws.commons.om.OMAbstractFactory;
import org.apache.ws.commons.om.OMAttribute;
import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.soap.SOAP12Constants;
+import org.apache.ws.commons.soap.SOAPFactory;
+import org.apache.ws.commons.soap.SOAPFaultReason;
+import org.apache.ws.commons.soap.SOAPFaultText;
import org.apache.ws.commons.soap.SOAPHeader;
import org.apache.ws.commons.soap.SOAPHeaderBlock;
import javax.xml.namespace.QName;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.Map;
public abstract class AddressingInHandler extends AddressingHandler {
private static final long serialVersionUID = 3907988439637261572L;
+
public void invoke(MessageContext msgContext) throws AxisFault {
SOAPHeader header = msgContext.getEnvelope().getHeader();
@@ -74,6 +83,8 @@
ArrayList addressingHeaders, String addressingNamespace)
throws AddressingException {
+ Map alreadyFoundAddrHeader = new HashMap(7); // its seven, coz frequently used
+
Iterator addressingHeadersIt = addressingHeaders.iterator();
while (addressingHeadersIt.hasNext()) {
SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) addressingHeadersIt.next();
@@ -109,10 +120,21 @@
ServiceGroupContext serviceGroupContext = msgContext.getConfigurationContext().
getServiceGroupContext(groupId, msgContext);
if (serviceGroupContext == null) {
+ handleNoServiceGroupContextIDCase(msgContext);
throw new AxisFault("Invalid Service Group Id." + groupId);
}
msgContext.setServiceGroupContextId(serviceGroupId.getText());
}
+ }
+
+ private void handleNoServiceGroupContextIDCase(MessageContext msgContext) {
+ SOAPFactory soapFac = msgContext.isSOAP11() ? OMAbstractFactory.getSOAP11Factory() : OMAbstractFactory.getSOAP12Factory();
+ SOAPFaultReason soapFaultReason = soapFac.createSOAPFaultReason(null);
+ SOAPFaultText soapFaultText = soapFac.createSOAPFaultText(soapFaultReason);
+ soapFaultText.setLang("en");
+ soapFaultText.setText(Messages.getMessage("serviceGroupIDNotFound"));
+
+ msgContext.setProperty(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME, soapFaultReason);
}
Modified: webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties?rev=376569&r1=376568&r2=376569&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties (original)
+++ webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties Thu Feb 9 21:46:09 2006
@@ -33,7 +33,7 @@
cannotBeNullConfigurationContext=ConfigurationContext can not be null
cannotBeNullOperationContext=OperationContext can not be null
nowhereToSendError=Nowhere to send the error, the return response path is missing and fault to has not been specified
-errorwhileProcessingFault=Error occured while processing fault, previous error is given in the stack trace
+errorwhileProcessingFault=Error occured while processing fault, previous error is given in the stack trace.
unSupportedMEP=Unsupported MEP {0}
mepClientSupportOnly=This MEP client supports only {0} , and Axis operations supplied supports {1}
inputstreamNull=Incoming message input stream is null
@@ -61,6 +61,7 @@
rawXmlProivdeIsLimited=Raw Xml provider supports only the methods bearing the signature public OMElement <method-name>(OMElement) where the method name can be anything
methodNotImplemented=Implementation class does not define a method called
blockInvocationExpectsRes=Blocking invocation always expects a response
+serviceGroupIDNotFound=SOAP session information can not be retrieved from the received correlation id.
# Deployment Errors
wsdlfilenotfound=WSDL file not found for the service : {0}