Service with 'shared' datatypes

Discussion in 'ASP .Net Web Services' started by Maik Albrecht, Aug 23, 2004.

  1. Hello NG,

    I need to write a factory where I be able to switch between webservice
    support and normal dll support. So I wrote a small test programm. In this
    case I get the problem that I can't find a way to load a komplex datatype
    from a dll und use it as a parameter in the service. In normal case the
    client will use the datatypes published by the webservice. But so i have to
    use the published types in the main programm and are not able to switsch.

    Here some code

    WebService.dll
    <WebMethod()> _

    Public Function GetName(ByVal param As [Shared].MyEnum) As String

    ' The parameter [Shared].MyEnum lost his namespace in the wsdl document :(

    Return "MyName"

    End Function



    Shared.dll

    Public Enum MyEnum

    param1

    param2

    End Enum



    Client.exe



    Dim dm As New localhost.Service1

    Dim a As [Shared].MyEnum

    a = [Shared].MyEnum.param1

    'Me.Label1.Text = dm.GetName(a) ' not working because it is not the valid
    type, but thats the way i need it !

    Me.Label1.Text = dm.GetName(localhost.MyEnum.param1)
    Maik Albrecht, Aug 23, 2004
    #1
    1. Advertising

  2. I am not certain that I completely understand your problem.
    but,
    I think you might be able to correct the problem by modifying the generated
    webservice proxy classes to reference the datatypes defined in your DLL.

    By default a webservice will give you new datatypes - localhost1.DataType1,
    localhost1.DataType2, etc

    just modify the generated code to reference your externally defined
    datatypes, in place of those generated ones.

    -D

    "Maik Albrecht" <> wrote in message
    news:...
    > Hello NG,
    >
    > I need to write a factory where I be able to switch between webservice
    > support and normal dll support. So I wrote a small test programm. In this
    > case I get the problem that I can't find a way to load a komplex datatype
    > from a dll und use it as a parameter in the service. In normal case the
    > client will use the datatypes published by the webservice. But so i have

    to
    > use the published types in the main programm and are not able to switsch.
    >
    > Here some code
    >
    > WebService.dll
    > <WebMethod()> _
    >
    > Public Function GetName(ByVal param As [Shared].MyEnum) As String
    >
    > ' The parameter [Shared].MyEnum lost his namespace in the wsdl document :(
    >
    > Return "MyName"
    >
    > End Function
    >
    >
    >
    > Shared.dll
    >
    > Public Enum MyEnum
    >
    > param1
    >
    > param2
    >
    > End Enum
    >
    >
    >
    > Client.exe
    >
    >
    >
    > Dim dm As New localhost.Service1
    >
    > Dim a As [Shared].MyEnum
    >
    > a = [Shared].MyEnum.param1
    >
    > 'Me.Label1.Text = dm.GetName(a) ' not working because it is not the valid
    > type, but thats the way i need it !
    >
    > Me.Label1.Text = dm.GetName(localhost.MyEnum.param1)
    >
    >
    Dino Chiesa [Microsoft], Aug 23, 2004
    #2
    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. Guest
    Replies:
    2
    Views:
    540
    Yan-Hong Huang[MSFT]
    Jul 28, 2003
  2. =?Utf-8?B?UGF1cmF2aQ==?=

    Problem while reading excel file with mix datatypes

    =?Utf-8?B?UGF1cmF2aQ==?=, Mar 2, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    575
    Alvin Bruney [MVP]
    Mar 4, 2004
  3. .Net Sports
    Replies:
    1
    Views:
    701
    John Rivers
    Aug 31, 2005
  4. Mark
    Replies:
    2
    Views:
    1,060
  5. Ashish

    complex datatypes in webservices.

    Ashish, Dec 19, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    318
    Joshua Flanagan
    Dec 19, 2005
Loading...

Share This Page