You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by da...@apache.org on 2007/09/02 17:54:23 UTC

svn commit: r572009 - in /webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/soap: SimpleSoapClient.java SoapConnectionHandler.java

Author: danj
Date: Sun Sep  2 08:54:23 2007
New Revision: 572009

URL: http://svn.apache.org/viewvc?rev=572009&view=rev
Log:
Applying patch for MUSE-223 - thanks Oliver!

Added:
    webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/soap/SoapConnectionHandler.java
Modified:
    webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/soap/SimpleSoapClient.java

Modified: webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/soap/SimpleSoapClient.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/soap/SimpleSoapClient.java?rev=572009&r1=572008&r2=572009&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/soap/SimpleSoapClient.java (original)
+++ webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/soap/SimpleSoapClient.java Sun Sep  2 08:54:23 2007
@@ -1,392 +1,416 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.muse.ws.addressing.soap;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.net.HttpURLConnection;
-import java.net.URI;
-import java.net.URL;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import org.apache.muse.util.messages.Messages;
-import org.apache.muse.util.messages.MessagesFactory;
-import org.apache.muse.util.xml.XmlUtils;
-import org.apache.muse.ws.addressing.EndpointReference;
-import org.apache.muse.ws.addressing.MessageHeaders;
-import org.apache.muse.ws.addressing.WsaConstants;
-import org.apache.muse.ws.addressing.soap.SoapClient;
-
-/**
- *
- * SimpleSoapClient is and implementation of {@linkplain SoapClient SoapClient} 
- * that relies on the java.net.HttpURLConnection API to send and receive 
- * SOAP messages. It provides complete WS-Addressing (WS-A) support, so that 
- * all requests are routed with WS-A EPRs and Actions. Messages are sent with 
- * valid reply and fault EPRs so that responses can be redirected if desired.
- *
- * @author Dan Jemiolo (danj)
- *
- */
-
-public class SimpleSoapClient implements SoapClient
-{
-    //
-    // Used to lookup all exception messages
-    //
-    private static Messages _MESSAGES = MessagesFactory.get(SimpleSoapClient.class);
-    
-    private static final Element[] _EMPTY_ARRAY = new Element[0];
-    
-    //
-    // Set to 0...65535 if TCP/SOAP monitor is in use
-    //
-    private int _monitorPort = -1;
-    
-    //
-    // Print all SOAP messages if true - default is false.
-    //
-    private boolean _trace = false;
-    
-    //
-    // The stream used for tracing - the default is stdout
-    //
-    private PrintWriter _traceWriter = new PrintWriter(System.out);
-    
-    /**
-     * 
-     * Creates a valid SOAP message, including WS-A headers that specify 
-     * the destination and operation (action). The WS-A headers include 
-     * proper return/fault information for the recipient to use in response. 
-     * The 'extra headers' are SOAP header elements that do not belong to 
-     * the WS-A namespace.
-     * 
-     * @param source
-     * @param destination
-     * @param action
-     * @param bodyElements
-     * @param extraHeaders
-     * 
-     * @return A valid SOAP message that can be sent to the destination.
-     *
-     */
-    protected Element createMessage(EndpointReference source, 
-                                    EndpointReference destination, 
-                                    String action, 
-                                    Element[] bodyElements, 
-                                    Element[] extraHeaders)
-    {
-        Document doc = XmlUtils.createDocument();
-        Element soapXML = XmlUtils.createElement(doc, SoapConstants.ENVELOPE_QNAME);
-        
-        //
-        // add WS-Addressing headers
-        //
-        MessageHeaders headers = new MessageHeaders(destination, action);
-        
-        //
-        // if there's a source EPR, we can provide a wsa:From
-        //
-        if (source != null)
-            headers.setFromAddress(source);
-
-        Element headersXML = headers.toXML(doc);
-        soapXML.appendChild(headersXML);
-        
-        //
-        // add all of the non-WS-A SOAP headers
-        //
-        for (int n = 0; n < extraHeaders.length; ++n)
-        {
-            if (extraHeaders[n].getNamespaceURI().equals(WsaConstants.NAMESPACE_URI))
-            {
-                Object[] filler = { XmlUtils.getElementQName(extraHeaders[n]), WsaConstants.NAMESPACE_URI };
-                throw new RuntimeException(_MESSAGES.get("DuplicateAddressingHeader", filler));
-            }
-            
-            extraHeaders[n] = (Element)doc.importNode(extraHeaders[n], true);
-            headersXML.appendChild(extraHeaders[n]);
-        }
-        
-        //
-        // copy data into SOAP body
-        //
-        Element bodyXML = XmlUtils.createElement(doc, SoapConstants.BODY_QNAME);
-        soapXML.appendChild(bodyXML);
-        
-        for (int n = 0; n < bodyElements.length; ++n)
-        {
-            bodyElements[n] = (Element)doc.importNode(bodyElements[n], true);
-            bodyXML.appendChild(bodyElements[n]);
-        }
-        
-        return soapXML;
-    }
-    
-    /**
-     * 
-     * @param destination
-     * 
-     * @return The URL of the EPR's wsa:Address. If SOAP monitoring is on, 
-     *         the URL's port is switched to the monitor port.
-     *
-     */
-    protected URL getDestinationURL(EndpointReference destination)
-    {
-        URI uri = destination.getAddress();
-        
-        //
-        // for TCP/SOAP monitoring, copy the URI with the new port. 
-        // we have to make a new object because URI's are immutable.
-        //
-        try
-        {
-            if (isUsingSoapMonitor())
-                uri = new URI(uri.getScheme(), 
-                              uri.getUserInfo(), 
-                              uri.getHost(), 
-                              getSoapMonitorPort(), 
-                              uri.getPath(), 
-                              uri.getQuery(), 
-                              uri.getFragment());
-            
-            return uri.toURL();
-        }
-        
-        catch (Throwable error)
-        {
-            throw new RuntimeException(error.getMessage(), error);
-        }
-    }
-    
-    public int getSoapMonitorPort()
-    {
-        return _monitorPort;
-    }
-    
-    public PrintWriter getTraceWriter()
-    {
-        return _traceWriter;
-    }
-    
-    /**
-     * 
-     * {@inheritDoc}
-     * <br><br>
-     * The default value is 'false'.
-     * 
-     */    
-    public boolean isUsingSoapMonitor()
-    {
-        return _monitorPort >= 0;
-    }
-    
-    /**
-     * 
-     * {@inheritDoc}
-     * <br><br>
-     * The default value is 'false'.
-     * 
-     */
-    public boolean isUsingTrace()
-    {
-        return _trace;
-    }
-    
-    public Element[] send(EndpointReference src, 
-                          EndpointReference dest,
-                          String wsaAction, 
-                          Element[] body)
-    {
-        return send(src, dest, wsaAction, body, _EMPTY_ARRAY);
-    }
-    
-    public Element[] send(EndpointReference src, 
-                          EndpointReference dest,
-                          String wsaAction, 
-                          Element[] body, 
-                          Element[] extraHeaders)
-    {
-        if (dest == null)
-            throw new NullPointerException(_MESSAGES.get("NullDestinationEPR"));
-
-        if (wsaAction == null)
-            throw new NullPointerException(_MESSAGES.get("NullActionURI"));
-
-        if (body == null)
-            body = _EMPTY_ARRAY;
-        
-        if (extraHeaders == null)
-            extraHeaders = _EMPTY_ARRAY;
-        
-        //
-        // create the request message and turn it into bytes
-        //
-        Element soapRequest = createMessage(src, dest, wsaAction, body, extraHeaders);
-        
-        if (isUsingTrace())
-            trace(soapRequest, false);
-        
-        Element soapResponse = null;
-        
-        try
-        {
-        	//
-        	// convert DOM tree to raw bytes (UTF-8 encoding)
-        	//
-        	String soapString = XmlUtils.toString(soapRequest, false, false);
-            byte[] soapBytes = soapString.getBytes(XmlUtils.UTF_8);
-            
-            //
-            // set up the HTTP request - POST of SOAP 1.2 data
-            //
-            URL url = getDestinationURL(dest);
-            HttpURLConnection connection = (HttpURLConnection)url.openConnection();
-            connection.setRequestMethod("POST");
-            connection.setRequestProperty("Content-type", SoapConstants.CONTENT_TYPE_HEADER);
-            connection.setDoOutput(true);
-            connection.connect();
-            
-            //
-            // send the SOAP request...
-            //
-            OutputStream output = connection.getOutputStream();
-            output.write(soapBytes);
-            output.flush();
-            output.close();
-            
-            int responseCode = connection.getResponseCode();
-            InputStream response = null;
-            
-            //
-            // only use getInputStream() if we got HTTP 200 OK
-            //
-            if (responseCode == HttpURLConnection.HTTP_OK)
-                response = connection.getInputStream();
-            
-            else
-                response = connection.getErrorStream();
-
-            //
-            // read in the response and build an XML document from it
-            //
-            Document responseDoc = XmlUtils.createDocument(response);
-            soapResponse = XmlUtils.getFirstElement(responseDoc);
-            
-            response.close();
-            connection.disconnect();
-        }
-        
-        //
-        // handle any other runtime/IO exceptions as best we can
-        //
-        catch (Throwable error)
-        {
-            SoapFault soapFault = new SoapFault(error.getMessage(), error);
-            return new Element[]{ soapFault.toXML() };
-        }
-        
-        if (isUsingTrace())
-            trace(soapResponse, true);
-        
-        //
-        // return the elements inside the SOAP body
-        //
-        Element responseBody = XmlUtils.getElement(soapResponse, SoapConstants.BODY_QNAME);
-        return XmlUtils.getAllElements(responseBody);
-    }
-    
-    public void setTrace(boolean trace)
-    {
-        _trace = trace;
-    }
-    
-    /**
-     * 
-     * {@inheritDoc}
-     * <br><br>
-     * Note that there is a default PrintWriter set at instantiation - it 
-     * wraps the System.out stream.
-     * 
-     */
-    public void setTraceWriter(PrintWriter writer)
-    {
-        if (writer == null)
-            throw new NullPointerException(_MESSAGES.get("NullTraceWriter"));
-        
-        _traceWriter = writer;
-    }
-    
-    public void startSoapMonitor(int monitorPort)
-    {
-        if (monitorPort < 1)
-        {
-            Object[] filler = { new Integer(monitorPort) };
-            throw new RuntimeException(_MESSAGES.get("InvalidPort", filler));
-        }
-        
-        _monitorPort = monitorPort;
-    }
-    
-    public void stopSoapMonitor()
-    {
-        _monitorPort = -1;
-    }
-    
-    /**
-     * 
-     * @param xml
-     *        An XML fragment that will be sent to the trace log.
-     * 
-     * @param incoming
-     *        True if the message was part of an incoming SOAP message. This 
-     *        merely provides some context in the trace log.
-     *
-     */
-    protected void trace(Element xml, boolean incoming)
-    {
-        PrintWriter writer = getTraceWriter();
-        writer.write("[CLIENT TRACE] SOAP envelope contents (");
-        writer.write(incoming ? "incoming" : "outgoing");
-        writer.write("):\n\n");
-        writer.write(XmlUtils.toString(xml, false));
-        writer.write('\n'); 
-        writer.flush();
-    }
-    
-    /**
-     * 
-     * @param message
-     *        The message to print to the trace log.
-     *
-     */
-    protected void trace(String message)
-    {
-        PrintWriter writer = getTraceWriter();
-        writer.write("[CLIENT TRACE] ");
-        writer.write(message);
-        writer.write('\n');
-        writer.flush();
-    }
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.muse.ws.addressing.soap;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URL;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import org.apache.muse.util.messages.Messages;
+import org.apache.muse.util.messages.MessagesFactory;
+import org.apache.muse.util.xml.XmlUtils;
+import org.apache.muse.ws.addressing.EndpointReference;
+import org.apache.muse.ws.addressing.MessageHeaders;
+import org.apache.muse.ws.addressing.WsaConstants;
+import org.apache.muse.ws.addressing.soap.SoapClient;
+
+/**
+ *
+ * SimpleSoapClient is and implementation of {@linkplain SoapClient SoapClient} 
+ * that relies on the java.net.HttpURLConnection API to send and receive 
+ * SOAP messages. It provides complete WS-Addressing (WS-A) support, so that 
+ * all requests are routed with WS-A EPRs and Actions. Messages are sent with 
+ * valid reply and fault EPRs so that responses can be redirected if desired.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class SimpleSoapClient implements SoapClient
+{
+    //
+    // Used to lookup all exception messages
+    //
+    private static Messages _MESSAGES = MessagesFactory.get(SimpleSoapClient.class);
+    
+    private static final Element[] _EMPTY_ARRAY = new Element[0];
+    
+    //
+    // Set to 0...65535 if TCP/SOAP monitor is in use
+    //
+    private int _monitorPort = -1;
+    
+    //
+    // Print all SOAP messages if true - default is false.
+    //
+    private boolean _trace = false;
+    
+    //
+    // The stream used for tracing - the default is stdout
+    //
+    private PrintWriter _traceWriter = new PrintWriter(System.out);
+    
+    //
+    // The connection handler for this client - default is none
+    //
+    private SoapConnectionHandler _connectionHandler = null;
+    
+    /**
+     * 
+     * Creates a valid SOAP message, including WS-A headers that specify 
+     * the destination and operation (action). The WS-A headers include 
+     * proper return/fault information for the recipient to use in response. 
+     * The 'extra headers' are SOAP header elements that do not belong to 
+     * the WS-A namespace.
+     * 
+     * @param source
+     * @param destination
+     * @param action
+     * @param bodyElements
+     * @param extraHeaders
+     * 
+     * @return A valid SOAP message that can be sent to the destination.
+     *
+     */
+    protected Element createMessage(EndpointReference source, 
+                                    EndpointReference destination, 
+                                    String action, 
+                                    Element[] bodyElements, 
+                                    Element[] extraHeaders)
+    {
+        Document doc = XmlUtils.createDocument();
+        Element soapXML = XmlUtils.createElement(doc, SoapConstants.ENVELOPE_QNAME);
+        
+        //
+        // add WS-Addressing headers
+        //
+        MessageHeaders headers = new MessageHeaders(destination, action);
+        
+        //
+        // if there's a source EPR, we can provide a wsa:From
+        //
+        if (source != null)
+            headers.setFromAddress(source);
+
+        Element headersXML = headers.toXML(doc);
+        soapXML.appendChild(headersXML);
+        
+        //
+        // add all of the non-WS-A SOAP headers
+        //
+        for (int n = 0; n < extraHeaders.length; ++n)
+        {
+            if (extraHeaders[n].getNamespaceURI().equals(WsaConstants.NAMESPACE_URI))
+            {
+                Object[] filler = { XmlUtils.getElementQName(extraHeaders[n]), WsaConstants.NAMESPACE_URI };
+                throw new RuntimeException(_MESSAGES.get("DuplicateAddressingHeader", filler));
+            }
+            
+            extraHeaders[n] = (Element)doc.importNode(extraHeaders[n], true);
+            headersXML.appendChild(extraHeaders[n]);
+        }
+        
+        //
+        // copy data into SOAP body
+        //
+        Element bodyXML = XmlUtils.createElement(doc, SoapConstants.BODY_QNAME);
+        soapXML.appendChild(bodyXML);
+        
+        for (int n = 0; n < bodyElements.length; ++n)
+        {
+            bodyElements[n] = (Element)doc.importNode(bodyElements[n], true);
+            bodyXML.appendChild(bodyElements[n]);
+        }
+        
+        return soapXML;
+    }
+    
+    public SoapConnectionHandler getConnectionHandler()
+    {
+    	return _connectionHandler;
+    }
+    
+    /**
+     * 
+     * @param destination
+     * 
+     * @return The URL of the EPR's wsa:Address. If SOAP monitoring is on, 
+     *         the URL's port is switched to the monitor port.
+     *
+     */
+    protected URL getDestinationURL(EndpointReference destination)
+    {
+        URI uri = destination.getAddress();
+        
+        //
+        // for TCP/SOAP monitoring, copy the URI with the new port. 
+        // we have to make a new object because URI's are immutable.
+        //
+        try
+        {
+            if (isUsingSoapMonitor())
+                uri = new URI(uri.getScheme(), 
+                              uri.getUserInfo(), 
+                              uri.getHost(), 
+                              getSoapMonitorPort(), 
+                              uri.getPath(), 
+                              uri.getQuery(), 
+                              uri.getFragment());
+            
+            return uri.toURL();
+        }
+        
+        catch (Throwable error)
+        {
+            throw new RuntimeException(error.getMessage(), error);
+        }
+    }
+    
+    public int getSoapMonitorPort()
+    {
+        return _monitorPort;
+    }
+    
+    public PrintWriter getTraceWriter()
+    {
+        return _traceWriter;
+    }
+    
+    /**
+     * 
+     * {@inheritDoc}
+     * <br><br>
+     * The default value is 'false'.
+     * 
+     */    
+    public boolean isUsingSoapMonitor()
+    {
+        return _monitorPort >= 0;
+    }
+    
+    /**
+     * 
+     * {@inheritDoc}
+     * <br><br>
+     * The default value is 'false'.
+     * 
+     */
+    public boolean isUsingTrace()
+    {
+        return _trace;
+    }
+    
+    public Element[] send(EndpointReference src, 
+                          EndpointReference dest,
+                          String wsaAction, 
+                          Element[] body)
+    {
+        return send(src, dest, wsaAction, body, _EMPTY_ARRAY);
+    }
+    
+    public Element[] send(EndpointReference src, 
+                          EndpointReference dest,
+                          String wsaAction, 
+                          Element[] body, 
+                          Element[] extraHeaders)
+    {
+        if (dest == null)
+            throw new NullPointerException(_MESSAGES.get("NullDestinationEPR"));
+
+        if (wsaAction == null)
+            throw new NullPointerException(_MESSAGES.get("NullActionURI"));
+
+        if (body == null)
+            body = _EMPTY_ARRAY;
+        
+        if (extraHeaders == null)
+            extraHeaders = _EMPTY_ARRAY;
+        
+        //
+        // create the request message and turn it into bytes
+        //
+        Element soapRequest = createMessage(src, dest, wsaAction, body, extraHeaders);
+        
+        if (isUsingTrace())
+            trace(soapRequest, false);
+        
+        Element soapResponse = null;
+        
+        SoapConnectionHandler handler = getConnectionHandler();
+        
+        try
+        {
+        	//
+        	// convert DOM tree to raw bytes (UTF-8 encoding)
+        	//
+        	String soapString = XmlUtils.toString(soapRequest, false, false);
+            byte[] soapBytes = soapString.getBytes(XmlUtils.UTF_8);
+            
+            //
+            // set up the HTTP request - POST of SOAP 1.2 data
+            //
+            URL url = getDestinationURL(dest);
+            HttpURLConnection connection = (HttpURLConnection)url.openConnection();
+            
+            if (handler != null)
+            	handler.beforeSend(connection);
+            
+            connection.setRequestMethod("POST");
+            connection.setRequestProperty("Content-type", SoapConstants.CONTENT_TYPE_HEADER);
+            connection.setDoOutput(true);
+            connection.connect();
+            
+            //
+            // send the SOAP request...
+            //
+            OutputStream output = connection.getOutputStream();
+            output.write(soapBytes);
+            output.flush();
+            output.close();
+            
+            if (handler != null)
+            	handler.afterSend(connection);
+            
+            int responseCode = connection.getResponseCode();
+            InputStream response = null;
+            
+            //
+            // only use getInputStream() if we got HTTP 200 OK
+            //
+            if (responseCode == HttpURLConnection.HTTP_OK)
+                response = connection.getInputStream();
+            
+            else
+                response = connection.getErrorStream();
+
+            //
+            // read in the response and build an XML document from it
+            //
+            Document responseDoc = XmlUtils.createDocument(response);
+            soapResponse = XmlUtils.getFirstElement(responseDoc);
+            
+            response.close();
+            connection.disconnect();
+        }
+        
+        //
+        // handle any other runtime/IO exceptions as best we can
+        //
+        catch (Throwable error)
+        {
+            SoapFault soapFault = new SoapFault(error.getMessage(), error);
+            return new Element[]{ soapFault.toXML() };
+        }
+        
+        if (isUsingTrace())
+            trace(soapResponse, true);
+        
+        //
+        // return the elements inside the SOAP body
+        //
+        Element responseBody = XmlUtils.getElement(soapResponse, SoapConstants.BODY_QNAME);
+        return XmlUtils.getAllElements(responseBody);
+    }
+    
+    public void setConnectionHandler(SoapConnectionHandler connectionHandler) 
+    {
+    	_connectionHandler = connectionHandler;
+    }
+    
+    public void setTrace(boolean trace)
+    {
+        _trace = trace;
+    }
+    
+    /**
+     * 
+     * {@inheritDoc}
+     * <br><br>
+     * Note that there is a default PrintWriter set at instantiation - it 
+     * wraps the System.out stream.
+     * 
+     */
+    public void setTraceWriter(PrintWriter writer)
+    {
+        if (writer == null)
+            throw new NullPointerException(_MESSAGES.get("NullTraceWriter"));
+        
+        _traceWriter = writer;
+    }
+    
+    public void startSoapMonitor(int monitorPort)
+    {
+        if (monitorPort < 1)
+        {
+            Object[] filler = { new Integer(monitorPort) };
+            throw new RuntimeException(_MESSAGES.get("InvalidPort", filler));
+        }
+        
+        _monitorPort = monitorPort;
+    }
+    
+    public void stopSoapMonitor()
+    {
+        _monitorPort = -1;
+    }
+    
+    /**
+     * 
+     * @param xml
+     *        An XML fragment that will be sent to the trace log.
+     * 
+     * @param incoming
+     *        True if the message was part of an incoming SOAP message. This 
+     *        merely provides some context in the trace log.
+     *
+     */
+    protected void trace(Element xml, boolean incoming)
+    {
+        PrintWriter writer = getTraceWriter();
+        writer.write("[CLIENT TRACE] SOAP envelope contents (");
+        writer.write(incoming ? "incoming" : "outgoing");
+        writer.write("):\n\n");
+        writer.write(XmlUtils.toString(xml, false));
+        writer.write('\n'); 
+        writer.flush();
+    }
+    
+    /**
+     * 
+     * @param message
+     *        The message to print to the trace log.
+     *
+     */
+    protected void trace(String message)
+    {
+        PrintWriter writer = getTraceWriter();
+        writer.write("[CLIENT TRACE] ");
+        writer.write(message);
+        writer.write('\n');
+        writer.flush();
+    }
+}

Added: webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/soap/SoapConnectionHandler.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/soap/SoapConnectionHandler.java?rev=572009&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/soap/SoapConnectionHandler.java (added)
+++ webservices/muse/trunk/modules/muse-wsa-soap/src/org/apache/muse/ws/addressing/soap/SoapConnectionHandler.java Sun Sep  2 08:54:23 2007
@@ -0,0 +1,55 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.muse.ws.addressing.soap;
+
+import java.net.URLConnection;
+
+/**
+ * 
+ * 
+ *  The ConnectionHandler allows to manipulate the URL connections used by 
+ *  {@linkplain org.apache.muse.ws.addressing.soap.SimpleSoapClient SoapClient} 
+ *  objects directly before and after a SOAP message is sent. 
+ *   
+ *
+ * @author Oliver Waeldrich
+ *
+ */
+public interface SoapConnectionHandler
+{
+    /**
+     * 
+     * This method is called directly before a SOAP message is sent.
+     * 
+     * @param connection
+     *      
+     */
+    public void beforeSend(URLConnection connection);
+    
+    /**
+     * 
+     * This method is called directly after a SOAP message is sent.
+     * 
+     * @param connection
+     * 
+     */
+    public void afterSend(URLConnection connection);
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org