Web services are loosely coupled, reusable software components that semantically encapsulate discrete functionality and are distributed and programmatically accessible over standard Internet protocols. In particular, Web services are a lot of new rules that describe service-oriented architecture based on application components. Conceptually, web services represent a model in which discrete tasks within e-business processes are distributed widely throughout a value network. XML Web services are the cornerstones in the transition to distributed computing on the Internet. Open standards and emphasis on communication and collaboration between people and applications have created an environment where XML Web services are becoming the platform for application integration.
SharePoint supports interoperability and remote operations through a set of web services, WSS 3. 0 (Windows SharePoint Services) and MOSS 2007 (Microsoft Office SharePoint Server) Windows SharePoint Services Web services provide methods that you can use to work remotely with a deployment of Windows SharePoint Services. There are a number of approaches for programmatic access to SharePoint, as the object model, web services, remote procedure call over HTTP, and Web-based Distributed Authoring and Versioning, all of which have their advantages and their place depending on what the solution requires. SharePoint Web Services built on top of SharePoint object model and expose a subset of features available in the object model, and allow remote operations and the use of any programming language and platform that supports the consumption Web services.
SharePoint Web services running on ASP. NET Web Services (ASMX) and find the physical files for most of these web services in the shared directory "Microsoft" Web Server Extensions \ 12 \ ISAPI "usually found in" C: \ Program Files \ Common Files \ Microsoft Shared \ Web Server Extensions \ 12 \ ISAPI. "IIS does not contain any applications or virtual directories to sub webs, they do however, contain maps to the _vti_bin virtual directory through SharePoint and httpModules metadata.
Here we will see the construction process of the dynamics of the SharePoint Web services in our C # code.
With the help of reflection and proxy code generation concept that we are building web services dynamically
// Generate the proxy code
CodeDomProvider provider1 = CodeDomProvider.CreateProvider("CSharp");
// Compile the assembly proxy with the appropriate references
string[] assemblyReferences = new string[5] { "System.dll", "System.Web.Services.dll",
"System.Web.dll", "System.Xml.dll", "System.Data.dll" };
CompilerParameters parms = new CompilerParameters(assemblyReferences);
CompilerResults results = provider1.CompileAssemblyFromDom(parms, unit1);
// Check For Errors
if (results.Errors.Count > 0)
{
foreach (CompilerError oops in results.Errors)
{
System.Diagnostics.Debug.WriteLine("========Compiler error============");
System.Diagnostics.Debug.WriteLine(oops.ErrorText);
}
throw new System.Exception(
"Compile Error Occured calling webservice. Check Debug ouput window.");
}
// Finally, Invoke the web service method
object wsvcClass = results.CompiledAssembly.CreateInstance(serviceName);
MethodInfo mi = wsvcClass.GetType().GetMethod(methodName);
((System.Web.Services.Protocols.WebClientProtocol)(wsvcClass)).Credentials =
netCredential;
0 comments:
Post a Comment