jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wilson Fan" <Wilson....@peace.com>
Subject RE: Jmeter proxy problem for binary posts?
Date Mon, 23 Aug 2004 04:00:44 GMT
Hi Joel,

Here is a simple example using applet -> servlet (on tomcat)

Expected result:
-----------------------
>start doPost()
>got this:
>got this1-->Test Object
>got this2-->java.awt.Point[x=3,y=5]
>-end-


But when Jmeter Proxy is used, 
"inputStream.readObject()" in the servlet fails to get the objects
posted from the applet via http

Hope this helps =)

Thanks,

Wilson

---------------------------------------
PostApp.java   (applet)
---------------------------------------


import java.applet.*;
import java.awt.*;  

import java.io.*;
import java.net.*;


public class PostApp extends Applet {

     public void paint(Graphics g) {
             
        ObjectInputStream response = null;
        Object result = null;
        
        try {

            System.out.println("Start");

            URL url = new
URL("http://localhost:8080/servlets-examples/servlet/PostExample");

            URLConnection urlConnection = url.openConnection();
            urlConnection.setDoOutput(true);
            urlConnection.setUseCaches(false);
            urlConnection.setRequestProperty("Content-Type",
                "application/octet-stream");

            ObjectOutputStream request = new ObjectOutputStream(
                new
BufferedOutputStream(urlConnection.getOutputStream()));
            request.writeObject("Test Object");
            request.writeObject(new Point(3,5));
            request.flush();
            request.close();

            
            InputStream is = urlConnection.getInputStream();

            System.out.println("finished");
        } catch (Exception e){
            System.out.println("error");
            e.printStackTrace();
        } finally {
            try {
                if(response != null) {
                    response.close();
                }                
            } catch (Exception ex) {
                // Do nothing
            }           
        }
    }
}



---------------------------------------
PostExample.java   (servlet)
---------------------------------------
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;


public class PostExample extends HttpServlet {

    public void doGet(HttpServletRequest request,
                      HttpServletResponse response)
        throws IOException, ServletException
    {
        PrintWriter out = response.getWriter();

        out.write("Hello: doGet");
        System.out.println("Hello: doGet");

    }

    public void doPost(HttpServletRequest request,
                      HttpServletResponse response)
        throws IOException, ServletException
    {

        System.out.println("start doPost() ");
      
       ObjectInputStream inputStream = new ObjectInputStream(
                new BufferedInputStream(request.getInputStream()));
        
        try {
            System.out.println("got this:");

            System.out.println("got this1-->" +
inputStream.readObject().toString());
            System.out.println("got this2-->" +
inputStream.readObject().toString());

        } catch (Exception ex) {
            System.out.println("error: " + ex);
        } finally {
            try{
                inputStream.close();
            } catch (Exception e1){
                // Do nothing
            }
            System.out.println("-end-");
        }
    }
}





-----Original Message-----
From: joelsherriff [mailto:joelsherriff@comcast.net] 
Sent: Saturday, August 21, 2004 7:08 AM
To: JMeter Users List
Subject: Re: Jmeter proxy problem for binary posts?


Think I can answer my own question...guess it's the diff between a post
of a binary file and versus just the contents of the file. JMeter has no
provision for recording the bits?  Only for posting <input> of
type=file?

Wilson, do you have an applet example I can run standalone that does
this? Something that doesn't require a weblogic server?

J

----- Original Message ----- 
From: "joelsherriff" <joelsherriff@comcast.net>
To: "JMeter Users List" <jmeter-user@jakarta.apache.org>;
<mstover1@apache.org>
Sent: Friday, August 20, 2004 1:25 PM
Subject: Re: Jmeter proxy problem for binary posts?


> Is there something different about the way an applet does a binary 
> post?
I
> have a binary post example here that
> I use to test just this thing...and it works just fine via the proxy 
> and
at
> playback time...but it doesn't use an applet.
>
> J
>
>
> ----- Original Message -----
> From: "Michael Stover" <mstover1@apache.org>
> To: "JMeter Users List" <jmeter-user@jakarta.apache.org>
> Sent: Thursday, August 19, 2004 9:43 PM
> Subject: Re: Jmeter proxy problem for binary posts?
>
>
> > Yeah, JMeter is trying to understand what the browser is sending so 
> > it can correctly record it for the test.  Binary data will not be 
> > comprehended, and JMeter will not be able to deal with it.
> >
> > -Mike
> >
> > On Thu, 2004-08-19 at 19:57, Wilson Fan wrote:
> > > Hi All,
> > >
> > > I have just started trying out the jmeter proxy and have found 
> > > that
when
> > > an applet posts binary data to the server via the proxy, the 
> > > server
will
> > > throw StreamCorruptedExceptions. The binary post data seems to get

> > > transformed (encoded?) when passing through the proxy. (more 
> > > details
> > > below)
> > >
> > > Has anyone encountered this problem before? (if yes) Is there 
> > > anything
I
> > > can do to convert it back to the unencoded format when forwarding 
> > > the data to the server?
> > >
> > > Thanks,
> > >
> > > Wilson Fan
> > >
> >
> ----------------------------------------------------------------------
> --
> > > ------------------------------------------------------------------
> > > --
> > > Example : Browser (with applet) --> Jmeter proxy --> weblogic
server
> >
> ----------------------------------------------------------------------
> --
> > > ------------------------------------------------------------------
> > > --
> > > POST DATA SENT (ascii): Browser (with applet) --> Jmeter proxy
> > >
> > > [3] Source 10.0.2.142 :1342 (SYN:1129164099 ACK:3232237016)
> > >
....sr.-com.peace.energy.transaction.EJBMethodCommand..}{K.!....[..argst
> > > ..[Ljava/lang/Object;L..homeJNDINamet..Ljava/lang/String;L.
> > >
methodNameq.~..xpur..[Ljava.lang.Object;..X..s)l...xp....pt..transaction
> > > .SessionManagert.
> > >
endSessionuq.~......vr.&com.peace.energy.transaction.SessionID.F........
> > > .J..idxpx
> > >
> > > POST DATA SENT (hex): Browser (with applet) --> Jmeter proxy
> > >
> > > [3] Source 10.0.2.142 :1342 (SYN:1129164099 ACK:3232237016)
> > >
ACED00057372002D636F6D2E70656163652E656E657267792E7472616E73616374696F6E
> > >
2E454A424D6574686F64436F6D6D616E649FC87D7B4B8021040300035B00046172677374
> > >
00135B4C6A6176612F6C616E672F4F626A6563743B4C000C686F6D654A4E44494E616D65
> > >
7400124C6A6176612F6C616E672F537472696E673B4C000A6D6574686F644E616D657100
> > >
7E00027870757200135B4C6A6176612E6C616E672E4F626A6563743B90CE589F1073296C
> > >
0200007870000000017074001A7472616E73616374696F6E2E53657373696F6E4D616E61
> > >
67657274000A656E6453657373696F6E7571007E00040000000176720026636F6D2E7065
> > >
6163652E656E657267792E7472616E73616374696F6E2E53657373696F6E4944AA46A30B
> > > FFB6B2910200014A00026964787078
> > >
> >
> ----------------------------------------------------------------------
> --
> > > ------------------------------------------------------------------
> > > --
> > >
> > > POST DATA RECEIVED : Jmeter proxy --> weblogic server
> > >
> > >
%C2%AC%C3%AD%00%05sr%00-com.peace.energy.transaction.EJBMethodCommand%C2
> > >
%9F%C3%88%7D%7BK%C2%80%21%04%03%00%03%5B%00%04argst%00%13%5BLjava%2Flang
> > >
%2FObject%3BL%00%0ChomeJNDINamet%00%12Ljava%2Flang%2FString%3BL%00%0Amet
> > >
hodNameq%00%7E%00%02xpur%00%13%5BLjava.lang.Object%3B%C2%90%C3%8EX%C2%9F
> > >
%10s%29l%02%00%00xp%00%00%00%01pt%00%1Atransaction.SessionManagert%00%0A
> > >
endSessionuq%00%7E%00%04%00%00%00%01vr%00&com.peace.energy.transaction.S
> > > essionID%C2%AAF%C2%A3%0B%C3%BF%C2%B6%C2%B2%C2%91%02%00%01J%00%02id
> > > xpx
> > >
> >
> ----------------------------------------------------------------------
> --
> > > ------------------------------------------------------------------
> > > --
> > >
> > >
> > > ------------------------------------------------------------------
> > > ---
> > > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
jmeter-user-help@jakarta.apache.org
> > --
> > Michael Stover <mstover1@apache.org>
> > Apache Software Foundation
> >
> >
> > --------------------------------------------------------------------
> > -
> > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Mime
View raw message