Autor Beitrag
DerNetteNachbar
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 224



BeitragVerfasst: Do 15.10.09 14:13 
Hey Leute wie es oben schon steht wer kann mir eine kleine Passage aus einem Client von C# ins Delphi übersetzen:
ausblenden volle Höhe C#-Quelltext
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:
namespace Test
{
    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;
        }

MfG

Nachbar

Vielen Dank für euere Hilfe schon mal im Vorraus.
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Do 15.10.09 14:37 
Hast du einen konkreten Ersatz für WebRequest und WebResponse in Delphi?

lg elundril

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
DerNetteNachbar Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 224



BeitragVerfasst: Do 15.10.09 14:56 
Genau das ist der Knackpunkt bei mir. Es gibt in Delphi eine gleichnamige Komponente, die aber nicht dieselben Methoden hat und auch höchstwahrscheinlich einen anderen Schwerpunkt. Ausserdem wäre da noch diese Zeile:
ausblenden C#-Quelltext
1:
 byte[] data = Encoding.ASCII.GetBytes(XMLRequest);					

Eine Konvertierung der Nachricht die man sendet in den ASCII Code. Eine Vermutung wäre, der Browser liesst nur ASCII Zeichen.

lg

Nachbar
DerNetteNachbar Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 224



BeitragVerfasst: Mo 19.10.09 09:44 
PUSH