Windows Scripting
  Home arrow Windows Scripting arrow Page 4 - Exploring the SoapEnvelope Class in WSE2.0
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 
Mobile Linux 
App Generation ROI 
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? 
WINDOWS SCRIPTING

Exploring the SoapEnvelope Class in WSE2.0
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 2
    2007-01-08

    Table of Contents:
  • Exploring the SoapEnvelope Class in WSE2.0
  • SoapEnvelope Methods
  • Exploring Properties and Methods
  • LoadXML and InnerText Properties
  • Body Property and SetBodyObject() method

  • 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


    Exploring the SoapEnvelope Class in WSE2.0 - LoadXML and InnerText Properties


    (Page 4 of 5 )

    The following code creates a web service which looks at the inner text property of a SoapEnvelope:

    Imports System.Web.Services
    Imports Microsoft.Web.Services2
    <System.Web.Services.WebService(Namespace := 
    "http://tempuri.org/WSE2_1/Props")> _ Public Class Props Inherits System.Web.Services.WebService
    #Region
    " Web Services Designer Generated Code " [author's note: this code has been removed for clarity] #End Region <WebMethod()> _ Public Function InTxt() As String Dim sen1 As New Microsoft.Web.Services2.SoapEnvelope Try sen1.LoadXml("<soap:Envelope xmlns:xsi=
    'http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> <soap:Body> <nom>United States</nom> </soap:Body></soap:Envelope>
    ") Return sen1.InnerText Catch ex As Exception Return ex.Message End Try End Function End Class

    We shall only concentrate on some of the important items highlighted in blue in the code without concerning ourselves too much with the designer created code. The second line below shows that the proper reference to WSE2.0 has been made.

    Imports System.Web.Services

     

    Imports Microsoft.Web.Services2

    Most of the properties and methods will be explored in this WebMethod template  called InTxt(). This will actually look at the inner text property of the SoapEnvelope. The SoapEnvelope constructor admits of the NEW method and therefore a SoapEnvelope, sen1, is declared using the New keyword.

    Once declared it is assigned a value which is appropriate for a SoapEnvelope document as shown. In the above code, the LoadXML() method is used to load the SoapEnvelope. The method's return is set to the inner text property of the SoapEnvelope that was loaded. Build the solution and right click the Props.asmx to click on View in Browser. This brings up the following browser screen:

    The InTxt is the method of the web service can be tested by clicking the link which brings up the following (partially shown here):

    The method can be tested by clicking the Invoke button in the browser. The result is shown again in the browser as shown:

    This is the SoapEnvelope's InnerText property.

    More Windows Scripting Articles
    More By Jayaram Krishnaswamy


       · Web Services Extensions which has had 3 avatars aims at achieving the goal of...
     

    WINDOWS SCRIPTING ARTICLES

    - Introducing Two-Way Data Binding using Silve...
    - Silverlight 2.0 Application Development with...
    - Burning Multisession CDs with IMAPI2 in WSH
    - Creating a Silverlight 2.0 Application that ...
    - Burning CDs with the IMAPI2 Control
    - Burning CDs in Windows XP with WSH
    - Advanced Word Object Scripting
    - Reading and Printing Word Documents in WSH
    - Scripting Microsoft Word
    - Using WSH to Catalog MP3 Files
    - Reading MP3 ID3 Tags in WSH
    - A Brief Look at Menus in WPF
    - More Examples of Simplified Image Processing...
    - Completing a WPF To-Do List Application
    - Simplified Image Processing in GDI+





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT