I have published a web service (soap) with WCF, which receives a composite data type MFN_M02CONTENT. I need to generate a log in a plain text file, that I record the received messages.
my problem is that when converting the data of the type MFN_M02CONTENT
to string
, it only saves me the namespace of the data type MiProyecto.HL7.MFN_M02CONTENT
, and not the xml with the tags of the message.
the data type MFN-M02CONTENT
is defined as follows:
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(TypeName = "MFN_M02.CONTENT", Namespace = "urn:hl7-org:v2xml")]
[System.Xml.Serialization.XmlRootAttribute("MFN_M02", Namespace = "urn:hl7-org:v2xml", IsNullable = false)]
public partial class MFN_M02CONTENT
{
private MSHCONTENT mSHField;
private SFTCONTENT[] sFTField;
private MFICONTENT mFIField;
private MFN_M02MF_STAFFCONTENT[] mFN_M02MF_STAFFField;
/// <comentarios/>
[DataMember]
public MSHCONTENT MSH
{
get
{
return this.mSHField;
}
set
{
this.mSHField = value;
}
}
/// <comentarios/>
[System.Xml.Serialization.XmlElementAttribute("SFT")]
[DataMember]
public SFTCONTENT[] SFT
{
get
{
return this.sFTField;
}
set
{
this.sFTField = value;
}
}
/// <comentarios/>
[DataMember]
public MFICONTENT MFI
{
get
{
return this.mFIField;
}
set
{
this.mFIField = value;
}
}
/// <comentarios/>
[System.Xml.Serialization.XmlElementAttribute("MFN_M02.MF_STAFF")]
[DataMember]
public MFN_M02MF_STAFFCONTENT[] MFN_M02MF_STAFF
{
get
{
return this.mFN_M02MF_STAFFField;
}
set
{
this.mFN_M02MF_STAFFField = value;
}
}
}
The subtypes do not put them, because the definition is too long ..
How should I transform this type of XML message so that it remains as text?
Update: I put here the function where I receive the data
public MFK_M01CONTENT Get_MFN_M02(MFN_M02CONTENT MFN_M02_Data)
{
try
{
string Data = MFN_M02_Data.ToString();
// si recibimos el dato, lo grabamos en un archivo de texto plano para ver que me trajo
string Archivo = @"C:\LogXml\MFN_M02CONTENT.txt";
System.IO.StreamWriter file = new System.IO.StreamWriter(Archivo);
file.WriteLine(Data);
file.Close();
}
catch (Exception)
{
}
}