steeltomato / jmeter-amf

AMF Plugin for JMeter
http://code.kennethjhill.com/jmeter-amf
Apache License 2.0
37 stars 37 forks source link

AMF requests fail when using the proxy #18

Open stewsnooze opened 13 years ago

stewsnooze commented 13 years ago

I have tried the latest release and I've just compiled trunk after seeing fixes go in yesterday. Essentially if I use a HTTP Proxy within Jmeter 2.5.1 the AMF requests actually make it to the server and get completed fine even though I can't replay them.

Using the AMFProxy the requests fail the first time whilst I am recording. They do get added to the Recording controller but the flash movie reports failures.

What can I provide to help debug this?

steeltomato commented 13 years ago

The AMF proxy transforms the data to XML then back to AMF before sending it to the client. Most likely, something is missing or incorrect when the recreated AMF data is sent off.

From the captured XML, are you able to tell if anything is missing? If so, please provide the XML and detail what is missing.

If you are not well versed in the Flex messaging data structure, you may want to use something like Charles to monitor the normal conversation and compare against.

alexmreis commented 12 years ago

I have the same problem. When recording via the AMF Proxy, I get an error on my client saying that a Object cannot be converted to IMessage

ptoner commented 12 years ago

I have the same problem.

If I "Edit XML" in the AMF XML editor for the request in Jmeter, the message looks like:

`

3 null /1

`

It seems like the entire message is missing. The request also never reaches the target server.

steeltomato commented 12 years ago

Would any of you happen to be using this on applications that are publicly accessible? I would like to try to see what is going on but need a test subject.

ptoner commented 12 years ago

No, unfortunately not.

Could it have something to do with the version of BlazeDS I'm using? I notice that my app uses (I copied the same ones to jmeter/lib/ext):

blazeds-core-3.2.0.3978.jar blazeds-common-3.2.0.3978.jar

...which are far from the most recent.

stewsnooze commented 12 years ago

Feel free to record some of the AMF requests that Toonix.com makes. That is the application I have been testing with this plugin.

ptoner commented 12 years ago

Yep, I get the same error with that app. Specifically that one returns the following in the browser:

TypeError: Error #1034: Type Coercion failed: cannot convert Object@bddcb39 to Array.
    at com.cartoonnetwork.mytnx.common.vo.map::World()[D:\Projects\CN\myToonix\work\src\com\cartoonnetwork\mytnx\common\vo\map\World.as:21]
    at com.cartoonnetwork.mytnx.appshell.controller.webservice::WorldGetMapCommand/result()[D:\Projects\CN\myToonix\work\src\com\cartoonnetwork\mytnx\appshell\controller\webservice\WorldGetMapCommand.as:41]
    at com.cartoonnetwork.mytnx.appshell.model.business::WebServiceDelegate/onResult()[D:\Projects\CN\myToonix\work\src\com\cartoonnetwork\mytnx\appshell\model\business\WebServiceDelegate.as:186]

In Jmeter, the AMF requests to "/services/amfphp" have the following in the XML editor.

<ActionMessage>
  <version>3</version>
  <headers/>
  <bodies>
    <MessageBody>
      <targetURI>system.connect</targetURI>
      <responseURI>/1</responseURI>
      <data class="object-array"/>
    </MessageBody>
  </bodies>
</ActionMessage>

and then

<ActionMessage>
  <version>3</version>
  <headers/>
  <bodies>
    <MessageBody>
      <targetURI>txConfig.get</targetURI>
      <responseURI>/2</responseURI>
      <data class="object-array">
        <string>f59a704d98d1bdad0ec30d2be2f9023ba22a2c0c3932a6e74cfe8b10e3d21c8d</string>
        <string>www.toonix.com</string>
        <string>1326837410</string>
        <string>MEutbgZRRM</string>
        <string>54261dc241d2c98cac3e12dbccd50285</string>
      </data>
    </MessageBody>
    <MessageBody>
      <targetURI>txAvatarPart.get</targetURI>
      <responseURI>/3</responseURI>
      <data class="object-array">
        <string>792d910a80cdaf0054ac2ae82a5787373e45661d1242edbc7180cccf06ce3dd9</string>
        <string>www.toonix.com</string>
        <string>1326837410</string>
        <string>cnQEtZ3xGk</string>
        <string>54261dc241d2c98cac3e12dbccd50285</string>
      </data>
    </MessageBody>
    <MessageBody>
      <targetURI>txMessage.getAll</targetURI>
      <responseURI>/4</responseURI>
      <data class="object-array">
        <string>780aa06a7a7e6a819a98c21a400f5e0fe28aad0a0348f7bc4e90eba50e91fd8f</string>
        <string>www.toonix.com</string>
        <string>1326837410</string>
        <string>echXBdjXkb</string>
        <string>54261dc241d2c98cac3e12dbccd50285</string>
      </data>
    </MessageBody>
    <MessageBody>
      <targetURI>txVoucher.getAll</targetURI>
      <responseURI>/5</responseURI>
      <data class="object-array">
        <string>a21e2c24683c57a2693b7be2946473d46d0e6dfa400f57ce399ca56d8da2c7fc</string>
        <string>www.toonix.com</string>
        <string>1326837410</string>
        <string>HSjETFkhn5</string>
        <string>54261dc241d2c98cac3e12dbccd50285</string>
      </data>
    </MessageBody>
    <MessageBody>
      <targetURI>txNotice.getAll</targetURI>
      <responseURI>/6</responseURI>
      <data class="object-array">
        <string>cde4811cfbb241dfde9d144d7d05602673f6b166765ecdc7ec05be25893deab6</string>
        <string>www.toonix.com</string>
        <string>1326837410</string>
        <string>HXuzoEBsmJ</string>
        <string>54261dc241d2c98cac3e12dbccd50285</string>
      </data>
    </MessageBody>
    <MessageBody>
      <targetURI>txWorld.getAll</targetURI>
      <responseURI>/7</responseURI>
      <data class="object-array">
        <string>ba0a5757b9b5dde9c5d67e70e913e96ebee6c740ca23fa4d83b42b1fde1aadda</string>
        <string>www.toonix.com</string>
        <string>1326837410</string>
        <string>VxCUr3Grkz</string>
        <string>54261dc241d2c98cac3e12dbccd50285</string>
      </data>
    </MessageBody>
    <MessageBody>
      <targetURI>txWorld.getMap</targetURI>
      <responseURI>/8</responseURI>
      <data class="object-array">
        <string>07d55fe5426a6ff3ea9cf80c0dcb952d5fa3b091a4f50c919b7e9e0f50a33522</string>
        <string>www.toonix.com</string>
        <string>1326837410</string>
        <string>vYjedexVnb</string>
        <string>54261dc241d2c98cac3e12dbccd50285</string>
      </data>
    </MessageBody>
    <MessageBody>
      <targetURI>txWorld.getMap</targetURI>
      <responseURI>/9</responseURI>
      <data class="object-array">
        <string>ad8cb2f8e08119174d47a99c0217e522f4972902206af171fc8c81f4ae801d3c</string>
        <string>www.toonix.com</string>
        <string>1326837410</string>
        <string>cfws6jRQFg</string>
        <string>54261dc241d2c98cac3e12dbccd50285</string>
      </data>
    </MessageBody>
    <MessageBody>
      <targetURI>txShop.getAll</targetURI>
      <responseURI>/10</responseURI>
      <data class="object-array">
        <string>b2c5551971641c06c77a4671cc498f9be960f09787c41fcb72ac12357d654610</string>
        <string>www.toonix.com</string>
        <string>1326837410</string>
        <string>2uNzPTsvtA</string>
        <string>54261dc241d2c98cac3e12dbccd50285</string>
      </data>
    </MessageBody>
    <MessageBody>
      <targetURI>txPoints.get</targetURI>
      <responseURI>/11</responseURI>
      <data class="object-array">
        <string>82cd0c86b511e583df50e5163baad00fdb7ed48518930a4006d406b548a423c9</string>
        <string>www.toonix.com</string>
        <string>1326837410</string>
        <string>JGGXggT8Hh</string>
        <string>54261dc241d2c98cac3e12dbccd50285</string>
        <string>0</string>
      </data>
    </MessageBody>
  </bodies>
</ActionMessage>
alexmreis commented 12 years ago

I kinda solved the issue by adding all of my remoting classes to the JMeter classpath. I guess it has something to do with serialization / deserialization issues. Even then, the responses don't show appropriately on the Request Tree listener, but other than that it records ok.

steeltomato commented 12 years ago

@alexmreis Could you be more specific about them not showing appropriately vs. what is in the sample?

@stewsnooze Sorry, I didn't get a notification that you had posted this. I will test out that site when I get a chance.

steeltomato commented 12 years ago

@stewsnooze Looks like you are using AmfPHP. Unfortunately, this tool is really geared towards BlazeDS messaging. I suppose I should make that more clear in the requirements. My guess is that some types are not getting translated correctly before being sent to the server. I am a bit curious what these objects are that are being decoded as "object array."

It doesn't help but may notable that your server is actually responding to the proxied requests and sending a pretty good chunk of data. It just ends with an error block "User ID parameter is required."

steeltomato commented 12 years ago

I withdraw that last bit. I checked the site using Charles and see the same error in the response. The data looks pretty much identical, yet the swf initializes.

steeltomato commented 12 years ago

@alexmreis @ptoner I just pushed up v1.3 which has an ASObject fix from jaisingh. It may help if you happen to be sending actual ASObject objects between the server and client.

quincyj commented 12 years ago

Hello,

I added Jmeter-AMF.jar, blazeds-core-3.2.0.3978.jar, blazeds-common-3.2.0.3978.jar, and a jar containg my remoting classes in lib/ext directory.

  1. In jmeter if I add a "server Http Proxy", my AMF request go to the server and I see them in jMeter.
  2. In jMeter if I remove my "server Http Proxy" to replace it by a AMF Proxy Server, I see only the first AMF request which is sent. Answer is never returned to the client. If I edit the XML of the request in jMeter, I see the following :

< ActionMessage> < version>3< /version> < headers/> < bodies> < MessageBody> < targetURI>null< /targetURI> < responseURI>/1</ responseURI> < /MessageBody> < /bodies> < /ActionMessage>

What should I do to see correct AMF request and to expect the plugin to work ?

Thank you very much

steeltomato commented 12 years ago

@quincyj Is the application you are attempting to test publicly available?

quincyj commented 12 years ago

No, it's only developpment for the moment.

dragon3 commented 12 years ago

Hi! I have the same problem.

I use

I see only the first AMF request and response.

<ActionMessage>
  <version>3</version>
  <headers/>
  <bodies>
    <MessageBody>
      <targetURI>null</targetURI>
      <responseURI>/1</responseURI>
    </MessageBody>
  </bodies>
</ActionMessage>

and jmeter.log

2012/03/08 20:05:12 ERROR - jmeter.protocol.amf.util.AmfXmlConverter: An exception was encountered while deserializing response.  flex.messaging.io.UnknownTypeException: Unknown AMF type '-65'.
    at flex.messaging.io.amf.Amf0Input.readObjectValue(Amf0Input.java:214)
    at flex.messaging.io.amf.Amf0Input.readObject(Amf0Input.java:94)
    at flex.messaging.io.amf.AmfMessageDeserializer.readObject(AmfMessageDeserializer.java:227)
    at flex.messaging.io.amf.AmfMessageDeserializer.readBody(AmfMessageDeserializer.java:206)
    at flex.messaging.io.amf.AmfMessageDeserializer.readMessage(AmfMessageDeserializer.java:126)
    at org.apache.jmeter.protocol.amf.util.AmfXmlConverter.convertAmfMessageToXml(AmfXmlConverter.java:168)
    at org.apache.jmeter.protocol.amf.util.AmfXmlConverter.convertAmfMessageToXml(AmfXmlConverter.java:140)
    at org.apache.jmeter.protocol.amf.proxy.AmfRequestHdr.populateSampler(AmfRequestHdr.java:463)
    at org.apache.jmeter.protocol.amf.proxy.AmfRequestHdr.getSampler(AmfRequestHdr.java:281)
    at org.apache.jmeter.protocol.amf.proxy.AmfProxy.run(AmfProxy.java:229)

I have compared network packet dumps. ( I use ngrep )

T XX.XX.XX.XX:63804 -> XX.XX.XX.XX:80 [AP]
POST /messagebroker/amf HTTP/1.1.
host: XXX.XXX.XXX.
Accept: */*.
Accept: */*.
Accept-Charset: Shift_JIS,utf-8;q=0.7,*;q=0.3.
Accept-Encoding: gzip, deflate.
Accept-Encoding: gzip,deflate,sdch.
Accept-Language: ja,en-US;q=0.8,en;q=0.6.
Cache-Control: no-cache.
content-type: application/x-amf.
Cookie: XXXXXX.
Origin: http://XXX.XXX.XXX.
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7.
Content-Length: 21.
Connection: keep-alive.
.
........null../1.....
T XX.XX.XX.XX:16933 -> XX.XX.XX.XX:80 [AP]
POST /messagebroker/amf HTTP/1.1.
host: XXX.XXX.XXX.
Accept: */*.
Accept-Charset: Shift_JIS,utf-8;q=0.7,*;q=0.3.
Accept-Encoding: gzip,deflate,sdch.
Accept-Language: ja,en-US;q=0.8,en;q=0.6.
content-type: application/x-amf.
Cookie: XXXXXX.
Origin: http://XXX.XXX.XXX.
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7.
Content-Length: 244.
Connection: keep-alive.
.
........null../1....
.....
..Mflex.messaging.messages.CommandMessage.operation.correlationId.messageId.clientId.timeToLive.timestamp.headers.destination.body.....XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.....
..%DSMessagingVersion...DSId..nil...
..

Data "..Mflex.messaging.messages.CommandMessage...." not shown with Proxy.

Do you have a workaround?

mnyeste commented 12 years ago

I experience the very same problem, and can be reproducible with a publicly accessible application.

I've downloaded a fresh turnkey bundle from Adobe, started the TraderDesktop application and immediately there is an exception:

2012/05/08 22:45:00 ERROR - jmeter.protocol.amf.util.AmfXmlConverter: An exception was encountered while deserializing response. flex.messaging.io.UnknownTypeException: Unknown AMF type '-65'. at flex.messaging.io.amf.Amf0Input.readObjectValue(Amf0Input.java:214) at flex.messaging.io.amf.Amf0Input.readObject(Amf0Input.java:94) at flex.messaging.io.amf.AmfMessageDeserializer.readObject(AmfMessageDeserializer.java:227) at flex.messaging.io.amf.AmfMessageDeserializer.readBody(AmfMessageDeserializer.java:206) at flex.messaging.io.amf.AmfMessageDeserializer.readMessage(AmfMessageDeserializer.java:126) at org.apache.jmeter.protocol.amf.util.AmfXmlConverter.convertAmfMessageToXml(AmfXmlConverter.java:168) at org.apache.jmeter.protocol.amf.util.AmfXmlConverter.convertAmfMessageToXml(AmfXmlConverter.java:140) at org.apache.jmeter.protocol.amf.proxy.AmfRequestHdr.populateSampler(AmfRequestHdr.java:463) at org.apache.jmeter.protocol.amf.proxy.AmfRequestHdr.getSampler(AmfRequestHdr.java:281) at org.apache.jmeter.protocol.amf.proxy.AmfProxy.run(AmfProxy.java:229)

XML:



  3
  
  
    
      null
      /1
    
  

Environment:

JMeter 2.5.1 JMeter-AMF v1.3 blazeds-core-4.0.0.14931.jar and blazeds-common-4.0.0.14931.jar

steeltomato commented 12 years ago

For the sake of taking notes on this, I also see the following exceptions from the turnkey application polling:

An exception was encountered while deserializing response. flex.messaging.io.SerializationException: Class 'flex.messaging.io.amf.ASObject' must implement java.io.Externalizable to receive client IExternalizable instances.


An exception was encountered while deserializing response. java.lang.IndexOutOfBoundsException: Index: 58, Size: 3 at java.util.ArrayList.rangeCheck(Unknown Source) at java.util.ArrayList.get(Unknown Source) at flex.messaging.io.amf.Amf3Input.getStringReference(Amf3Input.java:718) at flex.messaging.io.amf.Amf3Input.readString(Amf3Input.java:244)

The latter makes me very suspicious that I may be doing something to corrupt the byte input stream.

akartmann commented 12 years ago

Hi, just a quick note to let you know I had the same issue as mnyeste ( Unknown AMF type '-65'), and I solved it by setting file encoding to ISO-8859-1. I just change jmeter launch script and add the -Dfile.encoding=ISO-8859-1 options.

mnyeste commented 12 years ago

Change the encoding works for me as well...

RaphaelMui commented 12 years ago

I got a "Unknown AMF type '-65'" on Linux and "Unknown AMF type '-3'" exception on Windows whatever file.encoding I set.

arunps22 commented 12 years ago

Even I am having the same issue. I am getting this error "TypeError: Error #1034: Type Coercion failed: cannot convert Object@543fa91 to mx.messaging.messages.ErrorMessage." when i try to record my application. when I edit the xml this is what i could see.

3 null /1

My environment jMeter 2.7 JMeter-AMF-v1.4 blazeds-common-3.2.0.3978.jar blazeds-core-3.2.0.3978.jar

mike576 commented 12 years ago

I have the same error: I tried every encoding, nothing works. What to do now?

2012/07/06 07:27:33 ERROR - jmeter.protocol.amf.util.AmfXmlConverter: An exception was encountered while deserializing response. java.lang.IndexOutOfBoundsException: Index: 58, Size: 2 at java.util.ArrayList.RangeCheck(ArrayList.java:547) at java.util.ArrayList.get(ArrayList.java:322) at flex.messaging.io.amf.Amf3Input.getStringReference(Amf3Input.java:770) at flex.messaging.io.amf.Amf3Input.readString(Amf3Input.java:237) at flex.messaging.io.amf.Amf3Input.readTraits(Amf3Input.java:592) at flex.messaging.io.amf.Amf3Input.readScriptObject(Amf3Input.java:408) at flex.messaging.io.amf.Amf3Input.readObjectValue(Amf3Input.java:153) at flex.messaging.io.amf.Amf3Input.readObject(Amf3Input.java:132) at flex.messaging.io.amf.Amf0Input.readObjectValue(Amf0Input.java:135) at flex.messaging.io.amf.Amf0Input.readArrayValue(Amf0Input.java:326) at flex.messaging.io.amf.Amf0Input.readObjectValue(Amf0Input.java:139) at flex.messaging.io.amf.Amf0Input.readObject(Amf0Input.java:95) at flex.messaging.io.amf.AmfMessageDeserializer.readObject(AmfMessageDeserializer.java:226) at flex.messaging.io.amf.AmfMessageDeserializer.readBody(AmfMessageDeserializer.java:205) at flex.messaging.io.amf.AmfMessageDeserializer.readMessage(AmfMessageDeserializer.java:125) at org.apache.jmeter.protocol.amf.util.AmfXmlConverter.convertAmfMessageToXml(AmfXmlConverter.java:168) at org.apache.jmeter.protocol.amf.util.AmfXmlConverter.convertAmfMessageToXml(AmfXmlConverter.java:140) at org.apache.jmeter.protocol.amf.proxy.AmfRequestHdr.populateSampler(AmfRequestHdr.java:463) at org.apache.jmeter.protocol.amf.proxy.AmfRequestHdr.getSampler(AmfRequestHdr.java:281) at org.apache.jmeter.protocol.amf.proxy.AmfProxy.run(AmfProxy.java:224)

The environment: jMeter 2.7 JMeter-AMF-v1.4 blazeds-common-3.2.0.3978.jar blazeds-core-3.2.0.3978.jar

mike576 commented 12 years ago

just for info, I tried with blazeds 4.0 jars also. But I get the same error... :/

winko commented 11 years ago

Works for me with following environment:

JMeter 2.9 JMeter-AMF-v1.4 BlazeDS (3.2.0.3978): flex-messaging-common.jar flex-messaging-core.jar flex-messaging-opt.jar flex-messaging-proxy.jar flex-messaging-remoting.jar Linux Ubuntu machine with java-7 and -Dfile.encoding=ISO-8859-1 as starting JVM argument

Without -Dfile.encoding=ISO-8859-1 it fails with ERROR - jmeter.protocol.amf.util.AmfXmlConverter: An exception was encountered while deserializing response. flex.messaging.io.UnknownTypeException: Unknown AMF type '-65'.