giacomo 2003/06/18 04:18:35
Modified: src/blocks/axis/lib commons-discovery.jar wsdl4j.jar src/blocks/axis/samples sitemap.xmap lib jars.xml . status.xml src/blocks/axis/java/org/apache/cocoon/reading AxisRPCReader.java Added: src/blocks/axis/lib axis-1.1.jar axis-saaj-1.1.jar axis-jaxrpc-1.1.jar Removed: src/blocks/axis/lib axis-1.0.jar axis-saaj-1.0.jar axis-jaxrpc-1.0.jar Log: Upgrade to Axis 1.1 Revision Changes Path 1.2 +175 -129 cocoon-2.1/src/blocks/axis/lib/commons-discovery.jar <<Binary file>> 1.2 +422 -417 cocoon-2.1/src/blocks/axis/lib/wsdl4j.jar <<Binary file>> 1.1 cocoon-2.1/src/blocks/axis/lib/axis-1.1.jar <<Binary file>> 1.1 cocoon-2.1/src/blocks/axis/lib/axis-saaj-1.1.jar <<Binary file>> 1.1 cocoon-2.1/src/blocks/axis/lib/axis-jaxrpc-1.1.jar <<Binary file>> 1.2 +3 -1 cocoon-2.1/src/blocks/axis/samples/sitemap.xmap Index: sitemap.xmap =================================================================== RCS file: /home/cvs/cocoon-2.1/src/blocks/axis/samples/sitemap.xmap,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -b -u -r1.1 -r1.2 --- sitemap.xmap 15 Mar 2003 22:21:55 -0000 1.1 +++ sitemap.xmap 18 Jun 2003 11:18:34 -0000 1.2 @@ -34,7 +34,9 @@ <!-- Match SOAP RPC Router requests --> <map:match pattern="rpcrouter"> - <map:read type="soap-rpc" mime-type="text/xml"/> + <map:read type="soap-rpc" mime-type="text/xml"> + <in-development-stage>false</in-development-stage> + </map:read> </map:match> <!-- Send all non qualified requests to the status page --> 1.49 +4 -4 cocoon-2.1/lib/jars.xml Index: jars.xml =================================================================== RCS file: /home/cvs/cocoon-2.1/lib/jars.xml,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -b -u -r1.48 -r1.49 --- jars.xml 15 Jun 2003 16:15:20 -0000 1.48 +++ jars.xml 18 Jun 2003 11:18:34 -0000 1.49 @@ -709,7 +709,7 @@ <title>???</title> <description>???</description> <used-by>Axis block</used-by> - <lib>axis/lib/axis-saaj-1.0.jar</lib> + <lib>axis/lib/axis-saaj-1.1.jar</lib> <homepage>???</homepage> </file> @@ -733,7 +733,7 @@ <title>???</title> <description>???</description> <used-by>Axis block</used-by> - <lib>axis/lib/axis-jaxrpc-1.0.jar</lib> + <lib>axis/lib/axis-jaxrpc-1.1.jar</lib> <homepage>???</homepage> </file> @@ -741,7 +741,7 @@ <title>???</title> <description>???</description> <used-by>Axis block</used-by> - <lib>axis/lib/axis-1.0.jar</lib> + <lib>axis/lib/axis-1.1.jar</lib> <homepage>???</homepage> </file> 1.58 +4 -0 cocoon-2.1/status.xml Index: status.xml =================================================================== RCS file: /home/cvs/cocoon-2.1/status.xml,v retrieving revision 1.57 retrieving revision 1.58 diff -u -d -b -u -r1.57 -r1.58 --- status.xml 18 Jun 2003 11:06:31 -0000 1.57 +++ status.xml 18 Jun 2003 11:18:35 -0000 1.58 @@ -181,6 +181,10 @@ <changes> <release version="@version@" date="@date@"> + <action dev="GP" type="iupdate"> + Upgraded to new Axis 1.1 release + </action> + <action dev="JH" type="fix" fixes-bug="20658" due-to="Alfred Nathaniel" due-to-email="[EMAIL PROTECTED]"> <action dev="CZ" type="add"> Adding concept of parent-aware components, making e.g. the usage of selectors with a component manager hierarchy much easier. 1.3 +92 -19 cocoon-2.1/src/blocks/axis/java/org/apache/cocoon/reading/AxisRPCReader.java Index: AxisRPCReader.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/blocks/axis/java/org/apache/cocoon/reading/AxisRPCReader.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -b -u -r1.2 -r1.3 --- AxisRPCReader.java 11 Mar 2003 17:44:17 -0000 1.2 +++ AxisRPCReader.java 18 Jun 2003 11:18:35 -0000 1.3 @@ -59,14 +59,19 @@ import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpUtils; import javax.xml.soap.SOAPException; import org.apache.avalon.framework.activity.Disposable; import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.component.ComponentManager; +import org.apache.avalon.framework.configuration.Configurable; +import org.apache.avalon.framework.configuration.Configuration; +import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.avalon.framework.parameters.Parameters; import org.apache.axis.AxisFault; +import org.apache.axis.Constants; import org.apache.axis.Message; import org.apache.axis.MessageContext; import org.apache.axis.soap.SOAPConstants; @@ -79,6 +84,7 @@ import org.apache.cocoon.environment.SourceResolver; import org.apache.cocoon.environment.http.HttpEnvironment; +import org.w3c.dom.Element; import org.xml.sax.SAXException; /** @@ -108,11 +114,22 @@ * @version CVS $Id$ */ public class AxisRPCReader extends ComposerReader - implements Disposable + implements Configurable, Disposable { // soap server reference private SoapServer m_server; + /** Are we in development stage ? */ + private boolean m_isDevelompent = false; + + /* (non-Javadoc) + * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration) + */ + public void configure(Configuration config) throws ConfigurationException + { + m_isDevelompent = config.getChild("development-stage").getValueAsBoolean(m_isDevelompent ); + } + /** * Compose this reader * @@ -229,6 +246,8 @@ // Set the request(incoming) message field in the context msgContext.setRequestMessage(requestMsg); + String url = HttpUtils.getRequestURL(req).toString(); + msgContext.setProperty(MessageContext.TRANS_URL, url); try { @@ -266,34 +285,40 @@ } responseMsg = msgContext.getResponseMessage(); + if (responseMsg == null) { + //tell everyone that something is wrong + throw new Exception("no response message"); } - catch (AxisFault e) + } + catch (AxisFault fault) { if (getLogger().isErrorEnabled()) { - getLogger().error("Axis Fault", e); + getLogger().error("Axis Fault", fault); } - // It's been suggested that a lack of SOAPAction - // should produce some other error code (in the 400s)... - int status = getHttpServletResponseStatus(e); - if (status == HttpServletResponse.SC_UNAUTHORIZED) - { - res.setHeader("WWW-Authenticate","Basic realm=\"AXIS\""); + // log and sanitize + processAxisFault(fault); + configureResponseFromAxisFault(res, fault); + responseMsg = msgContext.getResponseMessage(); + if (responseMsg == null) { + responseMsg = new Message(fault); } - - res.setStatus(status); - responseMsg = new Message(e); } catch (Exception e) { + //other exceptions are internal trouble + responseMsg = msgContext.getResponseMessage(); + res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); if (getLogger().isErrorEnabled()) { getLogger().error("Error during SOAP call", e); } - - res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - responseMsg = new Message(AxisFault.makeFault(e)); + if (responseMsg == null) { + AxisFault fault = AxisFault.makeFault(e); + processAxisFault(fault); + responseMsg = new Message(fault); + } } } catch (AxisFault fault) @@ -302,9 +327,13 @@ { getLogger().error("Axis fault occured while perforing request", fault); } - + processAxisFault(fault); + configureResponseFromAxisFault(res, fault); + responseMsg = msgContext.getResponseMessage(); + if( responseMsg == null) { responseMsg = new Message(fault); } + } catch (Exception e) { throw new ProcessingException("Exception thrown while performing request", e); @@ -325,6 +354,50 @@ { getLogger().debug("AxisRPCReader.generate() complete"); } + } + + /** + * routine called whenever an axis fault is caught; where they + * are logged and any other business. The method may modify the fault + * in the process + * @param fault what went wrong. + */ + protected void processAxisFault(AxisFault fault) { + //log the fault + Element runtimeException = fault.lookupFaultDetail( + Constants.QNAME_FAULTDETAIL_RUNTIMEEXCEPTION); + if (runtimeException != null) { + getLogger().info("AxisFault:", fault); + //strip runtime details + fault.removeFaultDetail(Constants.QNAME_FAULTDETAIL_RUNTIMEEXCEPTION); + } else if (getLogger().isDebugEnabled()) { + getLogger().debug("AxisFault:", fault); + } + //dev systems only give fault dumps + if (m_isDevelompent) { + //strip out the stack trace + fault.removeFaultDetail(Constants.QNAME_FAULTDETAIL_STACKTRACE); + } + } + + /** + * Configure the servlet response status code and maybe other headers + * from the fault info. + * @param response response to configure + * @param fault what went wrong + */ + private void configureResponseFromAxisFault(HttpServletResponse response, + AxisFault fault) { + // then get the status code + // It's been suggested that a lack of SOAPAction + // should produce some other error code (in the 400s)... + int status = getHttpServletResponseStatus(fault); + if (status == HttpServletResponse.SC_UNAUTHORIZED) { + // unauth access results in authentication request + // TODO: less generic realm choice? + response.setHeader("WWW-Authenticate","Basic realm=\"AXIS\""); + } + response.setStatus(status); } /**