cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r454483 - in /cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-impl: src/main/java/org/apache/cocoon/components/language/markup/xsp/SOAPHelper.java status.xml
Date Mon, 09 Oct 2006 20:09:26 GMT
Author: joerg
Date: Mon Oct  9 13:09:25 2006
New Revision: 454483

URL: http://svn.apache.org/viewvc?view=rev&rev=454483
Log:
fixed COCOON-1883: XSP: SOAPHelper does no longer accept only replies with an XML declaration.

Modified:
    cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-impl/src/main/java/org/apache/cocoon/components/language/markup/xsp/SOAPHelper.java
    cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-impl/status.xml

Modified: cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-impl/src/main/java/org/apache/cocoon/components/language/markup/xsp/SOAPHelper.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-impl/src/main/java/org/apache/cocoon/components/language/markup/xsp/SOAPHelper.java?view=diff&rev=454483&r1=454482&r2=454483
==============================================================================
--- cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-impl/src/main/java/org/apache/cocoon/components/language/markup/xsp/SOAPHelper.java
(original)
+++ cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-impl/src/main/java/org/apache/cocoon/components/language/markup/xsp/SOAPHelper.java
Mon Oct  9 13:09:25 2006
@@ -64,12 +64,12 @@
         HttpConnection conn = null;
 
         try {
-            if (action == null || action.equals("")) {
-                action = "\"\"";
+            if (this.action == null || this.action.equals("")) {
+                this.action = "\"\"";
             }
 
-            String host = url.getHost();
-            int port = url.getPort();
+            String host = this.url.getHost();
+            int port = this.url.getPort();
 
             if (System.getProperty("http.proxyHost") != null) {
                 String proxyHost = System.getProperty("http.proxyHost");
@@ -79,17 +79,17 @@
                 conn = new HttpConnection(host, port);
             }
 
-            PostMethod method = new PostMethod(url.getFile());
+            PostMethod method = new PostMethod(this.url.getFile());
             String request;
 
             try {
                 // Write the SOAP request body
-                if (xscriptObject instanceof XScriptObjectInlineXML) {
+                if (this.xscriptObject instanceof XScriptObjectInlineXML) {
                     // Skip overhead
-                    request = ((XScriptObjectInlineXML) xscriptObject).getContent();
+                    request = ((XScriptObjectInlineXML)this.xscriptObject).getContent();
                 } else {
                     StringBuffer bodyBuffer = new StringBuffer();
-                    InputSource saxSource = xscriptObject.getInputSource();
+                    InputSource saxSource = this.xscriptObject.getInputSource();
 
                     Reader r = null;
                     // Byte stream or character stream?
@@ -102,8 +102,9 @@
                     try {
                         char[] buffer = new char[1024];
                         int len;
-                        while ((len = r.read(buffer)) > 0)
+                        while ((len = r.read(buffer)) > 0) {
                             bodyBuffer.append(buffer, 0, len);
+                        }
                     } finally {
                         if (r != null) {
                             r.close();
@@ -119,31 +120,28 @@
 
             method.setRequestHeader(
                     new Header("Content-type", "text/xml; charset=\"utf-8\""));
-            method.setRequestHeader(new Header("SOAPAction", action));
+            method.setRequestHeader(new Header("SOAPAction", this.action));
             method.setRequestBody(request);
 
-            if (authorization != null && !authorization.equals("")) {
-               method.setRequestHeader(new Header("Authorization","Basic "+SourceUtil.encodeBASE64(authorization)));
+            if (this.authorization != null && !this.authorization.equals("")) {
+               method.setRequestHeader(
+                       new Header("Authorization",
+                                  "Basic " + SourceUtil.encodeBASE64(this.authorization)));
             }
 
             method.execute(new HttpState(), conn);
 
             String ret = method.getResponseBodyAsString();
-            int startOfXML = ret.indexOf("<?xml");
-            if (startOfXML == -1) { // No xml?!
-                throw new ProcessingException("Invalid response - no xml");
-            }
-
-            return new XScriptObjectInlineXML(
-                    xscriptManager,
-                    ret.substring(startOfXML));
+            return new XScriptObjectInlineXML(this.xscriptManager, ret);
+        } catch (ProcessingException ex) {
+            throw ex;
         } catch (Exception ex) {
-            throw new ProcessingException("Error invoking remote service: " + ex,
-                    ex);
+            throw new ProcessingException("Error invoking remote service: " + ex, ex);
         } finally {
             try {
-                if (conn != null)
+                if (conn != null) {
                     conn.close();
+                }
             } catch (Exception ex) {
             }
         }

Modified: cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-impl/status.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-impl/status.xml?view=diff&rev=454483&r1=454482&r2=454483
==============================================================================
--- cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-impl/status.xml (original)
+++ cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-impl/status.xml Mon Oct  9 13:09:25 2006
@@ -66,6 +66,9 @@
  <!-- The following list contains the changes since the latest 2.1.x version. -->
  <changes>
   <release version="@version@" date="@date@">
+    <action dev="JH" type="fix" fixes-bug="COCOON-1883" due-to="Fabian Linz" due-to-email="f.linz@gmx.de">
+      SOAPHelper does no longer accept only replies with an XML declaration.
+    </action>
     <action dev="JH" type="fix" fixes-bug="COCOON-1196">
       Use namespace-uri and not the namespace-prefix to select parameters in logicsheet-util.xsl.
     </action>



Mime
View raw message