Generic XML Node to Class
Hello, I need to interface with WSUS (using dotnet 8) using ApiRemoting (SOAP), in some functions, it returns a List<Object> (it's intended afaik in the WSDL file).
Is there a way to deserialize the generic type to a specific one without resorting to manual casting and enumerating one by one the list ? (with reflection for exemple)
exemple from the wsdl : https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-wsusar/c162f3b0-61bb-4134-815c-f089962f2e30
Thanks in advance ! 🙂
[MS-WSUSAR]: Search for a Client Computer
This example demonstrates how to search for a client computer named WSUSAR-CL1.example.com by using the ExecuteSPSearchComputers (section
5 Replies
if you have a wsdl you can directly generate a client with visual studio
It's already generated using dotnet-svcutil, but still doesn't help the
GenericReadableRow
(which in the end is a List<Object>
) which I need to manually unmarshall sadlyso it's a useless wsdl 😐
how many types do you have to deserialize
around 10
found a way :
I have still a GenericReadableRow, but I can cast it dynamicaly using attributes to make it "generic"
i would move the logic into a mapper class or inside a static Create method of the type itself so that there is more error checking and explicitness