You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by ap...@wnuko.demon.co.uk on 2002/05/29 19:58:29 UTC

[PATCH] wire tapping in SOAP 2.3

Hello again,

I hope I will not offend anyone by repeating myself.

Take 2 of my patch has been created against CVS version of these files.

This change can be seen as change in API. Is voting required?

Kind Regards,
-- 
[newbie]Arek Wnukowski



--- 1.26/HTTPUtils.java	Thu May 23 18:20:22 2002
+++ patch/HTTPUtils.java	Tue May 28 12:00:16 2002
@@ -218,6 +218,38 @@
                                       int outputBufferSize,
 				      Boolean tcpNoDelay)
       throws IllegalArgumentException, IOException, SOAPException {
+          
+    return post(url, request, timeout, httpProxyHost, httpProxyPort,
+                 outputBufferSize, tcpNoDelay, null, null);
+  }
+
+  /**
+   * POST something to the given URL. The headers are put in as
+   * HTTP headers, the content length is calculated and the content
+   * byte array is sent as the POST content.
+   *
+   * @param url the url to post to
+   * @param request the message
+   * @param timeout the amount of time, in ms, to block on reading data
+   * @param httpProxyHost the HTTP proxy host or null if no proxy
+   * @param httpProxyPort the HTTP proxy port, if the proxy host is not null
+   * @param outputBufferSize the size of the output buffer on the HTTP stream
+   * @param tcpNoDelay the tcpNoDelay setting for the socket
+   * @param requestCopy the buffer for capturing copy of the request or null
+   *                    if capture is not required.
+   * @param responseCopy the buffer for capturing copy of the response or null
+   *                     if capture is not required.
+   * @param  the tcpNoDelay setting for the socket
+   * @return the response message
+   */
+  public static TransportMessage post(URL url, TransportMessage request,
+                                      int timeout,
+                                      String httpProxyHost, int httpProxyPort,
+                                      int outputBufferSize,
+				      Boolean tcpNoDelay,
+                                      StringBuffer requestCopy,
+                                      StringBuffer responseCopy)
+      throws IllegalArgumentException, IOException, SOAPException {
       /* Open the connection */
       OutputStream outStream = null;
       InputStream inStream = null;
@@ -276,6 +308,13 @@
       bOutStream.write(
           headerbuf.toString().getBytes(Constants.HEADERVAL_DEFAULT_CHARSET));
       request.writeTo(bOutStream);
+      
+      /* If required, capture a copy of the request. */
+      if (requestCopy != null) {
+        requestCopy.append(headerbuf)
+            .append(new String(request.getBytes()));
+      }
+      
       //bOutStream.write('\r'); bOutStream.write('\n');
       //bOutStream.write('\r'); bOutStream.write('\n');
       bOutStream.flush();
@@ -316,6 +355,7 @@
       ByteArrayDataSource ds = new ByteArrayDataSource(bInStream,
                           Constants.HEADERVAL_DEFAULT_CHARSET);
 
+
       /* Extract the headers, content type and content length. */
       byte[] bytes = ds.toByteArray();
       Hashtable respHeaders = new Hashtable();
@@ -369,6 +409,11 @@
       if (respContentLength < 0)
           respContentLength = ds.getSize() - offset - 1;
 
+      /* If required, capture a copy of the response. */
+      if (responseCopy != null) {
+        responseCopy.append(line).append("\r\n").append(new String(bytes));
+      }
+      
       /* Construct the response object. */
       SOAPContext ctx;
       TransportMessage response;
--- 1.21/SOAPHTTPConnection.java	Thu May 23 18:20:22 2002
+++ patch/SOAPHTTPConnection.java	Tue May 28 12:03:24 2002
@@ -99,6 +99,8 @@
   private String cookieHeader2;
   private int    outputBufferSize = HTTPUtils.DEFAULT_OUTPUT_BUFFER_SIZE;
   private Boolean tcpNoDelay = null;
+  private StringBuffer requestCopy = null;
+  private StringBuffer responseCopy = null;
 
   /**
    * Set HTTP proxy host.
@@ -164,6 +166,40 @@
     this.proxyPassword = password;
   }
 
+  /**
+   * Set buffer for capturing copy of the request.
+   */
+  public void setRequestCopy (StringBuffer requestCopy) {
+    this.requestCopy = requestCopy;
+  }
+  
+  /**
+   * Set buffer for capturing copy of the response.
+   */
+  public void setResponseCopy (StringBuffer responseCopy) {
+    this.responseCopy = responseCopy;
+  }
+
+  /**
+   * Get Buffer containing copy of the request.
+   *
+   * @return the Buffer containing copy of the request.
+   *         Returns null if buffer has not been previously set.
+   */
+  public StringBuffer getRequestCopy () {
+    return requestCopy;
+  }
+
+  /**
+   * Get Buffer containing copy of the response.
+   *
+   * @return the Buffer containing copy of the response.
+   *         Returns null if buffer has not been previously set.
+   */
+  public StringBuffer getResponseCopy () {
+    return responseCopy;
+  }
+  
   private static String encodeAuth(String userName, String password)
     throws SOAPException
   {
@@ -306,9 +342,11 @@
       {
         TransportMessage msg = new TransportMessage(payload, ctx, headers);
         msg.save();
+        
         response = HTTPUtils.post (sendTo, msg,
                                    timeout, httpProxyHost, httpProxyPort,
-                                   outputBufferSize, tcpNoDelay);
+                                   outputBufferSize, tcpNoDelay,
+                                   requestCopy, responseCopy);
       } catch (MessagingException me) {
         throw new IOException ("Failed to encode mime multipart: " + me);
       } catch (UnsupportedEncodingException uee) {



Re: [PATCH] wire tapping in SOAP 2.3

Posted by "William A. Nagy" <na...@watson.ibm.com>.
Hi Arek,

Thanks for your patch.  Right now we're trying to finish up the 2.3
release, and are not currently adding new functionality until it's
done.  We will look at your patch after the release and commit it to
the CVS tree if everything looks OK.

-Bill

>Hello again,
>
>I hope I will not offend anyone by repeating myself.
>
>Take 2 of my patch has been created against CVS version of these files.
>
>This change can be seen as change in API. Is voting required?
>
>Kind Regards,
>-- 
>[newbie]Arek Wnukowski

<diff removed>



Re: [PATCH] wire tapping in SOAP 2.3

Posted by "William A. Nagy" <na...@watson.ibm.com>.
Hi Arek,

Thanks for your patch.  Right now we're trying to finish up the 2.3
release, and are not currently adding new functionality until it's
done.  We will look at your patch after the release and commit it to
the CVS tree if everything looks OK.

-Bill

>Hello again,
>
>I hope I will not offend anyone by repeating myself.
>
>Take 2 of my patch has been created against CVS version of these files.
>
>This change can be seen as change in API. Is voting required?
>
>Kind Regards,
>-- 
>[newbie]Arek Wnukowski

<diff removed>



Comparision Study between Websphere /Tomcat for WebServices

Posted by Mallikarjun <ma...@wipro.com>.
Hi

Can any body give me the comparison matrix between Web Sphere/Tomcat
with respect web Service deployment & Development  which might help us
in choosing the best product for development ..

Regards
Malli



Comparision Study between Websphere /Tomcat for WebServices

Posted by Mallikarjun <ma...@wipro.com>.
Hi

Can any body give me the comparison matrix between Web Sphere/Tomcat
with respect web Service deployment & Development  which might help us
in choosing the best product for development ..

Regards
Malli