J'essaye d'evoyer un fichier fixml vers un serveur nymex distant, pour cela, j'utilise le code suivant :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
63
64
65
66
 
Public Class GATEWAY
    Dim url As String = "https://www.blabla.com"
    Dim port As String = "443"
    Dim msg As String = "blabla"
    Dim user_id As String = "login"
    Dim user_pass As String = "mdp"
    Dim reqid As String
    Dim client As New WebClient()
    Dim request As String
    Dim myCredentials As New NetworkCredential(user_id, user_pass)
    Dim login As Boolean = False
    Dim logoff As Boolean = False
    Dim sw As StreamWriter
    Dim f_path As String = "C:\Documents and Settings\...\"
    Dim f_name As String = "test.xml"
    Dim XmlDoc As XmlDocument = New XmlDocument()
    Dim elemUserReq As XmlElement
 
Function test()
 
        client.BaseAddress = url
        client.Credentials = myCredentials
 
        XmlDoc.LoadXml("<FIXML></FIXML>")
 
        XmlDoc.DocumentElement.SetAttribute("v", "4.4")
        XmlDoc.DocumentElement.SetAttribute("s", "20040109")
        XmlDoc.DocumentElement.SetAttribute("r", "20030618")
 
        elemUserReq = XmlDoc.CreateElement("UserReq")
 
        elemUserReq.SetAttribute("ReqID", get_reqid())
        elemUserReq.SetAttribute("UserReqTyp", "1")
        elemUserReq.SetAttribute("Username", user_id)
        elemUserReq.SetAttribute("Password", user_pass)
 
        XmlDoc.DocumentElement.AppendChild(elemUserReq)
 
        XmlDoc.Save(f_path + f_name)
 
        'client.UploadFile(url + ":" + port + msg, f_path + f_name)
 
        request = XmlDoc.ToString()
 
        client.UploadString(url + ":" + port + msg, request)
 
        dataStream = client.OpenRead(url + msg)
        'Open the stream using a StreamReader for easy access.
        reader = New StreamReader(dataStream)
        'Read the content.
        responseFromServer = reader.ReadToEnd()
        TextBox1.Text = responseFromServer
        reader.Close()
        dataStream.Close()
 
End Function
 
    Function get_reqid() As String
        Return (user_id + System.DateTime.Now.TimeOfDay.Milliseconds.ToString())
    End Function
 
Private Sub GATEWAY_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.test()
    End Sub
End Class
Que j'essaye de cette manière ou de la facon en commentaire j'ai le meme message d'erreur dans "responseFromServer" : "<reply><error code="0">General Exception:XML Parsing Exception:Error on line 1: Premature end of file.</error></reply>"

quelqu'un sait comment arranger ca ?

Le fichier Fixml semble clean, il est ouvert par internet explorer sans aucune erreur