Hi,

I have a webservice which needs to be serialized.

At the moment I can call the webservice as:

  Call10.Process("field_a","field_b")

and the function looks like this:

 Public Function Call10(ByVal User As String, ByVal Password As String) As String

    If User = "user" Then
        MsgBox("Correct User")
    End If

    If Password = "password" Then
        MsgBox("Correct Password")
    End If

    Return "Success"
End Function

The client wants to be able to call the webservice as:

Dim Call10Input as New Call10Input
Call10Input.User = "user"
Call10Input.Password = "password"
Call10.Process(Call10Input)

I'm assuming I would have to create Call10Input as a class and then accept Call10Input into the function but I'm at a loss as to how to do this.

Any help will be greatly appreciated!

Something like this might work:

Public Class Call10Input
    Private _User As String = ""
    Private _Password As String = ""
    Public Property User() As String
        Get
            Return _User
        End Get
        Set(ByVal Value)
            _User = Value
        End Set
    Public Property Password() As String
        Get
            Return _Password
        End Get
        Set(ByVal Value)
            _Password = Value
        End Set        
    Public Function Call10() As String
        If _User = "user" Then
            MsgBox("Correct User")
        End If
        If _Password = "password" Then
            MsgBox("Correct Password")
        End If
        Return "Success"
    End Function            
End Class

Using it might look like this

Dim NewCall10Input As New Call10Input
NewCall10Input.User = "user"
NewCall10Input.Password = "password"
Call10.Process(NewCall10Input.Call10())

With the function inside the class, it uses the properties of the class.

Thank you! Works perfectly!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.