I'm not very experienced with SOAP calls, so I'm struggling to get my requests to format correctly. I am creating an instance of my object (using the .wsdl file that was supplied) then serialize it using the below code. However, the object is not wrapped in a soap envelope tag which is causing my request to error. Does anyone know how I can modify this to wrap my object correctly?
public static string SerializeToXml<T>(T dataToSerialize)
{
if (dataToSerialize == null) return null;
using (StringWriter stringWriter = new StringWriter())
{
XmlSerializer serializer = new XmlSerializer(typeof(T));
serializer.Serialize(stringWriter, dataToSerialize);
return stringWriter.ToString();
}
}