A null is a null, it has no "runtime type". Whenever you're unserializing a Java object (non primitive, non String) value, you'll have:--
On Wednesday, October 24, 2018 at 6:53:21 AM UTC+2, Anastasiya Ruzhanskaya wrote:
- either a 0, which means 'null' (and then you're done, there's nothing else to learn about a 'null')
- or a positive number, which references the runtime type in the string table. This guides you to how you'll deserialize that value (look for a CustomFieldSerializer, otherwise use the zero-arg constructor then deserialize the object's fields). For example, the declared type (of the method parameter, or of an object's field) could be java.lang.Number, the runtime type will be any of its subclasses: java.lang.Double, java.lang.Long, java.math.BigDecimal, etc. those types will be (de)serialized in different ways.
- or a negative number, referencing an object that has previously been deserialized (so you already know its actual type, etc.)
On Wednesday, October 24, 2018 at 6:53:21 AM UTC+2, Anastasiya Ruzhanskaya wrote:
Yes, -6 was the reference to already serialized values, seems from the previous calls.Also I would like to ask, if there is a zero value in place where I see there should a type description in a payload, this means that we don't know how to decode it in runtime, but there will be some following info, or it is just 0 and we move to the next field in the class? Or this 0 could also mean that this is an uninitialized value?The first field of an object is a number indicating how to decode it. A '0' means null.
вторник, 23 октября 2018 г., 14:50:33 UTC+3 пользователь Thomas Broyer написал:
On Tuesday, October 23, 2018 at 1:16:57 PM UTC+2, Anastasiya Ruzhanskaya wrote:Dear Thomas,thank you a lot for a detailed answer!I saw this documentation, but seems should look more thoroughly into serialization inside GWT.Concerning the numbers 0|5|0|0|0 - after VmOperationParameterBase class where there is a private field vmId we move down to ActionParameterBase class (as you said), so 0 here will correspond to the first parameter inside this class in alphabetical order (seems commanId)? And five - to some value or to a type of parameter? (sometimes it is not clear does the payload mean the type or the value itself). There is a field there - ActionType commandType; which has type 5.From the doc, if the declared type of the value is a primitive type or java.lang.String, then the value is used directly (for strings, 0 means null and all other values are indices in the string table); in all other cases (including "primitive wrapper types" such as java.lang.Boolean or java.lang.Integer), the value will always start with its runtime type (or 0 if it's null).Assuming we're looking at the correct version of the sources, we'll indeed find, in order, commandId as a null Guid, commandType as the first constant of the ActionType enum (type = 5 = ActionType, followed by 0 = ordinal in the enum). The next 2 '0' would be compensationEnabled as a boolean false, and correlationId as a null String, respectively.Next would be endProcedure, as the the second (ordinal = 1) constant of the EndProcedure enum, i.e. PARENT_MANAGED; and so on and so on.The one thing that's not clear in the doc, is how to interpret negative values for objects (in place of the type or 0 for null, to reference an already deserialized object). I suppose that you could put each object into an array, and you'd use the absolute value as a 1-based index in that array.I see a -6 in the payload, but I have no idea at first glance whether it'll be a numeric value or a reference to an already-deserialized object. You have to go through the pipe-delimited fields one by one to know what each one means.
вторник, 23 октября 2018 г., 13:26:06 UTC+3 пользователь Thomas Broyer написал:On Tuesday, October 23, 2018 at 11:46:56 AM UTC+2, Anastasiya Ruzhanskaya wrote:Hello all!I am working with oVirt (which helps to manage virtual machines) project and it uses GWT RPC protocol in it's communications.I want to parse messages in GWT RPC format which I get after deciphering the traffic.I hope that even without being totally familiar with the ovirt project, someone will be able to help me a little bit.I already separated it on some meaningful parts), numbers in braces just help to make correspondence between payload and strings:7|
E8B2AD24442204349EF795039C3B87 E5| // policy name
frontend.gwtservices. GenericApiGWTService| //service interface
(4)runMultipleActions| //name of the method
common.action.ActionType/ 12242454|, // type1
4159755760|, // type2
(7)Z| // type3 (bool)
common.action. ShutdownVmParameters/ 1694554255| // class which contains uuid of the virtual machine
(10)java.util.UUID/2940008275| // seems the uuid of the virtual machine)
common.action. ActionParametersBase$ EndProcedure/1568822488|
compat.TransactionScopeOption/ 1475850853|(the following is the payload separated and commented in places where I can understand it)1|
4|- 4 method parameters
5|- first type = ActionType
6|- second type = arraylist
7|- third type = boolean
7|- fourth type = boolean5(actionType)|9 (shutdown)|6(arrayList)|1(??)|
8 (shutdown vm parameters, list object)|1|0|0|0|(??)
9 (guid, ?)|10(UUID)|J$m4mk9wVi3|
MjeP460Xkpb (vm uuid)|0|5|0|0|0|11|1|0|6|0|0| 0|0|0|0|12|0|-6|13|0|1|0|1|14| 2|0|0|0|0|0|Until virtual machine uuid parameter it is kind of clear what is happening, but I still wonder what do the parameters 1 and 0 mean in places marked as (??). I understand, that there is a method called runMultipleActions and it has four parameters. I found in source examples of calling this method .Then I determine types of these parameters. Then the type of action performed ( I shut down the machine). Then there should be an ArrayList, which contains several objects. I assume that 8(shutdown vm parameters) should follow right after 6 (arraylist), but there a "1" which I can't explain. Also I don't know what for are these four boolean values (1|0|0|0) What do they mean? And how can I cope with the left payload?This is the example of the call from ovirt source code:
>parameters = new ArrayList<>();
ionType.AddLocalStorageDomain, parameters, false, mockMultipleActionCallback,
testState);Thank you in advance for any help!I know this is kind of specific for oVirt but probably there is something more that I should know about parsing the messages ( in the internet I found a couple of articles about this, which helped me to understand the first part of the message).Fwiw, the GWT-RPC wire protocol is documented at https://docs.google.com/
document/d/ 1eG0YocsYYbNAtivkLtcaiEE5IOF5u 4LUol8-LL0TIKU/viewThe first value after the ArrayList runtime type is its length (see  and ). In this case, the list contains only one item.Then, according to the doc, the fields of the ShutdownVmParameters are serialized in alphabetical order, walking up the class hierarchy. So the first boolean would be ShutdownVmParameters# waitBeforeShutdown (boolean true), followed by StopVmParametersBase# stopReason (0 means null), then VmOperationParameterBase# quotaId (again a null), and VmOperationParameterBase# rerun (boolean false).This is then followed by VmOperationParameterBase#vmId, which is a Guid, itself having a single field of type UUID, which is serialized as a pair of longs by a UUID_CustomFieldSerializer , as you correctly identified.Following would be the ActionParametersBase  fields, followed by the last 2 method arguments. https://github.com/ gwtproject/gwt/blob/2.8.2/ user/src/com/google/gwt/user/ client/rpc/core/java/util/ ArrayList_ CustomFieldSerializerBase.java https://github.com/ gwtproject/gwt/blob/2.8.2/ user/src/com/google/gwt/user/ client/rpc/core/java/util/ Collection_ CustomFieldSerializerBase.java https://github.com/oVirt/ ovirt-engine/blob/ 60b63cf01dd46721afa269f1fbbc16 d0ade2257b/frontend/webadmin/ modules/gwt-extension/src/ main/java/com/google/gwt/user/ client/rpc/core/java/util/ UUID_CustomFieldSerializer. java https://github.com/oVirt/ ovirt-engine/blob/ 60b63cf01dd46721afa269f1fbbc16 d0ade2257b/backend/manager/ modules/common/src/main/java/ org/ovirt/engine/core/common/ action/ActionParametersBase. java
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to email@example.com.
To post to this group, send email to firstname.lastname@example.org.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
Post a Comment