On Wednesday, October 24, 2018 at 7:21:08 AM UTC+2, Anastasiya Ruzhanskaya 
wrote:
>
> Also I notice that there might be such situation: there is a  java list of 
> elements, but instead of writing that this is a list type and it has 0 
> elements, I just have 0.
> Also for guid:  there can stand also only 0 without specifying that this 
> is guid type. I am not sure that it is impossible to determine this type in 
> runtime as previously in the same message I already had guid fields.
>
> For the example that I sent, the last numbers correspond to the following:
>
> 14(TransactionScopeOption)|2(enum, =required)|
> 0(useCinderCommandCallback)| (bool)
> 0(vdsRunningOn, null, guid)| (Guid)
> 0(vdsmTaskIds)| (List)
> 0(first last bool param)|
> 0(second last bool param)| 
>
>
The vdsRunningOn and vdsmTaskIds are 'null'. Specifically, vdsmTaskIds is 
not an empty list, it's 'null'; as in "vdsmTaskIds == null" would be 
'true', and "vdsmTaskIds.isEmpty()" would throw a NullPointerException.
 

>
> вторник, 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|
>>>>> 0|
>>>>> 14|
>>>>> (1)https://engine.localdomain/ovirt-engine/webadmin/|  //URL
>>>>> (2)E8B2AD24442204349EF795039C3B87E5|   // policy name
>>>>> (3)org.ovirt.engine.ui.frontend.gwtservices.GenericApiGWTService| 
>>>>> //service interface
>>>>> (4)runMultipleActions| //name of the method
>>>>> (5)org.ovirt.engine.core.common.action.ActionType/12242454|, // type1
>>>>> (6)java.util.ArrayList/4159755760|, // type2
>>>>> (7)Z| // type3 (bool)
>>>>> (8)org.ovirt.engine.core.common.action.ShutdownVmParameters/1694554255| 
>>>>> // class which contains uuid of the virtual machine
>>>>> (9)org.ovirt.engine.core.compat.Guid/1992968158|
>>>>> (10)java.util.UUID/2940008275| // seems the uuid of the virtual 
>>>>> machine)
>>>>>
>>>>> (11)org.ovirt.engine.core.common.action.ActionParametersBase$EndProcedure/1568822488|
>>>>> (12)java.util.Collections$EmptyMap/4174664486|
>>>>> (13)org.ovirt.engine.core.common.businessentities.VDSStatus/1938301532|
>>>>> (14)org.ovirt.engine.core.compat.TransactionScopeOption/1475850853|
>>>>> (the following is the payload separated and commented in places where 
>>>>> I can understand it)
>>>>> 1|
>>>>> 2|
>>>>> 3|
>>>>> 4|  
>>>>> 4|- 4 method parameters
>>>>> 5|- first type = ActionType
>>>>> 6|- second type = arraylist
>>>>> 7|- third type = boolean
>>>>> 7|- fourth type = boolean
>>>>> 5(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:
>>>>>
>>>>> ArrayList<ActionParametersBase> parameters = new ArrayList<>();
>>>>> parameters.add(new ActionParametersBase());
>>>>> parameters.get(0).setCommandId(Guid.Empty);
>>>>> parameters.add(new ActionParametersBase());
>>>>> frontend.runMultipleAction(ActionType.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/1eG0YocsYYbNAtivkLtcaiEE5IOF5u4LUol8-LL0TIKU/view
>>>>
>>>> The first value after the ArrayList runtime type is its length (see [1] 
>>>> and [2]). 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 [3], as you correctly 
>>>> identified.
>>>> Following would be the ActionParametersBase [4] fields, followed by the 
>>>> last 2 method arguments.
>>>>
>>>> [1] 
>>>> https://github.com/gwtproject/gwt/blob/2.8.2/user/src/com/google/gwt/user/client/rpc/core/java/util/ArrayList_CustomFieldSerializerBase.java
>>>> [2] 
>>>> https://github.com/gwtproject/gwt/blob/2.8.2/user/src/com/google/gwt/user/client/rpc/core/java/util/Collection_CustomFieldSerializerBase.java
>>>> [3] 
>>>> https://github.com/oVirt/ovirt-engine/blob/60b63cf01dd46721afa269f1fbbc16d0ade2257b/frontend/webadmin/modules/gwt-extension/src/main/java/com/google/gwt/user/client/rpc/core/java/util/UUID_CustomFieldSerializer.java
>>>> [4] 
>>>> https://github.com/oVirt/ovirt-engine/blob/60b63cf01dd46721afa269f1fbbc16d0ade2257b/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 google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to