Passing Parameters into NEW()

Discussion in 'ASP .Net Web Services' started by Bubba Thomas, Jan 14, 2004.

  1. Bubba Thomas

    Bubba Thomas Guest

    Is there any way that the NEW() of a web service can accept parameters ? I
    would like to pass a boolean to indicate to the webservice that I am in test
    mode or live mode. This will give me the ability to set up which Database I
    want to use on the back end. If I cannot do it this way does anyone know of
    another way I can do it ? I have a WebService that has about 75 procedures
    and I would rather not have to submit this parameter into every one of them.

    I would like to do something like this :


    Private agentMonitorConnectionStringLive As String =
    "uid=callManager;pwd=liveon070703;" &
    "database=callManager;server=129.110.10.235;Connect Timeout=45"
    Private agentMonitorConnectionStringTest As String =
    "uid=callManager;pwd=callManager;" &
    "database=callManager;server=129.110.205.11;pooling='false';Connect
    Timeout=45"
    Private queueMessagesConnectionLive As String =
    "uid=FrontOffice;pwd=liveon070703;" &
    "database=FrontOffice;server=129.110.10.235;Connect Timeout=45"
    Private queueMessagesConnectionTest As String =
    "uid=FrontOffice;pwd=FrontOffice;" &
    "database=FrontOffice;server=129.110.205.11;Connect Timeout=45"
    Public agentMonitorConnectionString As String
    Public queueMessagesConnectionString As String

    Public Sub New(ByVal LiveMode As Boolean)

    If LiveMode Then
    agentMonitorConnectionString = agentMonitorConnectionStringLive
    queueMessagesConnectionString = queueMessagesConnectionLive
    Else
    agentMonitorConnectionString = agentMonitorConnectionStringTest
    queueMessagesConnectionString = queueMessagesConnectionTest
    End If

    End Sub



    TIA !


    Bubba !
     
    Bubba Thomas, Jan 14, 2004
    #1
    1. Advertising

  2. Bubba Thomas

    Jan Tielens Guest

    This is not possible.

    Also it doesn't fit the stateless nature of webservices.

    --
    Greetz,
    Jan
    __________________________________
    Read my weblog: http://weblogs.asp.net/jan
    "Bubba Thomas" <> schreef in bericht
    news:...
    > Is there any way that the NEW() of a web service can accept parameters ?

    I
    > would like to pass a boolean to indicate to the webservice that I am in

    test
    > mode or live mode. This will give me the ability to set up which Database

    I
    > want to use on the back end. If I cannot do it this way does anyone know

    of
    > another way I can do it ? I have a WebService that has about 75

    procedures
    > and I would rather not have to submit this parameter into every one of

    them.
    >
    > I would like to do something like this :
    >
    >
    > Private agentMonitorConnectionStringLive As String =
    > "uid=callManager;pwd=liveon070703;" &
    > "database=callManager;server=129.110.10.235;Connect Timeout=45"
    > Private agentMonitorConnectionStringTest As String =
    > "uid=callManager;pwd=callManager;" &
    > "database=callManager;server=129.110.205.11;pooling='false';Connect
    > Timeout=45"
    > Private queueMessagesConnectionLive As String =
    > "uid=FrontOffice;pwd=liveon070703;" &
    > "database=FrontOffice;server=129.110.10.235;Connect Timeout=45"
    > Private queueMessagesConnectionTest As String =
    > "uid=FrontOffice;pwd=FrontOffice;" &
    > "database=FrontOffice;server=129.110.205.11;Connect Timeout=45"
    > Public agentMonitorConnectionString As String
    > Public queueMessagesConnectionString As String
    >
    > Public Sub New(ByVal LiveMode As Boolean)
    >
    > If LiveMode Then
    > agentMonitorConnectionString = agentMonitorConnectionStringLive
    > queueMessagesConnectionString = queueMessagesConnectionLive
    > Else
    > agentMonitorConnectionString = agentMonitorConnectionStringTest
    > queueMessagesConnectionString = queueMessagesConnectionTest
    > End If
    >
    > End Sub
    >
    >
    >
    > TIA !
    >
    >
    > Bubba !
    >
    >
     
    Jan Tielens, Jan 14, 2004
    #2
    1. Advertising

  3. Well, you could setup two different webservices. In your client side code,
    determine if you are in debug mode and call one or the other.

    How does that sound?

    Michael

    "Bubba Thomas" <> wrote in message
    news:...
    > Is there any way that the NEW() of a web service can accept parameters ?

    I
    > would like to pass a boolean to indicate to the webservice that I am in

    test
    > mode or live mode. This will give me the ability to set up which Database

    I
    > want to use on the back end. If I cannot do it this way does anyone know

    of
    > another way I can do it ? I have a WebService that has about 75

    procedures
    > and I would rather not have to submit this parameter into every one of

    them.
    >
    > I would like to do something like this :
    >
    >
    > Private agentMonitorConnectionStringLive As String =
    > "uid=callManager;pwd=liveon070703;" &
    > "database=callManager;server=129.110.10.235;Connect Timeout=45"
    > Private agentMonitorConnectionStringTest As String =
    > "uid=callManager;pwd=callManager;" &
    > "database=callManager;server=129.110.205.11;pooling='false';Connect
    > Timeout=45"
    > Private queueMessagesConnectionLive As String =
    > "uid=FrontOffice;pwd=liveon070703;" &
    > "database=FrontOffice;server=129.110.10.235;Connect Timeout=45"
    > Private queueMessagesConnectionTest As String =
    > "uid=FrontOffice;pwd=FrontOffice;" &
    > "database=FrontOffice;server=129.110.205.11;Connect Timeout=45"
    > Public agentMonitorConnectionString As String
    > Public queueMessagesConnectionString As String
    >
    > Public Sub New(ByVal LiveMode As Boolean)
    >
    > If LiveMode Then
    > agentMonitorConnectionString = agentMonitorConnectionStringLive
    > queueMessagesConnectionString = queueMessagesConnectionLive
    > Else
    > agentMonitorConnectionString = agentMonitorConnectionStringTest
    > queueMessagesConnectionString = queueMessagesConnectionTest
    > End If
    >
    > End Sub
    >
    >
    >
    > TIA !
    >
    >
    > Bubba !
    >
    >



    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.560 / Virus Database: 352 - Release Date: 1/8/2004
     
    Michael Pearson, Jan 15, 2004
    #3
  4. May I suggest an additional header, pass one in if you
    are in debug mode, and not if you are not.

    Class OptionalHeader : Inherits SoapHeader
    Public DebugMode as boolean
    End Class



    >-----Original Message-----
    >Is there any way that the NEW() of a web service can

    accept parameters ? I
    >would like to pass a boolean to indicate to the

    webservice that I am in test
    >mode or live mode. This will give me the ability to set

    up which Database I
    >want to use on the back end. If I cannot do it this way

    does anyone know of
    >another way I can do it ? I have a WebService that has

    about 75 procedures
    >and I would rather not have to submit this parameter

    into every one of them.
    >
    >I would like to do something like this :
    >
    >
    >Private agentMonitorConnectionStringLive As String =
    >"uid=callManager;pwd=liveon070703;" &
    >"database=callManager;server=129.110.10.235;Connect

    Timeout=45"
    >Private agentMonitorConnectionStringTest As String =
    >"uid=callManager;pwd=callManager;" &
    >"database=callManager;server=129.110.205.11;pooling='fals

    e';Connect
    >Timeout=45"
    >Private queueMessagesConnectionLive As String =
    >"uid=FrontOffice;pwd=liveon070703;" &
    >"database=FrontOffice;server=129.110.10.235;Connect

    Timeout=45"
    >Private queueMessagesConnectionTest As String =
    >"uid=FrontOffice;pwd=FrontOffice;" &
    >"database=FrontOffice;server=129.110.205.11;Connect

    Timeout=45"
    >Public agentMonitorConnectionString As String
    >Public queueMessagesConnectionString As String
    >
    >Public Sub New(ByVal LiveMode As Boolean)
    >
    > If LiveMode Then
    > agentMonitorConnectionString =

    agentMonitorConnectionStringLive
    > queueMessagesConnectionString =

    queueMessagesConnectionLive
    > Else
    > agentMonitorConnectionString =

    agentMonitorConnectionStringTest
    > queueMessagesConnectionString =

    queueMessagesConnectionTest
    > End If
    >
    >End Sub
    >
    >
    >
    >TIA !
    >
    >
    >Bubba !
    >
    >
    >.
    >
     
    Matthew Holton, Jan 15, 2004
    #4
  5. Bubba Thomas

    Bubba Thomas Guest

    This would be my LAST resort as there are many, many objects that have to
    have access to the webservice.


    I appreciate the help anyway !


    Bubba !


    "Michael Pearson" <> wrote in message
    news:...
    > Well, you could setup two different webservices. In your client side

    code,
    > determine if you are in debug mode and call one or the other.
    >
    > How does that sound?
    >
    > Michael
    >
    > "Bubba Thomas" <> wrote in message
    > news:...
    > > Is there any way that the NEW() of a web service can accept parameters ?

    > I
    > > would like to pass a boolean to indicate to the webservice that I am in

    > test
    > > mode or live mode. This will give me the ability to set up which

    Database
    > I
    > > want to use on the back end. If I cannot do it this way does anyone

    know
    > of
    > > another way I can do it ? I have a WebService that has about 75

    > procedures
    > > and I would rather not have to submit this parameter into every one of

    > them.
    > >
    > > I would like to do something like this :
    > >
    > >
    > > Private agentMonitorConnectionStringLive As String =
    > > "uid=callManager;pwd=liveon070703;" &
    > > "database=callManager;server=129.110.10.235;Connect Timeout=45"
    > > Private agentMonitorConnectionStringTest As String =
    > > "uid=callManager;pwd=callManager;" &
    > > "database=callManager;server=129.110.205.11;pooling='false';Connect
    > > Timeout=45"
    > > Private queueMessagesConnectionLive As String =
    > > "uid=FrontOffice;pwd=liveon070703;" &
    > > "database=FrontOffice;server=129.110.10.235;Connect Timeout=45"
    > > Private queueMessagesConnectionTest As String =
    > > "uid=FrontOffice;pwd=FrontOffice;" &
    > > "database=FrontOffice;server=129.110.205.11;Connect Timeout=45"
    > > Public agentMonitorConnectionString As String
    > > Public queueMessagesConnectionString As String
    > >
    > > Public Sub New(ByVal LiveMode As Boolean)
    > >
    > > If LiveMode Then
    > > agentMonitorConnectionString = agentMonitorConnectionStringLive
    > > queueMessagesConnectionString = queueMessagesConnectionLive
    > > Else
    > > agentMonitorConnectionString = agentMonitorConnectionStringTest
    > > queueMessagesConnectionString = queueMessagesConnectionTest
    > > End If
    > >
    > > End Sub
    > >
    > >
    > >
    > > TIA !
    > >
    > >
    > > Bubba !
    > >
    > >

    >
    >
    > ---
    > Outgoing mail is certified Virus Free.
    > Checked by AVG anti-virus system (http://www.grisoft.com).
    > Version: 6.0.560 / Virus Database: 352 - Release Date: 1/8/2004
    >
    >
     
    Bubba Thomas, Jan 15, 2004
    #5
  6. Bubba Thomas

    Bubba Thomas Guest

    I am not familiar with this idea.... Could you give me an example (or point
    me to one) ?

    I would really appreciate it !


    ThanX

    Bubba !


    "Matthew Holton" <> wrote in message
    news:056701c3db18$0c200930$...
    > May I suggest an additional header, pass one in if you
    > are in debug mode, and not if you are not.
    >
    > Class OptionalHeader : Inherits SoapHeader
    > Public DebugMode as boolean
    > End Class
    >
    >
    >
    > >-----Original Message-----
    > >Is there any way that the NEW() of a web service can

    > accept parameters ? I
    > >would like to pass a boolean to indicate to the

    > webservice that I am in test
    > >mode or live mode. This will give me the ability to set

    > up which Database I
    > >want to use on the back end. If I cannot do it this way

    > does anyone know of
    > >another way I can do it ? I have a WebService that has

    > about 75 procedures
    > >and I would rather not have to submit this parameter

    > into every one of them.
    > >
    > >I would like to do something like this :
    > >
    > >
    > >Private agentMonitorConnectionStringLive As String =
    > >"uid=callManager;pwd=liveon070703;" &
    > >"database=callManager;server=129.110.10.235;Connect

    > Timeout=45"
    > >Private agentMonitorConnectionStringTest As String =
    > >"uid=callManager;pwd=callManager;" &
    > >"database=callManager;server=129.110.205.11;pooling='fals

    > e';Connect
    > >Timeout=45"
    > >Private queueMessagesConnectionLive As String =
    > >"uid=FrontOffice;pwd=liveon070703;" &
    > >"database=FrontOffice;server=129.110.10.235;Connect

    > Timeout=45"
    > >Private queueMessagesConnectionTest As String =
    > >"uid=FrontOffice;pwd=FrontOffice;" &
    > >"database=FrontOffice;server=129.110.205.11;Connect

    > Timeout=45"
    > >Public agentMonitorConnectionString As String
    > >Public queueMessagesConnectionString As String
    > >
    > >Public Sub New(ByVal LiveMode As Boolean)
    > >
    > > If LiveMode Then
    > > agentMonitorConnectionString =

    > agentMonitorConnectionStringLive
    > > queueMessagesConnectionString =

    > queueMessagesConnectionLive
    > > Else
    > > agentMonitorConnectionString =

    > agentMonitorConnectionStringTest
    > > queueMessagesConnectionString =

    > queueMessagesConnectionTest
    > > End If
    > >
    > >End Sub
    > >
    > >
    > >
    > >TIA !
    > >
    > >
    > >Bubba !
    > >
    > >
    > >.
    > >
     
    Bubba Thomas, Jan 15, 2004
    #6
  7. Certainly

    Imports System.Web.Services
    Imports System.Web.Services.Protocols

    ' Define a SOAP header by deriving from the SoapHeader
    base class.
    Public Class StartUpParamaters : Inherits SoapHeader
    Public IsDegug As Boolean
    Public Sub New()
    '
    '
    '
    End Sub
    End Class


    <WebService(Namespace:="http://myserver.mydomain.com/")>
    Public Class Manager
    Inherits System.Web.Services.WebService

    Public oHead as StartUpParamaters

    <WebMethod(EnableSession:=True), SoapHeader
    ("oHead",Direction := SoapHeaderDirection.In, _
    Required := False))> Public Function Login(ByVal
    UserName As String, ByVal Password As String) As Integer

    if oHead.IsDebug then
    'Write to trace log
    end if
    End Function
    End Class

    'Client

    Public Shared Sub Main()
    Dim ws As New Manager()

    Try
    Dim customHeader As New StartUpParamaters()

    customHeader.IsDebug = True

    ws.myHeader = customHeader

    Dim results As Integer

    results = ws.Login("UserName","Password")
    Catch e As Exception
    Console.WriteLine("Exception: {0}", e.ToString
    ())
    End Try
    End Sub

    ms-
    help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemWebServices
    ProtocolsSoapHeaderClassMustUnderstandTopic.htm

    ms-
    help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemWebServices
    ProtocolsSoapHeaderAttributeClassDirectionTopic.htm

    ms-
    help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemWebServices
    ProtocolsSoapHeaderAttributeClassRequiredTopic.htm


    HTH

    Matthew

    >-----Original Message-----
    >I am not familiar with this idea.... Could you give me

    an example (or point
    >me to one) ?
    >
    >I would really appreciate it !
    >
    >
    >ThanX
    >
    >Bubba !
    >
    >
    >"Matthew Holton" <> wrote in

    message
    >news:056701c3db18$0c200930$...
    >> May I suggest an additional header, pass one in if you
    >> are in debug mode, and not if you are not.
    >>
    >> Class OptionalHeader : Inherits SoapHeader
    >> Public DebugMode as boolean
    >> End Class
    >>
    >>
    >>
    >> >-----Original Message-----
    >> >Is there any way that the NEW() of a web service can

    >> accept parameters ? I
    >> >would like to pass a boolean to indicate to the

    >> webservice that I am in test
    >> >mode or live mode. This will give me the ability to

    set
    >> up which Database I
    >> >want to use on the back end. If I cannot do it this

    way
    >> does anyone know of
    >> >another way I can do it ? I have a WebService that

    has
    >> about 75 procedures
    >> >and I would rather not have to submit this parameter

    >> into every one of them.
    >> >
    >> >I would like to do something like this :
    >> >
    >> >
    >> >Private agentMonitorConnectionStringLive As String =
    >> >"uid=callManager;pwd=liveon070703;" &
    >> >"database=callManager;server=129.110.10.235;Connect

    >> Timeout=45"
    >> >Private agentMonitorConnectionStringTest As String =
    >> >"uid=callManager;pwd=callManager;" &

    >>

    >"database=callManager;server=129.110.205.11;pooling='fals
    >> e';Connect
    >> >Timeout=45"
    >> >Private queueMessagesConnectionLive As String =
    >> >"uid=FrontOffice;pwd=liveon070703;" &
    >> >"database=FrontOffice;server=129.110.10.235;Connect

    >> Timeout=45"
    >> >Private queueMessagesConnectionTest As String =
    >> >"uid=FrontOffice;pwd=FrontOffice;" &
    >> >"database=FrontOffice;server=129.110.205.11;Connect

    >> Timeout=45"
    >> >Public agentMonitorConnectionString As String
    >> >Public queueMessagesConnectionString As String
    >> >
    >> >Public Sub New(ByVal LiveMode As Boolean)
    >> >
    >> > If LiveMode Then
    >> > agentMonitorConnectionString =

    >> agentMonitorConnectionStringLive
    >> > queueMessagesConnectionString =

    >> queueMessagesConnectionLive
    >> > Else
    >> > agentMonitorConnectionString =

    >> agentMonitorConnectionStringTest
    >> > queueMessagesConnectionString =

    >> queueMessagesConnectionTest
    >> > End If
    >> >
    >> >End Sub
    >> >
    >> >
    >> >
    >> >TIA !
    >> >
    >> >
    >> >Bubba !
    >> >
    >> >
    >> >.
    >> >

    >
    >
    >.
    >
     
    Matthew Holton, Jan 15, 2004
    #7
  8. Bubba Thomas

    Bubba Thomas Guest

    ThanX,


    I am gonna give it a go ...

    I will let you know how it goes.

    Bubba



    "Matthew Holton" <> wrote in message
    news:0d5c01c3db76$f72e81f0$...
    > Certainly
    >
    > Imports System.Web.Services
    > Imports System.Web.Services.Protocols
    >
    > ' Define a SOAP header by deriving from the SoapHeader
    > base class.
    > Public Class StartUpParamaters : Inherits SoapHeader
    > Public IsDegug As Boolean
    > Public Sub New()
    > '
    > '
    > '
    > End Sub
    > End Class
    >
    >
    > <WebService(Namespace:="http://myserver.mydomain.com/")>
    > Public Class Manager
    > Inherits System.Web.Services.WebService
    >
    > Public oHead as StartUpParamaters
    >
    > <WebMethod(EnableSession:=True), SoapHeader
    > ("oHead",Direction := SoapHeaderDirection.In, _
    > Required := False))> Public Function Login(ByVal
    > UserName As String, ByVal Password As String) As Integer
    >
    > if oHead.IsDebug then
    > 'Write to trace log
    > end if
    > End Function
    > End Class
    >
    > 'Client
    >
    > Public Shared Sub Main()
    > Dim ws As New Manager()
    >
    > Try
    > Dim customHeader As New StartUpParamaters()
    >
    > customHeader.IsDebug = True
    >
    > ws.myHeader = customHeader
    >
    > Dim results As Integer
    >
    > results = ws.Login("UserName","Password")
    > Catch e As Exception
    > Console.WriteLine("Exception: {0}", e.ToString
    > ())
    > End Try
    > End Sub
    >
    > ms-
    > help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemWebServices
    > ProtocolsSoapHeaderClassMustUnderstandTopic.htm
    >
    > ms-
    > help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemWebServices
    > ProtocolsSoapHeaderAttributeClassDirectionTopic.htm
    >
    > ms-
    > help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemWebServices
    > ProtocolsSoapHeaderAttributeClassRequiredTopic.htm
    >
    >
    > HTH
    >
    > Matthew
    >
    > >-----Original Message-----
    > >I am not familiar with this idea.... Could you give me

    > an example (or point
    > >me to one) ?
    > >
    > >I would really appreciate it !
    > >
    > >
    > >ThanX
    > >
    > >Bubba !
    > >
    > >
    > >"Matthew Holton" <> wrote in

    > message
    > >news:056701c3db18$0c200930$...
    > >> May I suggest an additional header, pass one in if you
    > >> are in debug mode, and not if you are not.
    > >>
    > >> Class OptionalHeader : Inherits SoapHeader
    > >> Public DebugMode as boolean
    > >> End Class
    > >>
    > >>
    > >>
    > >> >-----Original Message-----
    > >> >Is there any way that the NEW() of a web service can
    > >> accept parameters ? I
    > >> >would like to pass a boolean to indicate to the
    > >> webservice that I am in test
    > >> >mode or live mode. This will give me the ability to

    > set
    > >> up which Database I
    > >> >want to use on the back end. If I cannot do it this

    > way
    > >> does anyone know of
    > >> >another way I can do it ? I have a WebService that

    > has
    > >> about 75 procedures
    > >> >and I would rather not have to submit this parameter
    > >> into every one of them.
    > >> >
    > >> >I would like to do something like this :
    > >> >
    > >> >
    > >> >Private agentMonitorConnectionStringLive As String =
    > >> >"uid=callManager;pwd=liveon070703;" &
    > >> >"database=callManager;server=129.110.10.235;Connect
    > >> Timeout=45"
    > >> >Private agentMonitorConnectionStringTest As String =
    > >> >"uid=callManager;pwd=callManager;" &
    > >>

    > >"database=callManager;server=129.110.205.11;pooling='fals
    > >> e';Connect
    > >> >Timeout=45"
    > >> >Private queueMessagesConnectionLive As String =
    > >> >"uid=FrontOffice;pwd=liveon070703;" &
    > >> >"database=FrontOffice;server=129.110.10.235;Connect
    > >> Timeout=45"
    > >> >Private queueMessagesConnectionTest As String =
    > >> >"uid=FrontOffice;pwd=FrontOffice;" &
    > >> >"database=FrontOffice;server=129.110.205.11;Connect
    > >> Timeout=45"
    > >> >Public agentMonitorConnectionString As String
    > >> >Public queueMessagesConnectionString As String
    > >> >
    > >> >Public Sub New(ByVal LiveMode As Boolean)
    > >> >
    > >> > If LiveMode Then
    > >> > agentMonitorConnectionString =
    > >> agentMonitorConnectionStringLive
    > >> > queueMessagesConnectionString =
    > >> queueMessagesConnectionLive
    > >> > Else
    > >> > agentMonitorConnectionString =
    > >> agentMonitorConnectionStringTest
    > >> > queueMessagesConnectionString =
    > >> queueMessagesConnectionTest
    > >> > End If
    > >> >
    > >> >End Sub
    > >> >
    > >> >
    > >> >
    > >> >TIA !
    > >> >
    > >> >
    > >> >Bubba !
    > >> >
    > >> >
    > >> >.
    > >> >

    > >
    > >
    > >.
    > >
     
    Bubba Thomas, Jan 15, 2004
    #8
  9. Bubba Thomas

    Bubba Thomas Guest

    I presume that I need to place the following at each one of my functions and
    procedures ?

    <WebMethod(EnableSession:=True), SoapHeader("oHead",Direction :=
    SoapHeaderDirection.In, _
    Required := False))> PUBLIC FUNCTION () OR PROCEDURE()

    ThanX again for the help !

    Bubba !


    "Matthew Holton" <> wrote in message
    news:0d5c01c3db76$f72e81f0$...
    > Certainly
    >
    > Imports System.Web.Services
    > Imports System.Web.Services.Protocols
    >
    > ' Define a SOAP header by deriving from the SoapHeader
    > base class.
    > Public Class StartUpParamaters : Inherits SoapHeader
    > Public IsDegug As Boolean
    > Public Sub New()
    > '
    > '
    > '
    > End Sub
    > End Class
    >
    >
    > <WebService(Namespace:="http://myserver.mydomain.com/")>
    > Public Class Manager
    > Inherits System.Web.Services.WebService
    >
    > Public oHead as StartUpParamaters
    >
    > <WebMethod(EnableSession:=True), SoapHeader
    > ("oHead",Direction := SoapHeaderDirection.In, _
    > Required := False))> Public Function Login(ByVal
    > UserName As String, ByVal Password As String) As Integer
    >
    > if oHead.IsDebug then
    > 'Write to trace log
    > end if
    > End Function
    > End Class
    >
    > 'Client
    >
    > Public Shared Sub Main()
    > Dim ws As New Manager()
    >
    > Try
    > Dim customHeader As New StartUpParamaters()
    >
    > customHeader.IsDebug = True
    >
    > ws.myHeader = customHeader
    >
    > Dim results As Integer
    >
    > results = ws.Login("UserName","Password")
    > Catch e As Exception
    > Console.WriteLine("Exception: {0}", e.ToString
    > ())
    > End Try
    > End Sub
    >
    > ms-
    > help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemWebServices
    > ProtocolsSoapHeaderClassMustUnderstandTopic.htm
    >
    > ms-
    > help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemWebServices
    > ProtocolsSoapHeaderAttributeClassDirectionTopic.htm
    >
    > ms-
    > help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemWebServices
    > ProtocolsSoapHeaderAttributeClassRequiredTopic.htm
    >
    >
    > HTH
    >
    > Matthew
    >
    > >-----Original Message-----
    > >I am not familiar with this idea.... Could you give me

    > an example (or point
    > >me to one) ?
    > >
    > >I would really appreciate it !
    > >
    > >
    > >ThanX
    > >
    > >Bubba !
    > >
    > >
    > >"Matthew Holton" <> wrote in

    > message
    > >news:056701c3db18$0c200930$...
    > >> May I suggest an additional header, pass one in if you
    > >> are in debug mode, and not if you are not.
    > >>
    > >> Class OptionalHeader : Inherits SoapHeader
    > >> Public DebugMode as boolean
    > >> End Class
    > >>
    > >>
    > >>
    > >> >-----Original Message-----
    > >> >Is there any way that the NEW() of a web service can
    > >> accept parameters ? I
    > >> >would like to pass a boolean to indicate to the
    > >> webservice that I am in test
    > >> >mode or live mode. This will give me the ability to

    > set
    > >> up which Database I
    > >> >want to use on the back end. If I cannot do it this

    > way
    > >> does anyone know of
    > >> >another way I can do it ? I have a WebService that

    > has
    > >> about 75 procedures
    > >> >and I would rather not have to submit this parameter
    > >> into every one of them.
    > >> >
    > >> >I would like to do something like this :
    > >> >
    > >> >
    > >> >Private agentMonitorConnectionStringLive As String =
    > >> >"uid=callManager;pwd=liveon070703;" &
    > >> >"database=callManager;server=129.110.10.235;Connect
    > >> Timeout=45"
    > >> >Private agentMonitorConnectionStringTest As String =
    > >> >"uid=callManager;pwd=callManager;" &
    > >>

    > >"database=callManager;server=129.110.205.11;pooling='fals
    > >> e';Connect
    > >> >Timeout=45"
    > >> >Private queueMessagesConnectionLive As String =
    > >> >"uid=FrontOffice;pwd=liveon070703;" &
    > >> >"database=FrontOffice;server=129.110.10.235;Connect
    > >> Timeout=45"
    > >> >Private queueMessagesConnectionTest As String =
    > >> >"uid=FrontOffice;pwd=FrontOffice;" &
    > >> >"database=FrontOffice;server=129.110.205.11;Connect
    > >> Timeout=45"
    > >> >Public agentMonitorConnectionString As String
    > >> >Public queueMessagesConnectionString As String
    > >> >
    > >> >Public Sub New(ByVal LiveMode As Boolean)
    > >> >
    > >> > If LiveMode Then
    > >> > agentMonitorConnectionString =
    > >> agentMonitorConnectionStringLive
    > >> > queueMessagesConnectionString =
    > >> queueMessagesConnectionLive
    > >> > Else
    > >> > agentMonitorConnectionString =
    > >> agentMonitorConnectionStringTest
    > >> > queueMessagesConnectionString =
    > >> queueMessagesConnectionTest
    > >> > End If
    > >> >
    > >> >End Sub
    > >> >
    > >> >
    > >> >
    > >> >TIA !
    > >> >
    > >> >
    > >> >Bubba !
    > >> >
    > >> >
    > >> >.
    > >> >

    > >
    > >
    > >.
    > >
     
    Bubba Thomas, Jan 15, 2004
    #9
  10. Bubba Thomas

    Guest Guest

    You are correct.

    >-----Original Message-----
    >I presume that I need to place the following at each one

    of my functions and
    >procedures ?
    >
    ><WebMethod(EnableSession:=True), SoapHeader

    ("oHead",Direction :=
    >SoapHeaderDirection.In, _
    > Required := False))> PUBLIC FUNCTION () OR

    PROCEDURE()
    >
    >ThanX again for the help !
    >
    >Bubba !
    >
    >
    >"Matthew Holton" <> wrote in

    message
    >news:0d5c01c3db76$f72e81f0$...
    >> Certainly
    >>
    >> Imports System.Web.Services
    >> Imports System.Web.Services.Protocols
    >>
    >> ' Define a SOAP header by deriving from the SoapHeader
    >> base class.
    >> Public Class StartUpParamaters : Inherits SoapHeader
    >> Public IsDegug As Boolean
    >> Public Sub New()
    >> '
    >> '
    >> '
    >> End Sub
    >> End Class
    >>
    >>
    >> <WebService(Namespace:="http://myserver.mydomain.com/")

    >
    >> Public Class Manager
    >> Inherits System.Web.Services.WebService
    >>
    >> Public oHead as StartUpParamaters
    >>
    >> <WebMethod(EnableSession:=True), SoapHeader
    >> ("oHead",Direction := SoapHeaderDirection.In, _
    >> Required := False))> Public Function Login(ByVal
    >> UserName As String, ByVal Password As String) As

    Integer
    >>
    >> if oHead.IsDebug then
    >> 'Write to trace log
    >> end if
    >> End Function
    >> End Class
    >>
    >> 'Client
    >>
    >> Public Shared Sub Main()
    >> Dim ws As New Manager()
    >>
    >> Try
    >> Dim customHeader As New StartUpParamaters()
    >>
    >> customHeader.IsDebug = True
    >>
    >> ws.myHeader = customHeader
    >>
    >> Dim results As Integer
    >>
    >> results = ws.Login("UserName","Password")
    >> Catch e As Exception
    >> Console.WriteLine("Exception: {0}",

    e.ToString
    >> ())
    >> End Try
    >> End Sub
    >>
    >> ms-
    >>

    help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemWebServices
    >> ProtocolsSoapHeaderClassMustUnderstandTopic.htm
    >>
    >> ms-
    >>

    help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemWebServices
    >> ProtocolsSoapHeaderAttributeClassDirectionTopic.htm
    >>
    >> ms-
    >>

    help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemWebServices
    >> ProtocolsSoapHeaderAttributeClassRequiredTopic.htm
    >>
    >>
    >> HTH
    >>
    >> Matthew
    >>
    >> >-----Original Message-----
    >> >I am not familiar with this idea.... Could you give

    me
    >> an example (or point
    >> >me to one) ?
    >> >
    >> >I would really appreciate it !
    >> >
    >> >
    >> >ThanX
    >> >
    >> >Bubba !
    >> >
    >> >
    >> >"Matthew Holton" <> wrote in

    >> message
    >> >news:056701c3db18$0c200930$...
    >> >> May I suggest an additional header, pass one in if

    you
    >> >> are in debug mode, and not if you are not.
    >> >>
    >> >> Class OptionalHeader : Inherits SoapHeader
    >> >> Public DebugMode as boolean
    >> >> End Class
    >> >>
    >> >>
    >> >>
    >> >> >-----Original Message-----
    >> >> >Is there any way that the NEW() of a web service

    can
    >> >> accept parameters ? I
    >> >> >would like to pass a boolean to indicate to the
    >> >> webservice that I am in test
    >> >> >mode or live mode. This will give me the ability to

    >> set
    >> >> up which Database I
    >> >> >want to use on the back end. If I cannot do it

    this
    >> way
    >> >> does anyone know of
    >> >> >another way I can do it ? I have a WebService that

    >> has
    >> >> about 75 procedures
    >> >> >and I would rather not have to submit this

    parameter
    >> >> into every one of them.
    >> >> >
    >> >> >I would like to do something like this :
    >> >> >
    >> >> >
    >> >> >Private agentMonitorConnectionStringLive As String

    =
    >> >> >"uid=callManager;pwd=liveon070703;" &
    >> >> >"database=callManager;server=129.110.10.235;Connect
    >> >> Timeout=45"
    >> >> >Private agentMonitorConnectionStringTest As String

    =
    >> >> >"uid=callManager;pwd=callManager;" &
    >> >>

    >>

    >"database=callManager;server=129.110.205.11;pooling='fals
    >> >> e';Connect
    >> >> >Timeout=45"
    >> >> >Private queueMessagesConnectionLive As String =
    >> >> >"uid=FrontOffice;pwd=liveon070703;" &
    >> >> >"database=FrontOffice;server=129.110.10.235;Connect
    >> >> Timeout=45"
    >> >> >Private queueMessagesConnectionTest As String =
    >> >> >"uid=FrontOffice;pwd=FrontOffice;" &
    >> >> >"database=FrontOffice;server=129.110.205.11;Connect
    >> >> Timeout=45"
    >> >> >Public agentMonitorConnectionString As String
    >> >> >Public queueMessagesConnectionString As String
    >> >> >
    >> >> >Public Sub New(ByVal LiveMode As Boolean)
    >> >> >
    >> >> > If LiveMode Then
    >> >> > agentMonitorConnectionString =
    >> >> agentMonitorConnectionStringLive
    >> >> > queueMessagesConnectionString =
    >> >> queueMessagesConnectionLive
    >> >> > Else
    >> >> > agentMonitorConnectionString =
    >> >> agentMonitorConnectionStringTest
    >> >> > queueMessagesConnectionString =
    >> >> queueMessagesConnectionTest
    >> >> > End If
    >> >> >
    >> >> >End Sub
    >> >> >
    >> >> >
    >> >> >
    >> >> >TIA !
    >> >> >
    >> >> >
    >> >> >Bubba !
    >> >> >
    >> >> >
    >> >> >.
    >> >> >
    >> >
    >> >
    >> >.
    >> >

    >
    >
    >.
    >
     
    Guest, Jan 15, 2004
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    4
    Views:
    426
    Steven Bethard
    Sep 24, 2007
  2. Ramon F Herrera
    Replies:
    8
    Views:
    483
    Pascal J. Bourguignon
    Sep 13, 2009
  3. Doug Glidden
    Replies:
    3
    Views:
    136
    Doug Glidden
    Aug 24, 2008
  4. Peter Hickman

    Problems passing parameters into XSLT

    Peter Hickman, Nov 17, 2008, in forum: Ruby
    Replies:
    2
    Views:
    132
    Jamie Orchard-hays
    Jan 15, 2009
  5. Replies:
    5
    Views:
    76
    Jorge
    Jan 16, 2009
Loading...

Share This Page