Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6096175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:53:47+00:00 2026-05-23T12:53:47+00:00

Can someone point me to a sample solution that I can download? I am

  • 0

Can someone point me to a sample solution that I can download? I am having trouble trying to find one.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:53:47+00:00Added an answer on May 23, 2026 at 12:53 pm

    Create a class library, MyInterfaces, that houses just your interfaces:

    Imports System.Runtime.Serialization
    Imports System.ServiceModel
    ' NOTE: You can use the "Rename" command on the context menu to change the interface name "IService" in both code and config file together.
    <ServiceContract()>
    Public Interface IService
    
        <OperationContract()>
        Function GetData(ByVal value As Integer) As String
    
        <OperationContract()>
        Function GetDataUsingDataContract(ByVal composite As CompositeType) As CompositeType
    
        <OperationContract()>
        Function GetCustomer() As Customer
    
        ' TODO: Add your service operations here
    
    End Interface
    
    ' Use a data contract as illustrated in the sample below to add composite types to service operations.
    Public Class Customer
    
        <DataMember()>
        Public Property Name() As String
    
        <DataMember()>
        Public Property Age() As Integer
    
    End Class
    
    <DataContract()>
    Public Class CompositeType
    
        <DataMember()>
        Public Property BoolValue() As Boolean
        <DataMember()>
        Public Property StringValue() As String
    
    End Class
    

    Add a Web Service Library project. Set a reference to the above project that contains the above Interfaces. Add the following code to this project:

    Imports MyInterfaces
    
    ' NOTE: You can use the "Rename" command on the context menu to change the class name "Service" in code, svc and config file together.
    Public Class Service
        Implements IService
    
    
        Public Function GetData(ByVal value As Integer) As String Implements IService.GetData
            Return String.Format("You entered: {0}", value)
        End Function
    
        Public Function GetDataUsingDataContract(ByVal composite As CompositeType) As CompositeType Implements IService.GetDataUsingDataContract
            If composite Is Nothing Then
                Throw New ArgumentNullException("composite")
            End If
            If composite.BoolValue Then
                composite.StringValue &= "Suffix"
            End If
            Return composite
        End Function
    
        Public Function GetCustomer() As MyInterfaces.Customer Implements MyInterfaces.IService.GetCustomer
            Dim x As New Customer
            x.Age = 15
            x.Name = "Chad"
            Return x
        End Function
    
    End Class
    

    Add a 3rd project, a client app which will consume the Service. I’ll make mine a WinForm app. Have this project also reference the Interface projrect. Add this code:

    Imports System.ServiceModel
    Imports MyInterfaces
    
    Public Class Form1
    
        Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
    
            Dim endPoint As New EndpointAddress("http://localhost:9496/WCFService4/Service.svc")
            Dim binding As New BasicHttpBinding()
    
            Dim proxy As IService = ChannelFactory(Of IService).CreateChannel(binding, endPoint)
    
            Dim getDateResult As String = proxy.GetData(3)
    
            Dim myCompositeType As New MyInterfaces.CompositeType
            myCompositeType.BoolValue = True
            myCompositeType.StringValue = "ok"
    
            Dim result As MyInterfaces.CompositeType = proxy.GetDataUsingDataContract(myCompositeType)
            MessageBox.Show(result.StringValue)
    End Sub
    

    This is just a quick and dirty example. My goal was to get rid of the generated proxy object that you normally get when you use the Add Service Wizard. I suppose that end point should come from a config file, though I am not sure how to dynamically determine what the port will be when debugging under VS’ web server.

    Dim endPoint As New EndpointAddress("http://localhost:9496/WCFService4/Service.svc")
    

    The one thing that I don’t like about this is that the objects I pass, eg, a Customer object, which represent a potential Business Object, seem to require that they have a default parameterless constructor. I prefer to have constructors to ensure that my object was properly initialized wherever it may have been used.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone point me to a solid sample app that shows how to use
Can you someone please point in me in a direction, sample code or an
I am trying to accomplish something very simple, and I'm hoping someone can point
Can someone point me to an article (or discuss here) that explains how an
Can someone point me to an article that shows the dropdownlist being populated from
Can someone point me in the right direction? I wish to distribute a WCF
Can someone point me to a public domain (or MIT- or BSD-license) library for
Can someone point me to videos/blogs/instructions on using Web Testing in Visual Studio 2008
Can someone point me to some tutorial on how to set up a ping
Can someone point out a couple of good quality tutorials/pages for donut caching? Like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.