static void Main(string[] args) { XmlDocument request = new XmlDocument(); // Fix for Xml external entity injection violation in fortify report XmlReaderSettings settings = new XmlReaderSettings(); settings.DtdProcessing = DtdProcessing.Prohibit; settings.XmlResolver = null; XmlReader reader = XmlReader.Create("sample.xml", settings); request.Load(reader); string cybsNamespace = XmlClient.GetRequestNamespace(request); if (cybsNamespace == null) { throw new ApplicationException( "XML document is missing requestMessage"); } try { Console.WriteLine("starting"); XmlDocument reply = XmlClient.RunTransaction(request); SaveOrderState(); ProcessReply(reply, cybsNamespace); } catch (FaultException fe) { //A custom exception created by the Cybersource Client from SaveOrderState(); HandleFaultException(fe, cybsNamespace); } catch (CryptographicException ce) { SaveOrderState(); HandleCryptoException(ce); } catch (WebException we) { SaveOrderState(); HandleWebException(we); } catch (Exception e) { SaveOrderState(); HandleException(e); } Console.WriteLine("Press Return to end..."); Console.ReadLine(); }
static void Main(string[] args) { XmlDocument request = new XmlDocument(); request.Load(args.Length == 1 ? args[0] : "sample.xml"); string cybsNamespace = XmlClient.GetRequestNamespace(request); if (cybsNamespace == null) { throw new ApplicationException( "XML document is missing requestMessage"); } try { Console.WriteLine("starting"); XmlDocument reply = XmlClient.RunTransaction(request); SaveOrderState(); ProcessReply(reply, cybsNamespace); } catch (FaultException fe) { //A custom exception created by the Cybersource Client from SaveOrderState(); HandleFaultException(fe, cybsNamespace); } catch (CryptographicException ce) { SaveOrderState(); HandleCryptoException(ce); } catch (WebException we) { SaveOrderState(); HandleWebException(we); } catch (Exception e) { SaveOrderState(); HandleException(e); } Console.WriteLine("Press Return to end..."); Console.ReadLine(); }