1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62:
| using System; using System.Collections.Generic; using System.Text; using System.Net; using System.IO;
namespace PHOENIX { class Program { static string useSalesWeb(String URL, String User, String Password, String XMLRequest) { String retval = String.Empty;
try { WebRequest wreq = WebRequest.Create(URL); wreq.Method = "POST"; wreq.Credentials = new NetworkCredential(User, Password);
byte[] data = Encoding.ASCII.GetBytes(XMLRequest); Stream s = wreq.GetRequestStream(); s.Write(data, 0, data.Length); s.Close();
WebResponse wres = wreq.GetResponse(); StreamReader sr = new StreamReader(wres.GetResponseStream());
retval = sr.ReadToEnd(); } catch (Exception ex) { retval = ex.Message; }
return retval; }
static void Main(string[] args) { String strURL2Interface = "https://salesweb.phoenix-ag.de/wsxmlgermany/articlecatalogue.php"; String strUsername = ""; String strPassword = ""; String strXMLRequest = ""; String strXMLResponse = "";
strXMLRequest = "<articleCatalogueRequest>"; strXMLRequest += "<client branchNumber=\"05\" customerNumber=\"9999005\" />"; strXMLRequest += "<articles insertMasterData=\"yes\">"; strXMLRequest += "<byArticleNumber articleNumber=\"2181193\" requestedQuantity=\"1\" />"; strXMLRequest += "<byArticleNumber articleNumber=\"5438362\" requestedQuantity=\"1\" />"; strXMLRequest += "</articles>"; strXMLRequest += "</articleCatalogueRequest>";
strXMLResponse = useSalesWeb(strURL2Interface, strUsername, strPassword, strXMLRequest);
Console.WriteLine(strXMLResponse); Console.ReadLine(); } } } |