I am trying to write a translation layer for a test system for which I am writing software. I am using LabVIEW for the test system and that uses a RESTful webservice. I have implemented the REST Methods and they are working OK. The remote Test controller and data service layer etc are written in C# and SQL and these are the items I have to interface with using SOAP. I have a simple webservice client that has been written in C# for the SOAP side by a colleague. I basically need to take the the objects collected by the C# program and then build a small XML that can be sent to the REST URI as post data.
I have done an introduction to C# course but it was a "this is C# based on your text based language" not helpfully when I mainly code in LabVIEW. I have trained with C and a bit of C++ ages ago but really struggled in the course it was a very steep learning curve and not used C# since the course about 3 months ago. I want to learn C# and thought this would be an easy way to start but I am struggling so far.
OK some code:
[WebMethod]
[SoapHeader("RMSSvcHeader", Direction = SoapHeaderDirection.InOut)]
public ReturnStatus Initialise(string uri)
{
ReturnStatus rs = new ReturnStatus();
try
{
rs.Message = HttpPostXml(uri, @"C:\Inetpub\wwwroot\RMS\XMLMessages\Initialise.xml");
}
catch (Exception exc)
{
rs.Status = 1;
rs.Message = exc.Message;
}
return rs;
}
So this current version uses a method to post a set XML file of dummy data to the REST URI as POSTDATA for test purposes. The SOAP data passed to this method exposes a UUID (GUID) and the Method name. This means that from this I have enough info to create the XML for the POSDATA message that need to be sent to the REST service. Something like this:
<?xml version="1.0" encoding="utf-8"?>
<Initialise>
<UUID>d7051980-a690-11dd-ad8b-0800200c9a66</UUID>
</Initialise>
I just need pointing in the right direction as how best to convert the objects to XML for the REST service.
Thanks,
Neil.