SunQuest
 
       Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 4 - Encoding/Decoding Web Service: Service Con...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VISUAL BASIC.NET

Encoding/Decoding Web Service: Service Consumer
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 5
    2006-01-17

    Table of Contents:
  • Encoding/Decoding Web Service: Service Consumer
  • Generating a proxy
  • Service Consumer Creation 1-2-3
  • Two: Creating the user interface
  • Three: Testing the Client

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    Encoding/Decoding Web Service: Service Consumer - Two: Creating the user interface


    (Page 4 of 5 )

    The Form1 is the canvas we will be using for accessing the web service. This form must refer to the proxy class by importing as defined by this imports statement added at the top of the TestEncodeVB. vb file. The localhost has the Service1.asmx file. 

    Imports TestEncodeVB.localhost 

    If you recall the Hencode web service project, it had two methods defined in it, the Enc and the Denc for encoding and decoding respectively. We will code the client so that we can access either of these methods. The Form1 will have a couple of text boxes, and command buttons to facilitate passing parameters (strings in this case) to the Enc and Denc methods and displaying the results returned by the service. The next picture shows the Form1 with all the controls added.

    The Visual Studio IDE is very well engineered with the drop down cues which facilitate the coding. The onclick events of these buttons are coded as shown here. Once you get the reference to the proxy class you can access the methods Enc and Denc through Service1.enc() and Service1.denc().

    'For encoding
    Private Sub Button2_Click(ByVal sender As _
    System.Object, ByVal e As System.EventArgs) _
    Handles Button2.Click
    If TextBox1.Text = "" Then
    MsgBox("You insert a string in the box above")
    End If
    Dim strg As String
    strg = Trim(TextBox1.Text)
    Dim mysvc As New Service1
    TextBox2.Text = mysvc.enc(strg)
    End Sub
    'For decoding
    Private Sub Button1_Click(ByVal sender As _
    System.Object, ByVal e As System.EventArgs) Handles _
    Button1.Click
    If TextBox3.Text = "" Then
    MsgBox("You insert a string in the box above")
    End If
    Dim mysvc As New localhost.Service1
    Dim strg As String
    strg = Trim(TextBox3.Text)
    TextBox4.Text = mysvc.denc(strg)
    End Sub
    This completes the coding of the user interface to access the web service.

    More Visual Basic.NET Articles
    More By Jayaram Krishnaswamy


       · First of all, I suggest you read the following article before you read the present...
     

    VISUAL BASIC.NET ARTICLES

    - Entity Creation and Messaging in a VB.NET Te...
    - Movement and Player Statistics in a VB.NET T...
    - Creating and Drawing a Game Map in VB.NET
    - Working with Classes and Properties for Game...
    - Working with Loops, Arrays, and Collections ...
    - Learning Loops in VB.NET for Game Development
    - Learning VB.NET: Working with Variables, Con...
    - The Basics of VB.NET Through Text Game Devel...
    - Learning VB.NET Through Text Game Development
    - Types of Operators in Visual Basic
    - Operators
    - Understanding Custom Events using Visual Bas...
    - Polymorphism using Abstract Classes in Visua...
    - Shadowing using Shadows in Visual Basic.NET ...
    - Overloading and Overriding in Visual Basic.N...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway