Aug
06
2009
0

ติดต่อ webservice ด้วย proxy

636 views

ตัวอย่างการดึงราคาน้ำมันจาก http://www.pttplc.com/pttinfo.asmx?wsdl
ขั้นแรก add Web References ก่อน

 
        Try
            Dim strReturn As String
            Dim WsPTT As New PTTInfo.PTTInfo()
 
            Dim cr As New System.Net.NetworkCredential("user", "pass", "mydomain")
            Dim pr As New System.Net.WebProxy("203.x.x.x", 8080)
 
            pr.Credentials = cr
            WsPTT.Proxy = pr
 
            strReturn = WsPTT.GetOilPrice("English", 6, 8, 2009)
            MessageBox.Show(strReturn)
 
        Catch Ex As System.Exception
            MessageBox.Show("Time Out")
        End Try
 

Written by Pipo in: VB.Net & Aspx | Tags: , , ,

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes