Home All Groups Group Topic Archive Search About

Consume webservice within intranet from internet

Author
4 Dec 2006 4:49 PM
UnglueD
Hello.

  I have a webservice located on a machine within our network.  I have
developed and tested this webservice internally without having to worry
about credentials.  Now I wish for web applications located on a server
outside the network to be able to consume this webservice.  I do not
want to put the webservice outside the network, and only want to allow
a handful of web applications to be able to consume it.

The error I'm getting is as follows:
--------------------------------------------------------------------------------

The underlying connection was closed: Unable to connect to the remote
server.

Upon some researching I found articles about HTTP Proxy server/firewall
settings messing with the connections, resulting in the previous error.
So I made changes to the web.config and the way that I call the
webservice.

Web.config:

<system.net>
<defaultProxy>
     <proxy
          usesystemdefault = "false"
          proxyaddress="http://proxyserver:port"
          bypassonlocal="true"
     />
</defaultProxy>
</system.net>


I call the webservice as follows:
        Dim ws As New myServices.webservice
        Dim myProxy As New WebProxy("http://proxyip:proxyport", True)
        ws.Proxy = myProxy
        ws.Credentials = New System.Net.NetworkCredential("name",
"password")
        Dim asdf As String = ws.Process()


I still receive the same error and am running out of ideas.  Please
help.

Thanks.

Author
5 Dec 2006 12:46 PM
Michel Posseth [MCP]
i use this :

copy paste from one of my projects


Dim MijnistaWs As New wsMijnista.mijnistaWebService
            If My.Settings.UseProxy Then
                Dim pr As New System.Net.WebProxy(My.Settings.ProxyAdres,
CInt(My.Settings.ProxyPoort))
                If My.Settings.DefaultCR Then
                    pr.Credentials =
System.Net.CredentialCache.DefaultCredentials
                Else
                    Dim cr As New
System.Net.NetworkCredential(My.Settings.proxyUname, My.Settings.proxyPass,
My.Settings.ProxyDomein)
                    pr.Credentials = cr
                End If
                MijnistaWs.Proxy = pr
            End If


This works for me in all situations ,  ofcourse i have a settings screen
where you can choose for a direct connection , or connection through a proxy
with the default login values or by alternate values .

regards

Michel Posseth [MCP] 




Show quoteHide quote
"UnglueD" wrote:

> Hello.
>
>   I have a webservice located on a machine within our network.  I have
> developed and tested this webservice internally without having to worry
> about credentials.  Now I wish for web applications located on a server
> outside the network to be able to consume this webservice.  I do not
> want to put the webservice outside the network, and only want to allow
> a handful of web applications to be able to consume it.
>
> The error I'm getting is as follows:
> --------------------------------------------------------------------------------
>
> The underlying connection was closed: Unable to connect to the remote
> server.
>
> Upon some researching I found articles about HTTP Proxy server/firewall
> settings messing with the connections, resulting in the previous error.
>  So I made changes to the web.config and the way that I call the
> webservice.
>
> Web.config:
>
> <system.net>
> <defaultProxy>
>      <proxy
>           usesystemdefault = "false"
>           proxyaddress="http://proxyserver:port"
>           bypassonlocal="true"
>      />
> </defaultProxy>
> </system.net>
>
>
> I call the webservice as follows:
>         Dim ws As New myServices.webservice
>         Dim myProxy As New WebProxy("http://proxyip:proxyport", True)
>         ws.Proxy = myProxy
>         ws.Credentials = New System.Net.NetworkCredential("name",
> "password")
>         Dim asdf As String = ws.Process()
>
>
> I still receive the same error and am running out of ideas.  Please
> help.
>
> Thanks.
>
>