Musical Teacher Web Service

A number of people / organizations have developed web services that are available for free to use.

Here is an example of a web service that allows us to search for Music teachers near your zip code. Go to Web Site.

In this example we have a web service up and running. What we need to do is to, generate a proxy code for this service using the Web Services Description Language ( WSDL.EXE ). Develop a Windows or Web application that can use this proxy code to access methods exposed from the web service.

Execute the 2 commands and you are set to go Its that simple and straight.

MT_DOSCMD.jpg

Here is the SearchMusicTeachers.cs file generated using the WSDL.EXE tool containing the web methods exposed by this service.

//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version: 1.0.2914.16
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
// This source code was auto-generated by wsdl, Version=1.0.2914.16.
//
namespace SearchMusicTeachersNameSpace
{
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.Web.Services;
[System.Web.Services.WebServiceBindingAttribute(Name="SearchMusicTeachersSoap",
Namespace=http://www.PerfectXML.com/NETWebSvcs/MusicTeachers/)]
public class SearchMusicTeachers : System.Web.Services.Protocols.SoapHttpClientProtocol
{
[System.Diagnostics.DebuggerStepThroughAttribute()]
public SearchMusicTeachers()
{
this.Url = http://www.perfectxml.net/WebServices/MusicTeachers/MusicTeachers.asmx;
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute
(http://www.PerfectXML.com/NETWebSvcs/MusicTeachers/FindMusicTeachers2,
RequestNamespace=http://www.PerfectXML.com/NETWebSvcs/MusicTeachers/,
ResponseNamespace=http://www.PerfectXML.com/NETWebSvcs/MusicTeachers/,
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]

public
string FindMusicTeachers2(string ZipCode, string Instrument, string SkillLevel,
string Style, int Radius, int RestrictResultsCount)
{
object[] results = this.Invoke("FindMusicTeachers2", new object[] {
ZipCode,
Instrument,
SkillLevel,
Style,
Radius,
RestrictResultsCount});
return ((string)(results[0]));
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
public System.IAsyncResult BeginFindMusicTeachers2(string ZipCode, string Instrument, string SkillLevel, string Style,
int Radius, int RestrictResultsCount, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("FindMusicTeachers2", new object[] {
ZipCode,
Instrument,
SkillLevel,
Style,
Radius,
RestrictResultsCount}, callback, asyncState);
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
public string EndFindMusicTeachers2(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute(http://www.PerfectXML.com/NETWebSvcs/MusicTeachers/FindMusicTeachers,
RequestNamespace=http://www.PerfectXML.com/NETWebSvcs/MusicTeachers/,
ResponseNamespace=http://www.PerfectXML.com/NETWebSvcs/MusicTeachers/,
Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=
System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public System.Data.DataSet FindMusicTeachers(string ZipCode, string Instrument, string SkillLevel, string Style,
int Radius, int RestrictResultsCount)
{
object[] results = this.Invoke("FindMusicTeachers", new object[] {
ZipCode,
Instrument,
SkillLevel,
Style,
Radius,
RestrictResultsCount});
return ((System.Data.DataSet)(results[0]));
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
public System.IAsyncResult BeginFindMusicTeachers(string ZipCode, string Instrument, string SkillLevel,
string Style, int Radius, int RestrictResultsCount, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("FindMusicTeachers", new object[] {
ZipCode,
Instrument,
SkillLevel,
Style,
Radius,
RestrictResultsCount}, callback, asyncState);
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
public System.Data.DataSet EndFindMusicTeachers(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((System.Data.DataSet)(results[0]));
}
}
}

WINDOWS APPLICATION

For this example I am using the FindMusicTeachers2 WebMethod.

MT_1.jpg

Here is the result from the search.

MT_2.jpg

ASP.NET WEB APPLICATION

MT_ASP1.jpg
MT_ASP2.jpg

Up Next
    Ebook Download
    View all
    Learn
    View all