Hello, We have a problem with our client application, when a SOAP exception occurs, because of server error (like it returns 500 or other error, with HTML instead of XML. When we log the exception to the file, the text is unreadable see below
Unsupported response content type "text/html; charset=ISO-8859-1", must be: "text/xml". Response was: <head><title>Document moved</title></head> To solve this propose having a public static variable , true by default, which allows to disable conversion of message to valid XML text. I expect most clients application will want to do this, while server application most probably often need a conversion. See patch attached. Thanks, Pavel
Index: SOAPException.java =================================================================== RCS file: /home/cvspublic/xml-soap/java/src/org/apache/soap/SOAPException.java,v retrieving revision 1.4 diff -u -r1.4 SOAPException.java --- SOAPException.java 24 Sep 2001 19:45:13 -0000 1.4 +++ SOAPException.java 18 Oct 2002 12:14:22 -0000 @@ -2,7 +2,7 @@ * The Apache Software License, Version 1.1 * * - * Copyright (c) 2000 The Apache Software Foundation. All rights + * Copyright (c) 2000 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -10,7 +10,7 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in @@ -18,7 +18,7 @@ * distribution. * * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: + * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, @@ -26,7 +26,7 @@ * * 4. The names "SOAP" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this - * software without prior written permission. For written + * software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", @@ -64,12 +64,15 @@ * @author Matthew J. Duftler ([EMAIL PROTECTED]) */ public class SOAPException extends Exception { + + public static boolean useCleanString = true; + private String faultCode; private Throwable targetException; public SOAPException (String faultCode, String msg) { - super (Utils.cleanString (msg)); - this.faultCode = Utils.cleanString (faultCode); + super (useCleanString ? Utils.cleanString (msg) : msg ); + this.faultCode = useCleanString ? Utils.cleanString (faultCode) : faultCode; } public SOAPException (String faultCode, String msg, @@ -79,7 +82,7 @@ } public void setFaultCode (String faultCode) { - this.faultCode = Utils.cleanString (faultCode); + this.faultCode = useCleanString ? Utils.cleanString (faultCode) : faultCode; } public String getFaultCode () {
-- To unsubscribe, e-mail: <mailto:soap-dev-unsubscribe@;xml.apache.org> For additional commands, e-mail: <mailto:soap-dev-help@;xml.apache.org>