Autor Beitrag
espen
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 90
Erhaltene Danke: 1


D6 Prof./D7 Prof. MSSQL, MySQL
BeitragVerfasst: Mi 21.05.03 21:20 
Ich bin ratlos.
Ich möchte per WEBDAV/HTTP ein Fileupload realisieren, welches unter VB6 und XMLHTTP30 keine Probleme macht:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
Private Sub Command1_Click()

   Dim oXML As New XMLHTTP30
   Dim oStream
   Dim vByteStream
   
   Set oStream = CreateObject("ADODB.Stream")
   oStream.Type = 1
   oStream.open
   oStream.LoadFromFile "D:\..\irgeneinedatei.xyz"
   vByteStream = oStream.Read
   oStream.Close
   Set oStream = Nothing

   oXML.open "PUT", "http://abc.de/irgeneinedatei.xyz", False, "aUsername", "aPassword"
   oXML.setRequestHeader "Content-Type", "application/octet-stream"
   oXML.send vByteStream
   Set oXML = Nothing

End Sub

Flutscht wie gesagt ohne Probleme. Jetzt als alter VB-Nix-Möchter habe das mal mit Delphi6 probiert und folgendes ist dabei rausgekommen:
ausblenden Delphi-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:
var
  aStream : oleVariant;
  aStreamContent : OleVariant;
  xmlHttp : XMLHTTP30;

begin
    .
    .
    .

    xmlHttp := CoXMLHTTP30.Create; // Aus der MSXML2_TLB

    // ****
    // **** Upload
    // ****
    aStream := CreateOleObject('ADODB.Stream');
    aStream.Type := 1;
    aStream.open;
    aStream.LoadFromFile('D:\..\irgeneinedatei.xyz');
    aStreamContent := aStream.Read;
    aStream.Close;
    xmlHttp.open('PUT', "http://abc.de/irgeneinedatei.xyz", False, 'aUserle', 'aPasswörtle');
    xmlHttp.setRequestHeader('Content-Type', 'application/octet-stream');
    xmlHttp.send(aStreamContent);

und jetzt passiert es: beim Send kommt: OLE-Fehler 800C0008

Hat vielleicht jemand eine Ahnung ? Wenn nein, muss ich (widerwillig) mich dem VB ergeben.

Gruss, Espen

Moderiert von user profile iconUGrohne: Code-/Delphi-Tags eingefügt
espen Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 90
Erhaltene Danke: 1


D6 Prof./D7 Prof. MSSQL, MySQL
BeitragVerfasst: Do 22.05.03 11:59 
Titel: Hat sich erledigt
trotzdem danke fürs lesen :wink:
BungeeBug
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 901



BeitragVerfasst: Do 22.05.03 12:10 
Hi,
wär nett wenn du uns allen die Lösung sagen würdest :)


MfG BungeeBug
espen Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 90
Erhaltene Danke: 1


D6 Prof./D7 Prof. MSSQL, MySQL
BeitragVerfasst: Fr 23.05.03 11:21 
Titel: Aber gerne ...
Warum auch immer: So klappt's :D
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
xmlHttp.open('HEADER', RESOURCE_URL, False, conn.UserName, conn.Password); 
      xmlHttp.setRequestHeader('Content-Length', 'xxxx');       xmlHttp.send(aStreamContent);
      // ****
      // **** Upload
      // ****
      aStream := CreateOleObject('ADODB.Stream');
      aStream.Type := 1;
      aStream.open;
      aStream.LoadFromFile(strLocalFile);
       aStreamContent := aStream.Read;
       aStream.Close;

      strServerFile := RESOURCE_URL + '/' + strServerFile;
      xmlHttp.open('PUT', strServerFile, False, Conn.UserName, Conn.Password);
       xmlHttp.setRequestHeader('Content-Type', 'application/octet-stream');
        xmlHttp.send(aStreamContent);



Moderiert von user profile iconPeter Lustig: Delphi-Tags hinzugefügt.
bennixview
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27

Win Linux
Delphi Kylix
BeitragVerfasst: Di 22.06.04 09:22 
Hi,

und wenn ich ne Datei runterlade und diese dan speichern möchte ????
Ich könnte nen kleinen Denkanstoß gebrauchen. Habs schon mit dem Adodb.Stream versucht hat aber nicht geklappt.


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
FXMLHTTP.open('GET', 'http://test.webdav.org/dav/' + aRemoteSource, False, User, Password);
FXMLHTTP.setRequestHeader('GET', '/dav/' + aRemoteSource + ' HTTP/1.1');
FXMLHTTP.setRequestHeader('User-Agent', 'TArcWebDavMgr (compatible; MSIE 6.0; Mozilla 1.0)');
FXMLHTTP.setRequestHeader('Host', 'test.webdav.org');
FXMLHTTP.setRequestHeader('Depth', 'infinity');
FXMLHTTP.setRequestHeader('Content-Type', 'text/xml');

FXMLHTTP.send;


Und dann ???


Moderiert von user profile iconPeter Lustig: Delphi-Tags hinzugefügt.
Udontknow
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: Di 22.06.04 10:25 
Für neue Fragen bitte einen neuen Thread.

Cu,
Udontknow
Dieses Thema ist gesperrt, Du kannst keine Beiträge editieren oder beantworten.

Das Thema wurde von einem Team-Mitglied geschlossen. Wenn du mit der Schließung des Themas nicht einverstanden bist, kontaktiere bitte das Team.