Results 1 to 2 of 2

Thread: making the url configurable within a webservice proxy class

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Location
    Belfast - N.Ireland
    Posts
    97

    making the url configurable within a webservice proxy class

    at the minute within my proxy class i have the following:-
    Code:
        Public Sub New()
            MyBase.New()
            Me.Url = "http://xxx.xxx.1.19/genericinterfacews/genericinterface.asmx"
        End Sub
    now i could make the me.url configurable quite easily, but the soap headers and binding attributes also have the IP address which would need configured

    Code:
        <System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://xxx.xxx.1.19/genericinterfacews/genericinterface.asmx/HCNSubscribe", RequestNamespace:="http://xxx.xxx.1.19/genericinterfacews/genericinterface.asmx", ResponseNamespace:="http://xxx.xxx.1.19/genericinterfacews/genericinterface.asmx", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)> _
        Public Function HCNSubscribe(ByVal HCN_NO As String, ByVal SystemPatientID As String, ByVal Username As String, ByVal Password As String, ByVal EndSystemUser As String, ByVal MsgID As String) As String

    Code:
     <System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42"), _
     System.Diagnostics.DebuggerStepThroughAttribute(), _
     System.ComponentModel.DesignerCategoryAttribute("code"), _
     System.Web.Services.WebServiceBindingAttribute(Name:="Generic Interface Web ServiceSoap", [Namespace]:="http://xxx.xxx.1.19/genericinterfacews/genericinterface.asmx")> _
    Partial Public Class GenericInterfaceWebService
    is it somehow possible to make the url configuarble throughout? im not sure it is

    reason i ask, is the proxy is used to call a 3rd party webservice but they said the IP may change in the future and we dont want to re-release, just change the IP in a config file

    Cheers,
    Craig

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: making the url configurable within a webservice proxy class

    The .Url property should be all you need to change. It's common practice to keep the Url property configurable and I do it all the time too.

    Your SoapDocumentMethodAttributes and Namespaces are just that - namespaces, they only serve as 'unique' strings to reference the web service and are passed back and forth in the headers to and from the web service, so you can pretty much leave them as they are and it should work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width