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 gd...@apache.org on 2001/07/11 18:10:03 UTC
cvs commit: xml-axis/java/src/org/apache/axis/transport/local LocalSender.java
gdaniels 01/07/11 09:10:02
Modified: java/src/org/apache/axis Constants.java
java/src/org/apache/axis/handlers/soap SOAPService.java
java/src/org/apache/axis/message SOAPHeader.java
java/src/org/apache/axis/transport/local LocalSender.java
Log:
* Implement mustUnderstand checking
* Change getMustUnderstand -> isMustUnderstand in SOAPHeader
* Don't propagate AxisFault thrown by the server up to the client when
using the LocalSender. Instead, turn the fault into a Message and
respond with that.
Revision Changes Path
1.25 +24 -0 xml-axis/java/src/org/apache/axis/Constants.java
Index: Constants.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/Constants.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- Constants.java 2001/06/29 13:14:31 1.24
+++ Constants.java 2001/07/11 16:09:41 1.25
@@ -55,6 +55,8 @@
package org.apache.axis;
+import org.apache.axis.utils.QFault;
+
public class Constants {
// Some common Constants that should be used in local handler options
// (Not all implementations will have these concepts - for example
@@ -71,12 +73,31 @@
public static String AXIS_NS = "http://xml.apache.org/axis/";
+
+ //
+ // SOAP 1.1 constants
+ //
public static String URI_SOAP_ENV =
"http://schemas.xmlsoap.org/soap/envelope/" ;
public static String URI_SOAP_ENC =
"http://schemas.xmlsoap.org/soap/encoding/" ;
public static String URI_NEXT_ACTOR =
"http://schemas.xmlsoap.org/soap/actor/next" ;
+
+ //
+ // SOAP 1.2 constants
+ //
+ public static String URI_SOAP12_ENV =
+ "http://www.w3.org/2001/06/soap-envelope";
+ public static String URI_SOAP12_ENC =
+ "http://www.w3.org/2001/06/soap-encoding";
+ public static String URI_SOAP12_NEXT_ACTOR =
+ "http://www.w3.org/2001/06/soap-envelope/actor/next";
+ public static String URI_SOAP12_FAULT_NS =
+ "http://www.w3.org/2001/06/soap-faults";
+ public static String URI_SOAP12_UPGRADE_NS =
+ "http://www.w3.org/2001/06/soap-upgrade";
+
public static String NS_URI_XMLNS =
"http://www.w3.org/2000/xmlns/";
@@ -130,6 +151,9 @@
// Fault Codes
//////////////////////////////////////////////////////////////////////////
public static String FAULT_SERVER_GENERAL = "Server.generalException";
+
+ public static final QFault FAULT_MUSTUNDERSTAND =
+ new QFault(URI_SOAP_ENV, "MustUnderstand");
// Misc Strings
1.14 +22 -0 xml-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java
Index: SOAPService.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- SOAPService.java 2001/07/08 14:18:38 1.13
+++ SOAPService.java 2001/07/11 16:09:47 1.14
@@ -58,6 +58,7 @@
import java.util.Enumeration;
import org.apache.axis.*;
import org.apache.axis.encoding.*;
+import org.apache.axis.message.*;
import org.apache.axis.utils.Debug;
import org.apache.axis.utils.QName;
import org.apache.axis.transport.http.HTTPConstants;
@@ -170,6 +171,27 @@
// Do SOAP semantics here
Debug.Print( 2, "Doing SOAP semantic checks...");
+
+ // 1. Check mustUnderstands
+ SOAPEnvelope env = msgContext.getRequestMessage().getAsSOAPEnvelope();
+ Vector headers = env.getHeaders();
+ Vector misunderstoodHeaders = null;
+ for (int i = 0; i < headers.size(); i++) {
+ SOAPHeader header = (SOAPHeader)headers.elementAt(i);
+ if (header.isMustUnderstand() && !header.isProcessed()) {
+ if (misunderstoodHeaders == null)
+ misunderstoodHeaders = new Vector();
+ misunderstoodHeaders.addElement(header);
+ }
+ }
+
+ if (misunderstoodHeaders != null) {
+ // !!! If SOAP 1.2, insert misunderstood fault header here
+
+ throw new AxisFault(Constants.FAULT_MUSTUNDERSTAND,
+ "Didn't understand MustUnderstand header(s)!",
+ null, null);
+ }
h = getPivotHandler();
if ( h != null ) {
1.18 +1 -1 xml-axis/java/src/org/apache/axis/message/SOAPHeader.java
Index: SOAPHeader.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPHeader.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- SOAPHeader.java 2001/05/30 20:00:07 1.17
+++ SOAPHeader.java 2001/07/11 16:09:53 1.18
@@ -109,7 +109,7 @@
processed = false;
}
- public boolean getMustUnderstand() { return( mustUnderstand ); }
+ public boolean isMustUnderstand() { return( mustUnderstand ); }
public void setMustUnderstand(boolean b) {
mustUnderstand = b ;
}
1.5 +6 -1 xml-axis/java/src/org/apache/axis/transport/local/LocalSender.java
Index: LocalSender.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/local/LocalSender.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- LocalSender.java 2001/07/09 21:31:57 1.4
+++ LocalSender.java 2001/07/11 16:09:58 1.5
@@ -130,7 +130,12 @@
}
// invoke the request
- targetServer.invoke(serverContext);
+ try {
+ targetServer.invoke(serverContext);
+ } catch (AxisFault fault) {
+ Message faultMessage = new Message(fault);
+ serverContext.setResponseMessage(faultMessage);
+ }
// copy back the response, and force its format to String in order to
// exercise the deserializers.