I have an e-commerce site and need to communicate with another system, then that system asked me to develop a system which will be receiving an xml file means they will be sending an xml file in this format :
Request sent from CompanyA to CompanyB(This is my e-commerce website)
="1.0"
<!DOCTYPE COMMAND PUBLIC "-//Ocam//DTD XML Command 1.0//EN" "xml/command.dtd">
<COMMAND>
<TYPE>PAYMENT</TYPE>
<COMPANYNAME>Luku</COMPANYNAME>
<CUSTOMERREFERENCEID>refernceNumber</CUSTOMERREFERENCEID>
<MSISDN>msisdn</MSISDN>
<AMOUNT></AMOUNT>
<TXNID></TXNID>
<STATUS></STATUS>
</COMMAND>
and my system will parse that xml file and load it then reply to the system like this:
synchronous response sent from CompanyB back to CompanyA
="1.0"
<!DOCTYPE COMMAND PUBLIC "-//Ocam//DTD XML Command 1.0//EN" "xml/command.dtd">
<COMMAND>
<TYPE>GBPHANDLER</TYPE>
<TXNID>BP120522.1117.C00001</TXNID>
<REFID>1357</REFID>
<RESULT>TS</RESULT>
<ERRORCODE>ERR123</ERRORCODE>
<FLAG>Y</FLAG>
<CONTENT>Content For Sending SMS</CONTENT>
<MSISDN>09899847486</MSISDN>
<COMPANYCODE>Luku</COMPANYCODE>
</COMMAND>
and for that I have using the following code as shown in the code below:
[WebMethod]
public string COMMAND(string xml)
{
#region Load received xml and parse the values
XmlDocument xdoc = new XmlDocument();
xdoc.LoadXml(xml + Environment.NewLine);
string TYPE = xdoc["COMMAND"].ChildNodes[0].InnerText;
string COMPANYNAME = xdoc["COMMAND"].ChildNodes[1].InnerText;
string CUSTOMERREFERENCEID = xdoc["COMMAND"].ChildNodes[2].InnerText;
string MSISDN = xdoc["COMMAND"].ChildNodes[3].InnerText;
string AMOUNT = xdoc["COMMAND"].ChildNodes[4].InnerText;
string TXNID = xdoc["COMMAND"].ChildNodes[5].InnerText;
string STATUS = xdoc["COMMAND"].ChildNodes[6].InnerText;
#endregion
string ERRORCODE = string.Empty;
string RESULT = string.Empty;
string FLAG = string.Empty;
string CONTENT = string.Empty;
StringBuilder sb = new StringBuilder();
DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.GetConnection(), "[GetCheckoutInfoTest]", CUSTOMERREFERENCEID,AMOUNT);
if (ds.Tables[0].Rows.Count > 0)
{
RESULT = "TS";
}
else
{
RESULT = "TF";
}
#region write the response xml
XmlWriter writer = XmlWriter.Create(sb);
writer.WriteStartDocument();
writer.WriteStartElement("COMMAND");
writer.WriteStartElement("TYPE");
writer.WriteValue(TYPE);
writer.WriteEndElement();
writer.WriteStartElement("TXNID");
writer.WriteValue(TXNID);
writer.WriteEndElement();
writer.WriteStartElement("REFID");
writer.WriteValue(CUSTOMERREFERENCEID);
writer.WriteEndElement();
writer.WriteStartElement("ERRORCODE");
writer.WriteValue(ERRORCODE);
writer.WriteEndElement();
writer.WriteStartElement("FLAG");
writer.WriteValue(FLAG);
writer.WriteEndElement();
writer.WriteStartElement("MSISDN");
writer.WriteValue(MSISDN);
writer.WriteEndElement();
writer.WriteStartElement("CONTENT");
writer.WriteValue(CONTENT);
writer.WriteEndElement();
writer.WriteStartElement("COMPANYCODE");
writer.WriteValue(COMPANYNAME);
writer.WriteEndElement();
writer.WriteStartElement("AMOUNT");
writer.WriteValue(AMOUNT);
writer.WriteEndElement();
writer.WriteEndElement();
writer.WriteEndDocument();
writer.Flush();
#endregion
return sb.ToString();
}
Now I can test it by passing an xml file to the parameter on my webservice link and it is responding,but the problem is the system is not able to receive the response of my system when sending the xml file.
Now my question is how to test the incoming xml inorder to see if I can get the incoming xml file.Please help on that because I do not understand what is the problem.Thanks!