Hi everyone,
first of all: sorry if this post might seem dumb, but I'm new to C# (I know VB, on the other hand )
I have to write an application that can receive XML's and respond to them accordingly.
I'm working on a Windows 2012 Server with IIS 8.5 on it.
I have Googled around a lot (also found topics on this site), but I'm stuck...
Let me explain: the sender of the XML's is an application from one of our providers. When we receive an XML, we need to respond OK to it (to acknowledge reception). after that, we respond with another type of xml, depending on the content of the xml received.
The first step is thus receiving the XML and responding OK to it.
I have created a page (and service). When our provider sends an xml, it seems I can receive it (the xml is stored on my server). However, the response.xml is not sent; our provider gets the well know error system.xml.exception line 1,....-thing. I have looked at my response.xml with a HEX-editor, but there is no BOM in it.
I guess it is my code that is wrong.
Below the aspx.cs-page:
public partial class CaptureXml : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Int32 len = (Int32)this.Request.InputStream.Length;
byte[] myData = new byte[len];
this.Request.InputStream.Position = 0;
this.Request.InputStream.Read(myData, 0, len);

//write the data to the file
DateTime t = DateTime.Now;
//dt = dt.AddDays(14);

string timeStamp = t.Year.ToString() + "_" + t.Month.ToString() + "_" +
t.Day.ToString() + "_" + t.Hour.ToString() + "_" + t.Second.ToString() +
"_" + t.Millisecond.ToString();
string filepath = @"C:\CRDC\" + GetTimeStampString() + "_1.xml";
//create a file steam object to write the data
FileStream fs = new FileStream(filepath, FileMode.Create, FileAccess.Write);

fs.Write(myData, 0, (int)len);
fs.Flush();
fs.Close();

//string respfilepath = @"C:\CRDC\Response.xml";

XmlDocument doc = new XmlDocument();
doc.Load("C:\\CRDC\\Response.xml");
string strResponse = doc.InnerText;

byte[] opStream1 = System.Text.Encoding.ASCII.GetBytes(strResponse.ToCharArray());

this.Response.OutputStream.Write(opStream1, 0, opStream1.Length);


public static string GetTimeStampString()
{
DateTime strReqTimeStamp = DateTime.Now;
string strRetTimeStamp = strReqTimeStamp.Year.ToString() +
" " + strReqTimeStamp.Month.ToString() + " " +
strReqTimeStamp.Day.ToString() + " " + strReqTimeStamp.Hour.ToString() + " " +
strReqTimeStamp.Minute.ToString() + " " + strReqTimeStamp.Second.ToString() +
" " + strReqTimeStamp.Millisecond.ToString();
return strRetTimeStamp;
}
}


content of the response.xml:

<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<npsoapserverresponse>
<version xsi:type="xsd:string">01.00</version>
<datetime xsi:type="xsdateTime">2015-11-18T16:03:00</datetime>
</npsoapserverresponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

or do I also need asmx)file? Or have I to rewrite the whole stuff in wcf??
very unclear to me... sorry