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/12/06 18:09:41 UTC
cvs commit: xml-axis/java/src/org/apache/axis/message BodyBuilder.java
gdaniels 01/12/06 09:09:41
Modified: java/src/org/apache/axis/transport/http
SimpleAxisServer.java
java/src/org/apache/axis/utils resources.properties
java/src/org/apache/axis MessageContext.java AxisFault.java
AxisEngine.java
java/src/org/apache/axis/message BodyBuilder.java
Log:
Better fault behavior - propagate faults up from setTargetService(), since
that might result in creating a service which has errors...
Catch the directly-deployed-service-with-no-provider case in AxisEngine.
Revision Changes Path
1.42 +4 -1 xml-axis/java/src/org/apache/axis/transport/http/SimpleAxisServer.java
Index: SimpleAxisServer.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/SimpleAxisServer.java,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- SimpleAxisServer.java 2001/12/03 22:49:24 1.41
+++ SimpleAxisServer.java 2001/12/06 17:09:39 1.42
@@ -207,7 +207,10 @@
// resetting state between requests:
// msgContext = new MessageContext();
// requestMsg = new Message("", "String");
- msgContext.setTargetService(null);
+ try {
+ msgContext.setTargetService(null);
+ } catch (AxisFault fault) {
+ }
msgContext.setResponseMessage(null);
msgContext.reset();
//msgContext.setProperty("transport", "HTTPTransport");
1.25 +1 -0 xml-axis/java/src/org/apache/axis/utils/resources.properties
Index: resources.properties
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/resources.properties,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- resources.properties 2001/12/06 13:47:31 1.24
+++ resources.properties 2001/12/06 17:09:40 1.25
@@ -316,6 +316,7 @@
noPart00={0} not found as an input part OR an output part!
noPivot00=No pivot handler ''{0}'' found!
+noPivot01=Can't deploy a Service with no provider (pivot)!
# NOTE: in noPort00, do not translate "port"
noPort00=Cannot find port: {0}
1.68 +5 -3 xml-axis/java/src/org/apache/axis/MessageContext.java
Index: MessageContext.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/MessageContext.java,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- MessageContext.java 2001/12/05 00:27:18 1.67
+++ MessageContext.java 2001/12/06 17:09:40 1.68
@@ -358,18 +358,20 @@
*
* @param tServ the name of the target service.
*/
- public void setTargetService(String tServ) {
+ public void setTargetService(String tServ) throws AxisFault {
category.debug("MessageContext: setTargetService(" + tServ+")");
targetService = tServ ;
if (targetService == null)
setServiceHandler(null);
else {
- // Do NOT throw an exception if the service handler is not found,
- // since we may be on the client! -- yow... this is messy. -- RobJ
try {
setServiceHandler(getAxisEngine().getService(tServ));
} catch (AxisFault fault) {
+ // If we're on the client, don't throw this fault...
+ if (!isClient()) {
+ throw fault;
+ }
}
}
}
1.38 +16 -7 xml-axis/java/src/org/apache/axis/AxisFault.java
Index: AxisFault.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/AxisFault.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- AxisFault.java 2001/12/03 22:49:22 1.37
+++ AxisFault.java 2001/12/06 17:09:40 1.38
@@ -180,14 +180,23 @@
// Set the exception message (if any) as the fault string
setFaultString( target.toString() );
- // Set the exception name and stack trace in the details
- // TODO: we should serialize any exception data into detail also
- Element el = XMLUtils.StringToElement(Constants.AXIS_NS,
- "exceptionName",
- target.getClass().getName());
-
if (faultDetails == null) faultDetails = new Vector();
- faultDetails.add(el);
+
+ Element el;
+
+ // If we're derived from AxisFault, then put the exception class
+ // into the "exceptionName" element in the details. This allows
+ // us to get back a correct Java Exception class on the other side
+ // (assuming they have it available).
+
+ if ((target instanceof AxisFault) &&
+ (target.getClass() != AxisFault.class)) {
+ el = XMLUtils.StringToElement(Constants.AXIS_NS,
+ "exceptionName",
+ target.getClass().getName());
+
+ faultDetails.add(el);
+ }
// get the stack trace of the target exception
ByteArrayOutputStream stream = new ByteArrayOutputStream();
1.60 +4 -0 xml-axis/java/src/org/apache/axis/AxisEngine.java
Index: AxisEngine.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/AxisEngine.java,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- AxisEngine.java 2001/12/05 00:27:18 1.59
+++ AxisEngine.java 2001/12/06 17:09:40 1.60
@@ -421,6 +421,10 @@
newService.setCachedService(service);
Handler pivot = service.getPivotHandler();
+ if (pivot == null) {
+ throw new DeploymentException(JavaUtils.getMessage("noPivot01"));
+ }
+
if (pivot instanceof RPCProvider) {
newService.setProviderQName(WSDDConstants.JAVARPC_PROVIDER);
} else if (pivot instanceof MsgProvider) {
1.13 +6 -1 xml-axis/java/src/org/apache/axis/message/BodyBuilder.java
Index: BodyBuilder.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/BodyBuilder.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- BodyBuilder.java 2001/11/15 14:07:39 1.12
+++ BodyBuilder.java 2001/12/06 17:09:41 1.13
@@ -62,6 +62,7 @@
import org.apache.axis.Constants;
import org.apache.axis.MessageContext;
+import org.apache.axis.AxisFault;
import org.apache.axis.encoding.DeserializationContext;
import org.apache.axis.utils.JavaUtils;
import org.apache.log4j.Category;
@@ -116,7 +117,11 @@
category.debug(JavaUtils.getMessage("dispatching00",namespace));
}
- context.getMessageContext().setTargetService(namespace);
+ try {
+ context.getMessageContext().setTargetService(namespace);
+ } catch (AxisFault fault) {
+ throw new SAXException(fault);
+ }
}
/** Now we make a plain SOAPBodyElement IF we either: