Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Experian Services
Message
Information générale
Forum:
ASP.NET
Catégorie:
XML
Versions des environnements
Environment:
ASP.NET
OS:
Windows XP SP2
Divers
Thread ID:
00987897
Message ID:
00995640
Vues:
35
Thanks. I didn't realize i had not responded to this post.

My thanks again,

>Here's a simple class we use to send and retrieve data from exp.
>
>The New method has 3 params (the URL of the service, the username you use, the password your account uses)
>
>Let me know if this helps.
>
>Rodman
>
>
>Imports System.Net
>Imports System.Net.WebRequest
>Imports System.IO
>
>Public Class cktest
>
> Private _WebReq As HttpWebRequest
> Private _WebReqSet As Boolean = False
> Private _cUrl As String = ""
> Private _cUserName As String = ""
> Private _cPassword As String = ""
>
> Private ReadOnly Property WebReq() As HttpWebRequest
> Get
> If Me._WebReqSet = False Then
> Me._WebReq = CType(WebRequest.Create(Me._cUrl), HttpWebRequest)
> With Me._WebReq
> .Method = "POST"
> .ContentType = "text/xml"
> .AllowWriteStreamBuffering = True
> End With
> Me._WebReqSet = True
>
> End If
> Return Me._WebReq
> End Get
> End Property
>
>
>
> Public Function GetCheckPointText(ByVal cInputPacket As String)
> '-- copy contents of request into a byte array
> Dim buf As Byte()
> buf = System.Text.Encoding.UTF8.GetBytes(cInputPacket)
>
> 'Write the contents of the Byte Array (the UTF-8 encoded byte representation
> 'of the XML string) to the HttpWebRequest's RequestStream. This is the data that
> 'will be posted to the target URL. The GetRequestStream method is used to obtain
> 'a reference to the HttpWebRequest's request stream.
> Dim HttpStream As Stream
> HttpStream = Me.WebReq.GetRequestStream()
> HttpStream.Write(buf, 0, buf.Length)
> HttpStream.Flush()
> HttpStream.Close()
>
> Dim HttpWResp As HttpWebResponse = _
> CType(Me.WebReq.GetResponse(), HttpWebResponse)
>
> Dim receiveStream As Stream = HttpWResp.GetResponseStream()
>
> 'Use the GetEncoding Static method of the System.Text.Encoding object to
> 'instantiate a UTF-8 Encoding object.
> Dim encode As System.Text.Encoding = System.Text.Encoding.GetEncoding("utf-8")
>
> ' Pipe the response stream to a higher level stream reader with the required
> 'encoding format. The StreamReader object will be used to access the contents
> 'of the ResponseStream.
> Dim readStream As New StreamReader(receiveStream, encode)
>
> '--read the result to the end now
> Dim cReturnValue As String = readStream.ReadToEnd()
>
> '-- close shop
> receiveStream.Close()
> readStream.Close()
> HttpWResp.Close()
>
> Return cReturnValue
>
> End Function
>
> Public Sub New(ByVal cUrl As String, ByVal UserName As String, ByVal Password As String)
>
> Me._cUrl = cUrl
> Me._cPassword = Password
> Me._cUserName = UserName
>
>
> End Sub
>
>
>End Class
~Joe Johnston USA

"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams

Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform