Question

I have a custom XML RPC library I developed in C# by looking at the mini specification at this website:

http://xmlrpc.scripting.com/spec.html

It doesn't have any explanation of how to serialize a dictionary of scalars to XML. Fortunately for me, till now, my .NET client app written in C# did not need to send a dictionary as a method parameter. But now, it does.

The server I am calling also has a SOAP client for PHP developers. I used that SOAP client to call the said method on the server (the one that needs a dictionary), just to see the XML payload, so I could mimic it.

However, since it is embedded in a SOAP envelope, I assume it will be slightly different from what I would need to send if I was using plain XML RPC and not SOAP.

I want to send a Dictionary<int, int>. And here's what the SOAP envelop contains for the dictionary part.

<item xsi:type="ns2:Map">
  <item>
    <key xsi:type="xsd:int">609</key>
    <value xsi:type="xsd:int">1</value>
   </item>
</item>

So, I am really looking for an XML RPC equivalant of that.

Was it helpful?

Solution 2

I just sent the dictionary as a <struct> according to the definition provided in the link I mentioned in the original post and it worked.

Until before I did that, I was only serializing custom POCO's to <struct>.

OTHER TIPS

How about using DataContractSerializer? It ultimately serializes .NET types (most of them) to SOAP format. It should serialize dictionary in a way that it can be included into SOAP body. http://msdn.microsoft.com/en-us/library/ms752244(v=vs.110).aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top