How to dinamically change WebService namespace?
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.webservices.enhancements.

Post a new message to this list...

Nicola Garone
Hi all
I'm developing a client-server application which use WebServices, this
application will be installed in more than a intranet network, so I'm using
dynamic behaviour and it seem to work fine, but this way it uses a fixed
namespace (actually my machine) I know I can put this on our company's web
site, but this way customers needs a permanent internet connection which I
don't like.

What I'd like is to redefine (automatically during installation or better
programatically) namespace each time I install my application so each client
refer directly to its own server

thanks

Nicola Garone

Reply to this message...
 
    
Mickey Williams
Namespace? This doesn't make a lot of sense to me. Are you referring to the
endpoint for the service? The endpoint is orthogonal to the namespace. If
you create the client side proxy by hand (or use the Visual Studio-created
client proxy and set the URL behavior property to Dynamic) you can control
the endpoint with a config file. Change the value in the config file during
installation.

--
Mickey Williams
Author, "Microsoft Visual C# .NET Core Reference", MS Press
www.servergeek.com/blogs/mickey

"Nicola Garone" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Nicola Garone
What I meant is:
if I change webservice to dinamic my class definition is automatically
changed as follow

<System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Web.Services.WebServiceBindingAttribute(Name:="DiogenesDataSrvSoap",
[Namespace]:="http://NB-nicola/Diogenes/TdmDataSrv";)> _
Public Class DiogenesDataSrv
Inherits System.Web.Services.Protocols.SoapHttpClientProtocol

Public Sub New()
MyBase.New
Dim urlSetting As String =
System.Configuration.ConfigurationSettings.AppSettings("DiogenesClient.Dioge
nesDataSrvWS.DiogenesDataSrv")
If (Not (urlSetting) Is Nothing) Then
Me.Url = String.Concat(urlSetting, "")
Else
Me.Url = "http://nb-nicola/Diogenes/DiogenesDataSrv.asmx";
End If
End Sub

.......

There is no way to set programatically Namespace attribute, and clients need
to contact NB-Nicola to obtain I-don't-understand-what, but I understand if
NB-Nicola is not reachable WebService doesn't work correctly.
Ok I can use my company site (www.mycompany.it) but I'd like my application
to work in network also if non internet connection is available...

Any advice?

Nicola.

"Mickey Williams" <my first name at servergeek.com> ha scritto nel messaggio
news:%Click here to reveal e-mail address...
> Namespace? This doesn't make a lot of sense to me. Are you referring to
the
[Original message clipped]

Reply to this message...
 
    
Mickey Williams
"Nicola Garone" <Click here to reveal e-mail address> wrote in message
news:%Click here to reveal e-mail address...

> There is no way to set programatically Namespace attribute, and clients
need
> to contact NB-Nicola to obtain I-don't-understand-what, but I understand
if
> NB-Nicola is not reachable WebService doesn't work correctly.

The namespace does not need to be resolved at run time - the fact that the
namespace appears to be a resolvable URL does not mean that there must be a
document (or anything else) at that endpoint. However, if you don't provide
an entry in the config file, the client will be directed to:
"http://nb-nicola/Diogenes/DiogenesDataSrv.asmx";

--
Mickey Williams
Author, "Microsoft Visual C# .NET Core Reference", MS Press
www.servergeek.com/blogs/mickey

Reply to this message...
 
 
System.ComponentModel.DesignerCategoryAttribute
System.Configuration.ConfigurationSettings
System.Diagnostics.DebuggerStepThroughAttribute
System.String
System.Web.Services.Protocols.SoapHttpClientProtocol
System.Web.Services.WebService
System.Web.Services.WebServiceBindingAttribute




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com